Merge lp:~lifeless/bzr-builddeb/bug-515367 into lp:bzr-builddeb

Proposed by Robert Collins
Status: Merged
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr-builddeb/bug-515367
Merge into: lp:bzr-builddeb
Prerequisite: lp:~lifeless/bzr-builddeb/trunk
Diff against target: 34 lines (+15/-2)
1 file modified
import_dsc.py (+15/-2)
To merge this branch: bzr merge lp:~lifeless/bzr-builddeb/bug-515367
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+18368@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Work around slightly wrongly created initial upstream imports by setting a parent we know to be good during import-dsc.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'import_dsc.py'
2--- import_dsc.py 2010-02-01 06:57:11 +0000
3+++ import_dsc.py 2010-02-01 06:57:11 +0000
4@@ -54,6 +54,7 @@
5 BzrCommandError,
6 NotBranchError,
7 NoWorkingTree,
8+ UnrelatedBranches,
9 )
10 from bzrlib.export import export
11 from bzrlib.osutils import file_iterator, isdir, basename, splitpath
12@@ -1680,8 +1681,20 @@
13 finally:
14 shutil.rmtree(tarball_dir)
15 if self.branch.last_revision() != NULL_REVISION:
16- conflicts = self.tree.merge_from_branch(
17- self.upstream_branch, merge_type=merge_type)
18+ try:
19+ conflicts = self.tree.merge_from_branch(
20+ self.upstream_branch, merge_type=merge_type)
21+ except UnrelatedBranches:
22+ # Bug lp:515367 where the first upstream tarball is
23+ # missing a proper history link and a criss-cross merge
24+ # then recurses and finds no deeper ancestor.
25+ if len(parents) != 2:
26+ # Very first import... shouldn't be possible.
27+ raise
28+ # Use the previous upstream import as the from revision
29+ conflicts = self.tree.merge_from_branch(
30+ self.upstream_branch, merge_type=merge_type,
31+ from_revision=parents[0])
32 else:
33 # Pull so that merge-upstream allows you to start a branch
34 # from upstream tarball.

Subscribers

People subscribed via source and target branches