remote-hg: only update necessary revisions
We don't care about the rest, and in fact, we shouldn't try to push everything, as there might be garbage from previous failed pushes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
May 24, 2013 at 21:29 UTC
d226945471d6c2d5ec6b42bdac78a4e6518c1be9
1 file changed
+7
-2
contrib/remote-helpers/git-remote-hg
+7
-2
@@ -858,6 +858,7 @@ def do_export(parser):
858
global parsed_refs, bmarks, peer
859
860
p_bmarks = []
861
+ p_revs = set()
862
863
parser.next()
864
@@ -882,6 +883,7 @@ def do_export(parser):
883
if branch in branches and bnode in branches[branch]:
884
# up to date
885
continue
886
+ p_revs.add(bnode)
887
print "ok %s" % ref
888
elif ref.startswith('refs/heads/'):
889
bmark = ref[len('refs/heads/'):]
@@ -896,6 +898,7 @@ def do_export(parser):
898
not (bmark == 'master' and bmark not in parser.repo._bookmarks):
899
p_bmarks.append((ref, bmark, old, new))
900
901
+ p_revs.add(bnode)
902
elif ref.startswith('refs/tags/'):
903
tag = ref[len('refs/tags/'):]
904
tag = hgref(tag)
@@ -903,18 +906,20 @@ def do_export(parser):
906
if mode == 'git':
907
if not msg:
908
msg = 'Added tag %s for changeset %s' % (tag, node[:12]);
906
- write_tag(parser.repo, tag, node, msg, author)
909
+ tagnode = write_tag(parser.repo, tag, node, msg, author)
910
+ p_revs.add(tagnode)
911
else:
912
fp = parser.repo.opener('localtags', 'a')
913
fp.write('%s %s\n' % (node, tag))
914
fp.close()
915
+ p_revs.add(bnode)
916
print "ok %s" % ref
917
else:
918
# transport-helper/fast-export bugs
919
continue
920
921
if peer:
917
- parser.repo.push(peer, force=force_push, newbranch=True)
922
+ parser.repo.push(peer, force=force_push, newbranch=True, revs=list(p_revs))
923
924
# update remote bookmarks
925
remote_bmarks = peer.listkeys('bookmarks')