git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git/Mercurial interoperability (and what about bzr?)

From
Theodore Tso <tytso@mit.edu>
Date
Nov 1, 2008, 13:39 UTC
Message-ID
<20081101133931.GC8134@mit.edu>
In-Reply-To
<87abcjpvy2.fsf@mid.deneb.enyo.de>
On Sat, Nov 01, 2008 at 11:44:21AM +0100, Florian Weimer wrote:
Show 7 quoted lines
> > Now Mercurial has chosen to use in-tree '.hgtags' file to have global
> > tags transferable.  Never mind the fact that it had to treat this file
> > in special way to have it non-versioned
> 
> Oops, thought this file was versioned.  Things like
> 
>   <http://tycoon.hpl.hp.com/changeset/932:931d181e9f58/.hgtags>

.hgtags is stored as a versioned file in Mercurial. That's one of the problems, and it leads to no shortage of headaches.

Some of the problems are discussed here:
   http://www.selenic.com/mercurial/wiki/index.cgi/Tag
Specifically, to quote the Mercurial Wiki:
    The fact that tags identify changesets and are also parts of
    changesets has some potentially confusing implications:
    * The changeset that a tag refers to is always older than the
      changeset that commits the tag itself.
    * Updating a working dir to a particular tag will take that
      directory back to a point before the tag itself existed.
    * Cloning a repo to a particular tag will give you a new repo that
      does not have that tag.

In addition, Mercurial has to play interesting special case games in a repository which has multiple heads (in git terms, "branches"). When looking up a tag, it has to take the union of all of the .hgtags files at the tips of each of the branches. So if you have a large number of heads in your Mercurial repository, tags access doesn't scale well at all. Mercurial is very much optimized for having a single or at best a few heads/branches in a repository.

As I mentioned earlier this makes it much more difficult to do a bidrectional hg/git gateway, since the two DAG's are not toplogically equivalent, and in fact, *when* you add a tag to a particular commit/revision can make a distinct difference to the shape of the DAG. If you tag right after creating the revision in question, then there is a tag commit right after the revision. If you commit a few dozen changes into the repository, and *then* tag a point many commits earlier, then the tag commit will be tacked onto the head of whatever branch you happened to be on.

In fact, in the worst case, if you accidentally tag a revision on the "maint" branch while you happened to be on the "devel" branch, the tag for the commit in the "maint" branch will be attached to the "devel" branch, and while it will work just fine for *you*, someone who only fetches the "maint" branch might never see the tag that you placed on the maint branch --- unless they happen to also pull the devel branch.

What fun, eh?
					- Ted
Previous: Jakub NarebskiNext: Linus Torvalds
Message 44 of 65 in “[VOTE] git versus mercurial”
  1. waltOct 26, 2008
  2. Jakub NarebskiOct 26, 2008
  3. Maxim VuetsOct 26, 2008
  4. Leo RazoumovOct 26, 2008
  5. Jakub NarebskiOct 26, 2008
  6. Arne BabenhauserheideOct 27, 2008
  7. Leo RazoumovOct 27, 2008
  8. Arne BabenhauserheideOct 27, 2008
  9. dhruvaOct 27, 2008
  10. Arne BabenhauserheideOct 27, 2008
  11. Jakub NarebskiOct 27, 2008
  12. Arne BabenhauserheideOct 27, 2008
  13. Jakub NarebskiOct 27, 2008
  14. Leslie P. PolzerOct 27, 2008
  15. Arne BabenhauserheideOct 27, 2008
  16. Jakub NarebskiOct 27, 2008
  17. Benoit BoissinotOct 27, 2008
  18. Jakub NarebskiOct 27, 2008
  19. 0000 vkOct 27, 2008
  20. Jakub NarebskiOct 27, 2008
  21. Brandon CaseyOct 27, 2008
  22. Jakub NarebskiOct 27, 2008
  23. Nicolas PitreOct 28, 2008
  24. Felipe ContrerasOct 26, 2008
  25. Jakub NarebskiOct 26, 2008
  26. Felipe ContrerasOct 26, 2008
  27. waltOct 28, 2008
  28. Johannes SchindelinOct 28, 2008
  29. Git/Mercurial interoperability (and what about bzr?) (was: Re: [VOTE] git versus mercurial)Peter Krefting, Oct 28, 2008
  30. Johannes SchindelinOct 28, 2008
  31. Matthieu MoyOct 28, 2008
  32. Nicolas PitreOct 28, 2008
  33. Pieter de BieOct 28, 2008
  34. Miklos VajnaOct 28, 2008
  35. Miklos VajnaOct 28, 2008
  36. Theodore TsoOct 28, 2008
  37. Miklos VajnaOct 28, 2008
  38. Florian WeimerNov 1, 2008
  39. Santi BéjarNov 1, 2008
  40. Jakub NarebskiNov 1, 2008
  41. Florian WeimerNov 1, 2008
  42. Florian WeimerNov 1, 2008
  43. Jakub NarebskiNov 1, 2008
  44. Theodore TsoNov 1, 2008
  45. Linus TorvaldsNov 1, 2008
  46. Theodore TsoNov 2, 2008
  47. Peter KreftingNov 1, 2008
  48. Shawn O. PearceOct 29, 2008
  49. Boyd Lynn GerberOct 29, 2008
  50. Johannes SchindelinOct 29, 2008
  51. Boyd Lynn GerberOct 29, 2008
  52. Miles BaderOct 29, 2008
  53. David Soria ParraOct 27, 2008
  54. Jakub NarebskiOct 27, 2008
  55. Arne BabenhauserheideOct 27, 2008
  56. Miklos VajnaOct 27, 2008
  57. Arne BabenhauserheideOct 27, 2008
  58. Miklos VajnaOct 28, 2008
  59. Andreas EricssonOct 28, 2008
  60. Arne BabenhauserheideOct 28, 2008
  61. SZEDER GáborOct 28, 2008
  62. Marcin KasperskiNov 6, 2008
  63. Isaac JuradoNov 6, 2008
  64. Randal L. SchwartzOct 28, 2008
  65. Jakub NarebskiOct 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.