summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRocco Rutte <pdmef@gmx.net>2009-01-27 15:34:46 +0100
committerRocco Rutte <pdmef@gmx.net>2009-01-27 15:34:46 +0100
commit688623f17e60e713ad687fee62cdbe3cecace3cd (patch)
tree8e62dc28a96cd7c8e65712e404902147ba4e3a58
parentd6cd058bb300e77eb8dc43357ed65bf5e2e648d0 (diff)
downloadhg-fast-export-688623f17e60e713ad687fee62cdbe3cecace3cd.tar.gz
hg-fast-export: Support branches without parents
Previously we fed the full revision only for the first one and deltas for all following including branches being forked off. This doesn't work with branches that are forked from revision 0. In case such a branch is found, we now also feed the full revision. Signed-off-by: Rocco Rutte <pdmef@gmx.net>
-rwxr-xr-xhg-fast-export.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/hg-fast-export.py b/hg-fast-export.py
index 2b61a0f..6de1e0a 100755
--- a/hg-fast-export.py
+++ b/hg-fast-export.py
@@ -183,6 +183,9 @@ def export_commit(ui,repo,revision,marks,mapping,heads,last,max,count,authors,so
if parents[0] < parents[1]:
pidx1, pidx2 = 1, 0
+ full_rev=False
+ if revision==0: full_rev=True
+
src=heads.get(branch,'')
link=''
if src!='':
@@ -194,12 +197,16 @@ def export_commit(ui,repo,revision,marks,mapping,heads,last,max,count,authors,so
(branch,src))
link=src # avoid making a merge commit for incremental import
elif link=='' and not heads.has_key(branch) and revision>0:
- # newly created branch and not the first one: connect to parent
- tmp=get_parent_mark(parents[0],marks)
- wr('from %s' % tmp)
- sys.stderr.write('%s: Link new branch to parent [%s]\n' %
- (branch,tmp))
- link=tmp # avoid making a merge commit for branch fork
+ if parents[0]>=0:
+ # newly created branch with parent: connect to parent
+ tmp=get_parent_mark(parents[0],marks)
+ wr('from %s' % tmp)
+ sys.stderr.write('%s: Link new branch to parent [%s]\n' %
+ (branch,tmp))
+ link=tmp # avoid making a merge commit for branch fork
+ else:
+ # newly created branch without parent: feed full revision
+ full_rev=True
elif last.get(branch,revision) != parents[pidx1] and parents[pidx1] > 0 and revision > 0:
pm=get_parent_mark(parents[pidx1],marks)
sys.stderr.write('%s: Placing commit [r%d] in branch [%s] on top of [r%d]\n' %
@@ -221,7 +228,7 @@ def export_commit(ui,repo,revision,marks,mapping,heads,last,max,count,authors,so
man=ctx.manifest()
added,changed,removed,type=[],[],[],''
- if revision==0:
+ if full_rev:
# first revision: feed in full manifest
added=man.keys()
added.sort()