{"id":17870828,"url":"https://github.com/glandium/git-cinnabar","last_synced_at":"2025-04-07T19:10:59.371Z","repository":{"id":37335625,"uuid":"27603607","full_name":"glandium/git-cinnabar","owner":"glandium","description":"git remote helper to interact with mercurial repositories","archived":false,"fork":false,"pushed_at":"2024-09-30T22:04:22.000Z","size":4883,"stargazers_count":289,"open_issues_count":27,"forks_count":60,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-30T22:18:59.802Z","etag":null,"topics":["git","mercurial"],"latest_commit_sha":null,"homepage":"","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/glandium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-05T18:02:56.000Z","updated_at":"2024-09-30T20:31:04.000Z","dependencies_parsed_at":"2024-01-19T05:29:36.100Z","dependency_job_id":"79c7bb24-d45d-4c9d-8cc1-3b90ff82b450","html_url":"https://github.com/glandium/git-cinnabar","commit_stats":{"total_commits":2795,"total_committers":23,"mean_commits":"121.52173913043478","dds":"0.011806797853309514","last_synced_commit":"1bcdfb89056631718b3f48b9d127e3d93941b721"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glandium%2Fgit-cinnabar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glandium%2Fgit-cinnabar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glandium%2Fgit-cinnabar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glandium%2Fgit-cinnabar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glandium","download_url":"https://codeload.github.com/glandium/git-cinnabar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713256,"owners_count":20983683,"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":["git","mercurial"],"created_at":"2024-10-28T10:19:16.356Z","updated_at":"2025-04-07T19:10:59.028Z","avatar_url":"https://github.com/glandium.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-cinnabar 0.7\n================\n\n*cinnabar is the common natural form in which mercury can be found on Earth.\nIt contains mercury sulfide and its powder is used to make the vermillion\npigment.*\n\ngit-cinnabar is a git remote helper to interact with mercurial repositories.\nContrary to other such helpers\n([[1]](https://github.com/felipec/git-remote-hg)\n [[2]](https://github.com/rfk/git-remote-hg)\n [[3]](https://github.com/cosmin/git-hg)\n [[4]](https://github.com/todesschaf/git-hg)\n [[5]](https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg)\n [[6]](https://github.com/buchuki/gitifyhg/)), it doesn't use a local\nmercurial clone under the hood.\n\nThe main focus at the moment is to make it work with mozilla-central and\nrelated mercurial repositories and support Mozilla workflows (try server,\netc.).\n\nRepositories last used with versions lower than 0.5.0 are not supported.\nPlease run `git cinnabar upgrade` with version 0.5.0 first.\n\nLicense:\n--------\n\nThe git-cinnabar source code is distributed under the terms of the Mozilla Public\nLicense version 2.0 (see the MPL-2.0 file), with parts (the git-core subdirectory)\ndistributed under the terms of the GNU General Public License version 2.0 (see the\ngit-core/COPYING file).\n\nAs a consequence, git-cinnabar binary executables are distributed under the terms\nof the GNU General Public License version 2.0.\n\nRequirements:\n-------------\n\n- Git (any version should work ; cinnabarclone bundles require 1.4.4).\n- In order to build from source:\n  - Rust 1.75.0 or newer.\n  - A C compiler (GCC or clang).\n  - make.\n  - CURL development headers and libraries (except on Windows). Please note that on MacOS they are included in the SDK.\n\nSetup:\n------\n\n### Prebuilt binaries\n\n- Assuming a prebuilt binary is available for your system, get the\n  [download.py script](https://raw.githubusercontent.com/glandium/git-cinnabar/master/download.py)\n  and run it (requires python 3.9 or newer) with:\n\n  ```\n  $ ./download.py\n  ```\n\n- Add the directory where the download happened to your PATH. If you have\n  another git-remote-hg project in your PATH already, make sure the\n  git-cinnabar path comes before.\n\n### Cargo\n\n- Run the following:\n\n  ```\n  $ cargo install --locked git-cinnabar\n  $ git cinnabar setup\n  ```\n\n### Build manually\n\n- Run the following:\n\n  ```\n  $ git clone https://github.com/glandium/git-cinnabar\n  $ cd git-cinnabar\n  $ make\n  ```\n\n- Add the git-cinnabar directory to your PATH.\n\nUsage:\n------\n\n`$ git clone hg::\u003cmercurial repo\u003e`\n\nwhere `\u003cmercurial repo\u003e` can be a path to a local directory containing a\nmercurial repository, or a http, https or ssh url.\n\nEssentially, use git like you would for a git repository, but use a `hg::` url\nwhere you would use a `git://` url.\n\nSee https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development\nfor an example workflow for Mozilla repositories.\n\nRemote refs styles:\n-------------------\n\nMercurial has two different ways to handle what git would call branches:\nbranches and bookmarks. Mercurial branches are permanent markers on each\nchangeset that belongs to them, and bookmarks are similar to git branches.\n\nYou may choose how to interact with those with the `cinnabar.refs`\nconfiguration. The following values are supported, either individually or\ncombined in a comma-separated list:\n\n- `bookmarks`: in this mode, the mercurial repository's bookmarks are exposed\n  as `refs/heads/$bookmark`. Practically speaking, this means the mercurial\n  bookmarks appear as the remote git branches.\n\n- `tips`: in this mode, the most recent head of each mercurial branch is\n  exposed as `refs/heads/$branch`. Any other head of the same branch is not\n  exposed. This mode can be useful when branches have no more than one head.\n\n- `heads`: in this mode, the mercurial repository's heads are exposed as\n  `refs/heads/$branch/$head`, where `$branch` is the mercurial branch name\n  and `$head` is the full changeset sha1 of that head.\n\nWhen these values are used in combinations, the branch mappings are varied\naccordingly to make the type of each remote ref explicit and to avoid name\ncollisions.\n\n- When combining `bookmarks` and `heads`, bookmarks are exposed as\n  `refs/heads/bookmarks/$bookmark` and branch heads are exposed as\n  `refs/heads/branches/$branch/$head` (where `$head` is the full changeset\n  sha1 of the head).\n\n- When combining `bookmarks` and `tips`, bookmarks are exposed as\n  `refs/heads/bookmarks/$bookmark` and branch tips are exposed as\n  `refs/heads/branches/$branch`. Any other heads of the same branch are not\n  exposed.\n\n- When combining all of `bookmarks`, `heads`, and `tips`, bookmarks are\n  exposed as `refs/heads/bookmarks/$bookmark`, branch heads are exposed as\n  `refs/heads/branches/$branch/$head` (where `$head` is the full changeset\n  sha1 of the head), except for the branch tips, which are exposed as\n  `refs/heads/branches/$branch/tip`.\n\nThe shorthand `all` (also the default), is the combination of `bookmarks`,\n`heads`, and `tips`.\n\nThe refs style can also be configured per remote with the\n`remote.$remote.cinnabar-refs` configuration. It is also possible to use\n`cinnabar.pushrefs` or `remote.$remote.cinnabar-pushrefs` to use a different\nscheme for pushes only.\n\nTags:\n-----\n\nYou can get/update tags with the following command:\n\n`$ git cinnabar fetch --tags`\n\nFetching a specific mercurial changeset:\n----------------------------------------\n\nIt can sometimes be useful to fetch a specific mercurial changeset from a\nremote server, without fetching the entire repository. This can be done with a command line such as:\n\n`$ git cinnabar fetch hg::\u003cmercurial repo\u003e \u003cchangeset sha1\u003e`\n\nTranslating git commits to mercurial changesets and vice-versa:\n---------------------------------------------------------------\n\nWhen dealing with a remote repository that doesn't use the same identifiers,\nthings can easily get complicated. Git-cinnabar comes with commands to know the\nmercurial changeset a git commit represents and the other way around.\n\nThe following command will give you the git commit corresponding to the given\nmercurial changeset sha1:\n\n`$ git cinnabar hg2git \u003cchangeset\u003e`\n\nThe following command will give you the mercurial changeset corresponding to\nthe given git commit sha1:\n\n`$ git cinnabar git2hg \u003ccommit\u003e`\n\nBoth commands allow abbreviated forms, as long as they are unambiguous\n(no need for all the 40 hex digits of the sha1).\n\nAvoiding metadata:\n------------------\n\nIn some cases, it is not desirable to have git-cinnabar create metadata for all\npushed commits. Notably, for volatile commits such as those used on the Mozilla\ntry repository.\n\nBy default, git-cinnabar doesn't store metadata when pushing to non-publishing\nrepositories. It does otherwise.\n\nThis behavior can be changed per-remote with a `remote.$remote.cinnabar-data`\npreference with one of the following values:\n- `always`\n- `never`\n- `phase`\n- `force`\n\n`phase` is the default described above. `always` and `never` are\nself-explanatory. `force` has the same meaning as `always`, but also\nforces `git push --dry-run` to store metadata.\n\nCinnabar clone:\n---------------\n\nFor large repositories, an initial clone can take a large amount of time.\nA Mercurial server operator can install the extension provided in\n`mercurial/cinnabarclone.py`, and point to a git repository or bundle\ncontaining pre-generated git-cinnabar metadata. See details in the\nextension file.\n\nUsers cloning the repository would automatically get the metadata from\nthe git repository or bundle, and then pull the missing changesets from\nthe Mercurial repository.\n\nLimitations:\n------------\n\nAt the moment, push is limited to non-merge commits.\n\nThere is no support for the following mercurial features:\n- obsolescence markers\n- phases\n- namespaces\n\nChecking corruptions:\n---------------------\n\nGit-cinnabar is still in early infancy, and its metadata might get corrupted\nfor some reason.\n\nThe following command allows to detect various types of metadata corruption:\n\n`git cinnabar fsck`\n\nThis command will fix the corruptions it can, as well as adjust some of the\nmetadata that contains items that became unnecessary in newer versions.\n\nThe `--full` option may be added for a more thorough validation of the metadata\ncontents. Using this option adds a significant amount of work, and the command\ncan take more than half an hour on repositories the size of mozilla-central.\n\n`hg://` urls:\n-----------\n\nThe msys shell (not msys2) doesn't keep hg::url intact when crossing the\nmsys/native boundary, so when running cinnabar in a msys shell with a native\ngit, the url is munged as `hg;;proto;\\host\\path\\`, which git doesn't understand\nand doesn't even start redirecting to git-remote-hg.\n\nTo allow such setups to still work, `hg://` urls are supported. But since\nmercurial can be either on many different protocols, we abuse the port in the\ngiven url to pass the protocol.\n\nA `hg://` url thus looks like:\n\n`hg://\u003chost\u003e[:[\u003cport\u003e.]\u003cprotocol\u003e]/\u003cpath\u003e`\n\nThe default protocol is https, and the port can be omitted.\n\n- `hg::https://hg.mozilla.org/mozilla-central` becomes\n  `hg://hg.mozilla.org/mozilla-central`\n\n- `hg::http://hg.mozilla.org/mozilla-central` becomes\n  `hg://hg.mozilla.org:http/mozilla-central`\n\n- `hg::ssh://hg.mozilla.org/mozilla-central` becomes\n  `hg://hg.mozilla.org:ssh/mozilla-central`\n\n- `hg::file:///some/path` becomes (awkward) `hg://:file/some/path`\n\n- `hg::http://localhost:8080/foo` becomes `hg://localhost:8080.http/foo`\n\n- `hg::tags:` becomes `hg://:tags`\n\nCompatibility:\n--------------\n\nAs of version 0.7, some corner cases in Mercurial repositories will generate\ndifferent git commits than with prior versions of git-cinnabar. This means\na fresh clone might have different git SHA-1s than existing clones, but this\ndoesn't impact the use of existing clones with newer versions of git-cinnabar.\n\nMost repositories should remain non-affected by the change.\n\nYou can set the `cinnabar.compat` git configuration to `0.6` to keep the\nprevious behavior.\n\n\nExperimental features:\n----------------------\n\nGit-cinnabar has a set of experimental features that can be enabled\nindependently. You can set the `cinnabar.experiments` git configuration to a\ncomma-separated list of those features to enable the selected ones.\n\nThe available features are:\n\n- **merge**\n\n  Git-cinnabar currently doesn’t allow to push merge commits. The main\n  reason for this is that generating the correct mercurial data for those\n  merges is tricky, and needs to be gotten right.\n\n  The main caveat with this experimental support for pushing merges is that it\n  currently doesn’t handle the case where a file was moved on one of the\n  branches the same way mercurial would (i.e. the information would be lost to\n  mercurial users).\n\n- **similarity**\n\n  Git doesn't track file copies or renames. It however has flags to try to\n  detect them after the fact. On the other hand, Mercurial does track copies\n  and renames, if they're recorded manually in the first place. Git-cinnabar\n  does exact-copy/rename detection when pushing new commits to a Mercurial\n  repository.\n\n  The similarity feature allows to configure how (dis)similar files can be\n  to be detected as a rename or copy. `similarity=100` is the default, which\n  means only 100% identical files are considered. `similarity=90` means 90%\n  identical files, and so on.\n\n  This is equivalent to `git diff -C -C${similarity}%`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglandium%2Fgit-cinnabar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglandium%2Fgit-cinnabar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglandium%2Fgit-cinnabar/lists"}