remote-bzr: fixes for branch diverge
If the branches diverge we want to reset the pointer to where the remote actually is. Since we can access remote branches just as easily as local ones, let's do so. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Apr 30, 2013 at 20:09 UTC
38e7167e9bdc57262c7298912c4bf9df4d68f6fe
1 file changed
+7
-1
contrib/remote-helpers/git-remote-bzr
+7
-1
@@ -354,6 +354,7 @@ def do_import(parser):
354
if os.path.exists(path):
355
print "feature import-marks=%s" % path
356
print "feature export-marks=%s" % path
357
+ print "feature force"
358
sys.stdout.flush()
359
360
while parser.check('import'):
@@ -716,7 +717,12 @@ def get_repo(url, alias):
717
# pull
718
d = bzrlib.bzrdir.BzrDir.open(clone_path)
719
branch = d.open_branch()
719
- result = branch.pull(remote_branch, [], None, False)
720
+ try:
721
+ result = branch.pull(remote_branch, [], None, False)
722
+ except bzrlib.errors.DivergedBranches:
723
+ # use remote branch for now
724
+ peer = None
725
+ return remote_branch
726
else:
727
# clone
728
d = origin.sprout(clone_path, None,