{"id":13636467,"url":"https://github.com/jelmer/silver-platter","last_synced_at":"2025-04-05T12:02:42.997Z","repository":{"id":41821781,"uuid":"154917478","full_name":"jelmer/silver-platter","owner":"jelmer","description":"Automate the creation of merge proposals for scriptable changes","archived":false,"fork":false,"pushed_at":"2024-10-21T12:01:47.000Z","size":5289,"stargazers_count":38,"open_issues_count":7,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-23T08:11:04.551Z","etag":null,"topics":["bzr","git","merge-proposal","pull-request","pull-requests","vcs"],"latest_commit_sha":null,"homepage":"https://jelmer.uk/code/silver-platter","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jelmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jelmer"}},"created_at":"2018-10-27T02:42:50.000Z","updated_at":"2024-10-21T09:42:24.000Z","dependencies_parsed_at":"2023-12-28T23:59:40.009Z","dependency_job_id":"56b181fb-d059-4ac1-b3ce-501636b39611","html_url":"https://github.com/jelmer/silver-platter","commit_stats":{"total_commits":1199,"total_committers":6,"mean_commits":"199.83333333333334","dds":0.00917431192660545,"last_synced_commit":"fbf4b33b02a1e90938a6e5091915f5e2ece8f944"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jelmer%2Fsilver-platter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jelmer%2Fsilver-platter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jelmer%2Fsilver-platter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jelmer%2Fsilver-platter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jelmer","download_url":"https://codeload.github.com/jelmer/silver-platter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332559,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bzr","git","merge-proposal","pull-request","pull-requests","vcs"],"created_at":"2024-08-02T00:01:01.623Z","updated_at":"2025-04-05T12:02:42.963Z","avatar_url":"https://github.com/jelmer.png","language":"Rust","funding_links":["https://github.com/sponsors/jelmer"],"categories":["Tools for invoking codemods","Rust"],"sub_categories":["Debian"],"readme":"# Silver-Platter\n\n\u003cimg src=\"logo.png\" alt=\"Silver-Platter logo\" align=\"center\" width=\"200px\"/\u003e\n\nSilver-Platter makes it possible to contribute automatable changes to source\ncode in a version control system\n([codemods](https://github.com/jelmer/awesome-codemods)).\n\nIt automatically creates a local checkout of a remote repository,\nmakes user-specified changes, publishes those changes on the remote hosting\nsite and then creates a pull request.\n\nIn addition to that, it can also perform basic maintenance on branches\nthat have been proposed for merging - such as restarting them if they\nhave conflicts due to upstream changes.\n\nSilver-Platter powers the [Debian Janitor](https://janitor.debian.org/) and\n[Kali Janitor](https://janitor.kali.org/). However, it is an independent project\nand can be used fine as a standalone tool. The UI is still a bit rough around\nthe edges, I'd be grateful for any feedback from people using it - please file bugs in\nthe issue tracker at https://github.com/jelmer/silver-platter/issues/new.\n\n## Getting started\n\nTo log in to a code-hosting site, use ``svp login``:\n\n```shell\n\nsvp login https://github.com/\n```\n\nThe simplest way to create a change as a merge proposal is to run something like:\n\n```shell\n\nsvp run --mode=propose ./framwork.sh https://github.com/jelmer/dulwich\n```\n\nwhere ``framwork.sh`` makes some modifications to a working copy and prints the\ncommit message and body for the pull request to standard out. For example:\n\n```shell\n\n#!/bin/sh\nsed -i 's/framwork/framework/' README.rst\necho \"Fix common typo: framwork ⇒ framework\"\n```\n\nIf you leave pending changes, silver-platter will automatically create a commit\nand use the output from the script as the commit message. Scripts also\ncreate their own commits if they prefer - this is especially useful if they\nwould like to create multiple commits.\n\n## Recipes\n\nTo make this process a little bit easier to repeat, recipe files can be used.\nFor the example above, we could create a ``framwork.yaml`` with the following\ncontents:\n\n```yaml\n\n---\nname: framwork\ncommand: |-\n sed -i 's/framwork/framework/' README.rst\n echo \"Fix common typo: framwork ⇒ framework\"\nmode: propose\nmerge-request:\n  commit-message: Fix a typo\n  description:\n    markdown: |-\n      I spotted that we often mistype *framework* as *framwork*.\n```\n\nTo execute this recipe, run:\n\n```shell\n\nsvp run --recipe=framwork.yaml https://github.com/jelmer/dulwich\n```\n\nSee `example.yaml` for an example recipe with plenty of comments.\n\nIn addition, you can run a particular recipe over a set of repositories by\nspecifying a candidate list.\nFor example, if *candidates.yaml* looked like this:\n\n```yaml\n\n---\n- url: https://github.com/dulwich/dulwich\n- url: https://github.com/jelmer/xandikos\n\n```\n\nthen the following command would process each repository in turn:\n\n```shell\n\nsvp run --recipe=framwork.yaml --candidates=candidates.yaml\n```\n\n## Batch Mode\n\nUse batch mode when you're going to make a large number of changes and would\nlike to review or modify the diffs before sending them out:\n\n```shell\n\nsvp batch generate --recipe=framwork.yaml --candidates=candidate.syml framwork\n```\n\nThis will then create a directory called \"framwork\", with a file called\n``batch.yaml`` with all the pending changes:\n\n```yaml\n\nname: framwork\nwork:\n- url: https://github.com/dulwich/dulwich\n  name: dulwich\n  description: I spotted that we often mistype *framework* as *framwork*.\n  commit-message: Fix a typo\n  mode: propose\n- url: https://github.com/jelmer/xandikos\n  name: dulwich\n  description: I spotted that we often mistype *framework* as *framwork*.\n  commit-message: Fix a typo\n  mode: propose\nrecipe: ../framwork.yaml\n```\n\nFor each of the candidates, a clone with the changes is created. You can introspect\nand modify the clones as appropriate.\n\nAfter you review the changes, edit batch.yaml as you see fit - remove\nentries that don't appear to be correct, edit the details for the merge\nrequests, etc.\n\nOnce you're happy, you can publish the results:\n\n```shell\n\nsvp batch publish framwork\n```\n\nThis will publish all the changes, using the mode and parameters specified in\n``batch.yaml``.\n\n``batch.yaml`` is automatically stripped of any entries in work that have fully\nlanded, i.e. where the pull request has been merged or where the changes were\npushed to the origin.\n\nTo check up on the status of your changes, run ``svp batch status``:\n\n```shell\n\nsvp batch status framwork\n```\n\nAnd to refresh any merge proposals that may have become out of date,\nrun publish again:\n\n```shell\n\nsvp batch publish framwork\n```\n\n## Supported hosters\n\nAt the moment, the following code hosters are supported:\n\n* [GitHub](https://github.com/)\n* [Launchpad](https://launchpad.net/)\n* [GitLab](https://gitlab.com/) instances, such as Debian's\n  [Salsa](https://salsa.debian.org) or [GNOME's GitLab](https://gitlab.gnome.org/)\n\n## Working with Debian packages\n\nSeveral common operations for Debian packages have dedicated subcommands\nunder the ``debian-svp`` command. These will also automatically look up\npackaging repository location for any Debian package names that are\nspecified.\n\n* *upload-pending*: Build and upload a package and push/propose the\n  changelog updates.\n* *run*: Similar to *svp run* but specific to Debian packages:\n  it ensures that the *upstream* and *pristine-tar* branches are available as\n  well, can optionally update the changelog, and can test that the branch still\n  builds.\n\nSome Debian-specific example recipes are provided in `examples/debian/`:\n\n* *lintian-fixes.yaml*: Run the [lintian-brush](https://packages.debian.org/lintian-brush) command to\n  fix common issues reported by [lintian](https://salsa.debian.org/qa/lintian).\n* *new-upstream-release.yaml*: Merge in a new upstream release.\n* *multi-arch-hints.yaml*: Apply multi-arch hints.\n* *orphan.yaml*: Mark a package as orphaned, update its Maintainer\n  field and move it to the common Debian salsa group.\n* *rules-requires-root.yaml*: Mark a package as \"Rules-Requires-Root: no\"\n* *cme.yaml*: Run \"cme fix dpkg\", from the\n  [cme package](https://packages.debian.org/cme).\n\n*debian-svp run* takes package name arguments that will be resolved\nto repository locations from the *Vcs-Git* field in the package.\n\nSee ``debian-svp COMMAND --help`` for more details.\n\nExamples running ``debian-svp``:\n\n```console\n\n# Create merge proposal running lintian-brush against Samba\ndebian-svp run --recipe=examples/lintian-brush.yaml samba\n\n# Upload pending changes for tdb\ndebian-svp upload-pending tdb\n\n# Upload pending changes for any packages maintained by Jelmer,\n# querying vcswatch.\ndebian-svp upload-pending --vcswatch --maintainer jelmer@debian.org\n\n# Import the latest upstream release for tdb, without testing\n# the build afterwards.\ndebian-svp run --recipe=examples/debian/new-upstream-release.yaml \\\n    --no-build-verify tdb\n\n# Apply multi-arch hints to tdb\ndebian-svp run --recipe=examples/debian/multiarch-hints.yaml tdb\n```\n\nThe following environment variables are provided for Debian packages:\n\n* ``DEB_SOURCE``: the source package name\n* ``DEB_UPDATE_CHANGELOG``: indicates whether a changelog entry should\n  be added. Either \"leave\" (leave alone) or \"update\" (update changelog).\n\n## Credentials\n\nThe ``svp hosters`` subcommand can be used to display the hosting sites that\nsilver-platter is aware of:\n\n```shell\n\nsvp hosters\n```\n\nAnd to log into a new hosting site, simply run ``svp login BASE-URL``, e.g.:\n\n```shell\n\nsvp login https://launchpad.net/\n```\n\n## Exit status\n\n``svp run`` will exit 0 if no changes have been made, 1 if at least one\nrepository has been changed and 2 in case of trouble.\n\n## Python API\n\nOther than the command-line API, silver-platter also has a Python API.\nThe core class is the ``Workspace`` context manager, which exists in two forms:\n\n * ``silver_platter.workspace.Workspace`` (for generic projects)\n * ``silver_platter.debian.Workspace`` (for Debian packages)\n\nAn example, adding a new entry to a changelog file in the ``dulwich`` Debian\npackage and creating a merge proposal with that change:\n\n```python\n\nfrom silver_platter.debian import Workspace\nimport subprocess\n\nwith Workspace.from_apt_package(package=\"dulwich\") as ws:\n    subprocess.check_call(['dch', 'some change'], cwd=ws.path)\n    ws.commit()  # Behaves like debcommit\n    ws.publish(mode='propose')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjelmer%2Fsilver-platter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjelmer%2Fsilver-platter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjelmer%2Fsilver-platter/lists"}