Merge lp:~jelmer/bzr-builddeb/import-upstream-revision into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 458
Proposed branch: lp:~jelmer/bzr-builddeb/import-upstream-revision
Merge into: lp:bzr-builddeb
Diff against target: 74 lines (+17/-6)
2 files modified
cmds.py (+13/-4)
import_dsc.py (+4/-2)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/import-upstream-revision
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+26260@code.launchpad.net

Description of the change

Add -r support to import-upstream.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmds.py'
2--- cmds.py 2010-05-06 14:30:28 +0000
3+++ cmds.py 2010-05-28 00:49:26 +0000
4@@ -779,10 +779,12 @@
5 import and the tip of the upstream branch if you supply one.
6 """
7
8+ takes_options = ['revision']
9+
10 takes_args = ['version', 'location', 'upstream_branch?']
11
12- def run(self, version, location, upstream_branch=None):
13- # TODO: support -r, search for similarity etc.
14+ def run(self, version, location, upstream_branch=None, revision=None):
15+ # TODO: search for similarity etc.
16 version = version.encode('utf8')
17 branch, _ = Branch.open_containing('.')
18 if upstream_branch is None:
19@@ -810,7 +812,7 @@
20 parents = []
21 if parents:
22 # See bug lp:309682
23- db.upstream_branch.repository.fetch(branch.repository, parents[0])
24+ upstream.repository.fetch(branch.repository, parents[0])
25 db.extract_upstream_tree(parents[0], tempdir)
26 else:
27 db._create_empty_upstream_tree(tempdir)
28@@ -818,8 +820,15 @@
29 tree.lock_read()
30 dbs = DistributionBranchSet()
31 dbs.add_branch(db)
32+ if revision is None:
33+ upstream_revid = None
34+ elif len(revision) == 1:
35+ upstream_revid = revision[0].in_history(upstream).rev_id
36+ else:
37+ raise BzrCommandError('bzr import-upstream --revision takes exactly'
38+ ' one revision specifier.')
39 tag_name, _ = db.import_upstream_tarball(location, version, parents,
40- upstream_branch=upstream)
41+ upstream_branch=upstream, upstream_revision=upstream_revid)
42 self.outf.write('Imported %s as tag:%s.\n' % (location, tag_name))
43
44
45
46=== modified file 'import_dsc.py'
47--- import_dsc.py 2010-05-05 07:20:17 +0000
48+++ import_dsc.py 2010-05-28 00:49:26 +0000
49@@ -993,7 +993,7 @@
50 return tag_name, revid
51
52 def import_upstream_tarball(self, tarball_filename, version, parents,
53- md5sum=None, upstream_branch=None):
54+ md5sum=None, upstream_branch=None, upstream_revision=None):
55 """Import an upstream part to the upstream branch.
56
57 :param tarball_filename: The tarball to import.
58@@ -1003,6 +1003,7 @@
59 parents.
60 :param upstream_branch: An upstream branch to associate with the
61 tarball.
62+ :param upstream_revision: Upstream revision id
63 :param md5sum: hex digest of the md5sum of the tarball, if known.
64 :return: (tag_name, revision_id) of the imported tarball.
65 """
66@@ -1012,7 +1013,8 @@
67 try:
68 return self.import_upstream(tarball_dir, version, md5sum, parents,
69 upstream_tarball=tarball_filename,
70- upstream_branch=upstream_branch)
71+ upstream_branch=upstream_branch,
72+ upstream_revision=upstream_revision)
73 finally:
74 shutil.rmtree(tarball_dir)
75

Subscribers

People subscribed via source and target branches