mirror of
				https://github.com/mnauw/git-remote-hg.git
				synced 2025-11-03 10:05:48 +01:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8a137f53f8 | ||
| 
						 | 
					c13e36f215 | ||
| 
						 | 
					fbeaffb15c | ||
| 
						 | 
					a96f368f2a | 
@@ -71,13 +71,25 @@ the same commits:
 | 
			
		||||
% git config --global remote-hg.hg-git-compat true
 | 
			
		||||
--------------------------------------
 | 
			
		||||
 | 
			
		||||
****
 | 
			
		||||
mnauw's note; The above is not quite the case, it only ever has been (somewhat) if
 | 
			
		||||
an undocumented debug mode was enabled in `hg-git` (`debugextrainmessage` setting),
 | 
			
		||||
and in recent versions the latter is no longer considered.  In fact, `hg-git` creates
 | 
			
		||||
git commits with additional hg metadata stored in so-called "extra commit headers".
 | 
			
		||||
The latter might be seen by `git log --format=raw` or `git cat-file -p <commitid>`,
 | 
			
		||||
but are otherwise mostly used internally by the git suite (for signatures).  However,
 | 
			
		||||
there is limited to no support for those in git "porcelain or plumbing" commands.
 | 
			
		||||
In particular, `git fast-export` and `git fast-import` do not consider these,
 | 
			
		||||
so a `gitremote-helpers` tool is then also out of luck.  Incidentally, it also
 | 
			
		||||
follows that a `git fast-export | git fast-import` "clone" approach would also
 | 
			
		||||
lose such extra metadata, and likewise so for e.g. `git filter-repo`.
 | 
			
		||||
****
 | 
			
		||||
 | 
			
		||||
== Notes ==
 | 
			
		||||
 | 
			
		||||
Remember to run `git gc --aggressive` after cloning a repository, especially if
 | 
			
		||||
it's a big one. Otherwise lots of space will be wasted.
 | 
			
		||||
 | 
			
		||||
The newest supported version of Mercurial is 6.2, the oldest one is 2.4.
 | 
			
		||||
 | 
			
		||||
=== Pushing branches ===
 | 
			
		||||
 | 
			
		||||
To push a branch, you need to use the 'branches/' prefix:
 | 
			
		||||
 
 | 
			
		||||
@@ -693,6 +693,7 @@ def export_ref(repo, name, kind, head):
 | 
			
		||||
                if rename:
 | 
			
		||||
                    renames.append((rename[0], f))
 | 
			
		||||
 | 
			
		||||
            # NOTE no longer used in hg-git, a HG:rename extra header is used
 | 
			
		||||
            for e in renames:
 | 
			
		||||
                extra_msg += b"rename : %s => %s\n" % e
 | 
			
		||||
 | 
			
		||||
@@ -1127,11 +1128,17 @@ def parse_commit(parser):
 | 
			
		||||
        # add some extra that hg-git adds (almost) unconditionally
 | 
			
		||||
        # see also https://foss.heptapod.net/mercurial/hg-git/-/merge_requests/211
 | 
			
		||||
        # NOTE it could be changed to another value below
 | 
			
		||||
        extra[b'hg-git-rename-source'] = b'git'
 | 
			
		||||
        # actually, it is *almost* unconditionally, and only done if the commit
 | 
			
		||||
        # is deduced to originate in git.  However, the latter is based on
 | 
			
		||||
        # presence/absence of HG markers in commit "extra headers".
 | 
			
		||||
        # The latter can not be handled here, and so this can not be correctly
 | 
			
		||||
        # reproduced.
 | 
			
		||||
        # extra[b'hg-git-rename-source'] = b'git'
 | 
			
		||||
        i = data.find(b'\n--HG--\n')
 | 
			
		||||
        if i >= 0:
 | 
			
		||||
            tmp = data[i + len(b'\n--HG--\n'):].strip()
 | 
			
		||||
            for k, v in [e.split(b' : ', 1) for e in tmp.split(b'\n')]:
 | 
			
		||||
                # NOTE no longer used in hg-git, a HG:rename extra header is used
 | 
			
		||||
                if k == b'rename':
 | 
			
		||||
                    old, new = v.split(b' => ', 1)
 | 
			
		||||
                    files[new]['rename'] = old
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,8 @@ setup () {
 | 
			
		||||
	[remote-hg]
 | 
			
		||||
		hg-git-compat = true
 | 
			
		||||
		track-branches = false
 | 
			
		||||
		# directly use local repo to avoid push (and hence phase issues)
 | 
			
		||||
		shared-marks = false
 | 
			
		||||
	EOF
 | 
			
		||||
 | 
			
		||||
	export HGEDITOR=true
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user