Rev 399: When UnrelatedBranches is thrown force a parent that makes reasonable sense for import-dsc - UnrelatedBranches there just means a criss cross has occured. in http://people.canonical.com/~robertc/baz2.0/plugins/builddeb/trunk
Robert Collins
robertc at robertcollins.net
Mon Feb 1 06:43:23 GMT 2010
At http://people.canonical.com/~robertc/baz2.0/plugins/builddeb/trunk
------------------------------------------------------------
revno: 399
revision-id: robertc at robertcollins.net-20100201064322-ibllu0bsskckvlzu
parent: robertc at robertcollins.net-20100201060248-7c1aqtpcrnedu5ko
fixes bug(s): https://launchpad.net/bugs/515367
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Mon 2010-02-01 17:43:22 +1100
message:
When UnrelatedBranches is thrown force a parent that makes reasonable sense for import-dsc - UnrelatedBranches there just means a criss cross has occured.
=== modified file 'import_dsc.py'
--- a/import_dsc.py 2010-02-01 06:02:48 +0000
+++ b/import_dsc.py 2010-02-01 06:43:22 +0000
@@ -54,6 +54,7 @@
BzrCommandError,
NotBranchError,
NoWorkingTree,
+ UnrelatedBranches,
)
from bzrlib.export import export
from bzrlib.osutils import file_iterator, isdir, basename, splitpath
@@ -1680,8 +1681,20 @@
finally:
shutil.rmtree(tarball_dir)
if self.branch.last_revision() != NULL_REVISION:
- conflicts = self.tree.merge_from_branch(
- self.upstream_branch, merge_type=merge_type)
+ try:
+ conflicts = self.tree.merge_from_branch(
+ self.upstream_branch, merge_type=merge_type)
+ except UnrelatedBranches:
+ # Bug lp:515367 where the first upstream tarball is
+ # missing a proper history link and a criss-cross merge
+ # then recurses and finds no deeper ancestor.
+ if len(parents) != 2:
+ # Very first import... shouldn't be possible.
+ raise
+ # Use the previous upstream import as the from revision
+ conflicts = self.tree.merge_from_branch(
+ self.upstream_branch, merge_type=merge_type,
+ from_revision=parents[0])
else:
# Pull so that merge-upstream allows you to start a branch
# from upstream tarball.
More information about the bazaar-commits
mailing list