{"id":13532435,"url":"https://github.com/facebookarchive/fbshipit","last_synced_at":"2025-04-01T20:32:06.009Z","repository":{"id":37706164,"uuid":"53975480","full_name":"facebookarchive/fbshipit","owner":"facebookarchive","description":"Copy commits between repositories · git → git, git → hg, hg → hg, or hg → git","archived":true,"fork":false,"pushed_at":"2023-06-07T19:47:15.000Z","size":2742,"stargazers_count":391,"open_issues_count":10,"forks_count":107,"subscribers_count":47,"default_branch":"main","last_synced_at":"2024-05-21T13:57:18.709Z","etag":null,"topics":["commits","facebook","git","hack","hacklang","mercurial","sync"],"latest_commit_sha":null,"homepage":"","language":"Hack","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookarchive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-03-15T20:16:23.000Z","updated_at":"2024-05-02T16:43:20.000Z","dependencies_parsed_at":"2023-07-14T20:23:17.089Z","dependency_job_id":"9e72f9de-a30c-45c6-9813-f9b61d2dd79b","html_url":"https://github.com/facebookarchive/fbshipit","commit_stats":null,"previous_names":["facebook/fbshipit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Ffbshipit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Ffbshipit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Ffbshipit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Ffbshipit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookarchive","download_url":"https://codeload.github.com/facebookarchive/fbshipit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"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":["commits","facebook","git","hack","hacklang","mercurial","sync"],"created_at":"2024-08-01T07:01:10.937Z","updated_at":"2025-04-01T20:32:00.985Z","avatar_url":"https://github.com/facebookarchive.png","language":"Hack","funding_links":[],"categories":["仓库管理工具"],"sub_categories":[],"readme":"# FBShipIt\n\nNOTE: This project is no longer maintained. Meta has switched to using a\n(currently) closed-source solution to this that we hope to release in the\nfuture. Existing Open Source users can check out\n[Copybara](https://github.com/google/copybara).\n\nFBShipIt is a library written in [Hack](http://hacklang.org) for\ncopying commits from one repository to another.\n\nFor example, Meta uses it to:\n\n - copy commits from our monolithic Mercurial repository to\n   project-specific GitHub repositories\n - sync changes from project specific repos like CPython and the linux kernel\n - Import changes from PyTorch into our Mercurial monorepo\n\n## Major Features\n\n - read from Git or Mercurial (hg) repositories\n - write to Git or Mercurial (hg) repositories\n - remove files or directories matching certain patterns\n - remove/rewrite sections of commit messages\n - modify commit authors (for example, if all internal commits are authored by\n   employees, restore original authors for GitHub pull requests)\n\n## Major Limitations\n\nFBShipIt has been primarily designed for branches with linear histories; in\nparticular, it does not understand merge commits.\n\n## Requirements\n\n - [HHVM (latest release)](https://docs.hhvm.com/hhvm/installation)\n - [Composer](https://getcomposer.org/doc/00-intro.md)\n\n## Installing\n\n```\n$ composer require facebook/fbshipit\n```\n\n## How FBShipIt Works\n\nThere are three main concepts: phases, changesets, and filters.\n\n`ShipItPhase` objects represent a high-level action, such as\n'clone this repository', 'pull this repository',\n'sync changesets', and 'push repository'.\n\nWithin the sync phase, a `ShipItChangeset` is an immutable\nobject representing a commit.\n\nFilters are functions that take\na Changeset, and return a new, modified one.\n\n### Provided Phases\n\n - `ShipItCreateNewRepoPhase`: creates a new Git repository with an 'initial commit'. Skipped unless `--create-new-repo` passed.\n - `ShipItAssertValidFilterPhase`: make sure that the filter is consistent with the specified roots.\n - `ShipItGitHubInitPhase`: create and configure a github clone.\n - `ShipItPullPhase`: pull in any new changes to a repository.\n - `ShipItPushPhase`: push local changes to the destination repository.\n - `ShipItSyncPhase`: copy commits from the source repository to the destination repository.\n - `ShipItVerifyRepoPhase`: check that the destination repository matches the source repository and filter. Skipped unless `--verify` or `--create-fixup-patch` is passed.\n\n## Using FBShipIt\n\nYou need to construct:\n - a `ShipItManifest` object, defining your default working directory, and the directory names of your source and destination repositories\n - a list of phases you want to run\n - a pipeline of filters, assuming you are using the `ShipItSyncPhase`\n\nFilters are provided for common operations - the most frequent are:\n - `ShipItPathFilters::moveDirectories(string $changeset, dict\u003cstring, string\u003e $mapping)`: apply patches to a different directory in the destination repository\n - `ShipItPathFilters::stripPaths(string $changeset, vec\u003cstring\u003e $patterns, vec\u003cstring\u003e $exception_patterns = vec[])`: remove any modifications to paths matching `$patterns`, unless they match something in `$exception_patterns`.\n\n## Example\n\nSee the [`demo/`](demo) directory for a simple example to start from.\n\n## Using With An Empty Destination Repository\n\nAdd `ShipItCreateNewRepoPhase` to your phase list (after source init and pull\nphases), then run:\n\n```\nhhvm my_script.hack --create-new-repo\n```\n\nThis will give you the path to a git repository with a single commit; you can then push it to your destination.\n\n## Using With An Existing Destination Repository\n\nWhen there is at least one relevant commit in the source repository that is not in the destination repository, run:\n\n```\nhhvm my_script.hack --first-commit=FIRST_UNSYNCED_COMMIT_ID_GOES_HERE\n```\n\n## Future Runs\n\nRun your script with no arguments; FBShipIt adds tracking information to the\ncommits it creates, so will automatically sync any new commits.\n\n## Reducing Common Code With Multiple Projects\n\nWe recommend splitting out common filters and phase setup to separate classes,\nand for these to be re-used between your projects. For an example from Facebook's\nusage, see [FBCommonFilters](fb-examples/lib/shipit/FBCommonFilters.php-example)\n\n## Further Examples\n\nSome other code that might be useful for configuring FBShipIt can be found in\n[fb-examples/](https://github.com/facebook/fbshipit/tree/master/fb-examples).\n\n## License\n\nFBShipIt is MIT-licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Ffbshipit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookarchive%2Ffbshipit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Ffbshipit/lists"}