Merge lp:~andrewsomething/bzr-builddeb/bzr-grab-merge into lp:bzr-builddeb

Proposed by James Westby
Status: Work in progress
Proposed branch: lp:~andrewsomething/bzr-builddeb/bzr-grab-merge
Merge into: lp:bzr-builddeb
Diff against target: 93 lines (+75/-0)
2 files modified
__init__.py (+1/-0)
cmds.py (+74/-0)
To merge this branch: bzr merge lp:~andrewsomething/bzr-builddeb/bzr-grab-merge
Reviewer Review Type Date Requested Status
Jelmer Vernooij code Needs Information
Review via email: mp+37318@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Is this intended for merging? It contains a few commented out lines of code, and it doesn't have any tests.

review: Needs Information (code)
Revision history for this message
James Westby (james-w) wrote :

On Wed, 12 Jan 2011 22:01:49 -0000, Jelmer Vernooij <email address hidden> wrote:
> Review: Needs Information code
> Is this intended for merging? It contains a few commented out lines of code, and it doesn't have any tests.

Andrew said that it wasn't complete, but I wanted to review it, and was
willing to do some work to get it in a state to merge. Unfortunately I
haven't had the time to do so.

Thanks,

James

408. By Andrew Starr-Bochicchio

Re-merge on trunk.

409. By Andrew Starr-Bochicchio

Re-merge on trunk.

410. By Andrew Starr-Bochicchio

Remerge on trunk

411. By Andrew Starr-Bochicchio

Remerge on trunk

412. By Andrew Starr-Bochicchio

Re-merge on trunk.

413. By Andrew Starr-Bochicchio

Remerge on trunk

414. By Andrew Starr-Bochicchio

Remerge on trunk.

415. By Andrew Starr-Bochicchio

Remerge on trunk.

416. By Andrew Starr-Bochicchio

Re-merge on trunk.

417. By Andrew Starr-Bochicchio

A number of fixes for things moving around in bzrlib.

Unmerged revisions

417. By Andrew Starr-Bochicchio

A number of fixes for things moving around in bzrlib.

416. By Andrew Starr-Bochicchio

Re-merge on trunk.

415. By Andrew Starr-Bochicchio

Remerge on trunk.

414. By Andrew Starr-Bochicchio

Remerge on trunk.

413. By Andrew Starr-Bochicchio

Remerge on trunk

412. By Andrew Starr-Bochicchio

Re-merge on trunk.

411. By Andrew Starr-Bochicchio

Remerge on trunk

410. By Andrew Starr-Bochicchio

Remerge on trunk

409. By Andrew Starr-Bochicchio

Re-merge on trunk.

408. By Andrew Starr-Bochicchio

Re-merge on trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2012-01-06 17:55:50 +0000
3+++ __init__.py 2012-01-07 00:39:25 +0000
4@@ -58,6 +58,7 @@
5 "mark_uploaded": [],
6 "merge_package": [],
7 "merge_upstream": ["mu"],
8+ "grab_merge": ["gm"],
9 }
10
11 for command, aliases in commands.iteritems():
12
13=== modified file 'cmds.py'
14--- cmds.py 2012-01-05 00:43:11 +0000
15+++ cmds.py 2012-01-07 00:39:25 +0000
16@@ -1493,3 +1493,77 @@
17 revision_id, bugs=bugs, authors=authors, origin=origin,
18 forwarded=forwarded, applied_upstream=applied_upstream,
19 description=description, last_update=last_update)
20+
21+class cmd_grab_merge(Command):
22+ """Grab packaging branches for merging.
23+ This initiates a shared repository and then grabs both
24+ lp:ubuntu/<package> and lp:debian/<package>. Next, these
25+ branches are merged in "./<package>/merge_dir."
26+ """
27+
28+ takes_args = ['package']
29+
30+ def run(self, package):
31+ from bzrlib import transport
32+ from bzrlib import bzrdir
33+ from bzrlib.tag import _merge_tags_if_possible
34+ from bzrlib.plugins.builddeb.merge_package import fix_ancestry_as_needed
35+ if package is None:
36+ package = osutils.getcwd()
37+
38+ shared_repo = os.getcwd() + '/%s' % package
39+ debian_path = shared_repo + '/debian_branch'
40+ ubuntu_path = shared_repo + '/ubuntu_branch'
41+
42+ if os.access(shared_repo, os.F_OK) is True:
43+ note('Please move or remove the existing %s directory.' % package)
44+ return
45+ else:
46+ note('Initializing share repository...')
47+ to_transport = transport.get_transport(shared_repo)
48+ to_transport.ensure_base()
49+ repo_format = bzrdir.format_registry.make_bzrdir('default')
50+ newdir = repo_format.initialize_on_transport(to_transport)
51+ repo = newdir.create_repository(shared=True)
52+ repo.set_make_working_trees(True)
53+
54+ note('Pulling Ubuntu branch...')
55+ ubuntu_branch_lp = Branch.open('lp:ubuntu/{0}' .format(package))
56+ ubuntu_branch = ubuntu_branch_lp.bzrdir.sprout(ubuntu_path).open_branch()
57+ note('Pulling Debian branch...')
58+ # TODO: Make merging from sid or testing configurable.
59+ debian_branch_lp = Branch.open('lp:debian/sid/{0}' .format(package))
60+ debian_branch = debian_branch_lp.bzrdir.sprout(debian_path).open_branch()
61+
62+ note('Merging...')
63+ merge_dir = ubuntu_branch.bzrdir.sprout(shared_repo + '/merge_dir').open_branch()
64+ wt = WorkingTree.open(shared_repo + '/merge_dir')
65+ # TODO: Call merge-package directly instead of doing this...
66+ wt.lock_write()
67+ self.add_cleanup(wt.unlock)
68+ debian_branch.lock_read()
69+ self.add_cleanup(debian_branch.unlock)
70+ this_config = debuild_config(wt, wt)
71+ that_config = debuild_config(debian_branch.basis_tree(),
72+ debian_branch.basis_tree())
73+ if not (this_config.build_type == BUILD_TYPE_NATIVE or
74+ that_config.build_type == BUILD_TYPE_NATIVE):
75+ fix_ancestry_as_needed(wt, debian_branch)
76+
77+ # Merge source packaging branch in to the target packaging branch.
78+ _merge_tags_if_possible(debian_branch, wt.branch)
79+ conflicts = wt.merge_from_branch(debian_branch)
80+ if conflicts > 0:
81+ note('The merge resulted in %s conflicts. Please resolve these '
82+ 'and commit the changes with "bzr commit".' % conflicts)
83+ else:
84+ note('The merge resulted in no conflicts. You may commit the '
85+ 'changes by running "bzr commit".')
86+
87+# # TODO: Are there other things that we could write out that might be useful?
88+# dt = WorkingTree.open(debian_path)
89+# ut = WorkingTree.open(ubuntu_path)
90+# ubuntu_patch = open(shared_repo + '/ubuntu_patch', 'w')
91+# show_diff_trees(dt, ut, ubuntu_patch, specific_files=None,
92+# external_diff_options='-Nru')
93+# ubuntu_patch.close()

Subscribers

People subscribed via source and target branches