Merge lp:~therp-nl/lp-community-utils/target_copy_from_shared_repository into lp:lp-community-utils

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 29
Proposed branch: lp:~therp-nl/lp-community-utils/target_copy_from_shared_repository
Merge into: lp:lp-community-utils
Diff against target: 24 lines (+14/-0)
1 file modified
clone_mp_to_community.py (+14/-0)
To merge this branch: bzr merge lp:~therp-nl/lp-community-utils/target_copy_from_shared_repository
Reviewer Review Type Date Requested Status
Ronald Portier (Therp) (community) test Abstain
Stefan Rijnhart (Opener) code review, test Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Review via email: mp+201446@code.launchpad.net

Description of the change

The clone_mp_to_community script chokes if you pass a branch that uses a shared repository via target-copy. This MP fixes that.

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

LGTM, thanks !

review: Approve (code review, no tests)
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :
Download full text (3.4 KiB)

Maybe not related, but not working for me:

openeyedev@laptop01:~/var/oe_repo/checkouts/lp-community-utils/target_copy_from_shared_repository$ ./clone_mp_to_community.py --mp-url https://code.launchpad.net/~therp-nl/openobject-addons/7.0_lp1266480_delivery_with_realtime-stock/+merge/200579 --target-copy /home/openeyedev/var/oe_repo/branches/openobject-addons-7.0/openobject-addons-7.0
No handlers could be found for logger "bzr"
INFO: Searching for missing revisions between file:///tmp/user/1001/tmpI5LbEd/tmpwTnjF3/ and http://bazaar.launchpad.net/~therp-nl/openobject-addons/7.0_lp1266480_delivery_with_realtime-stock/
INFO: done
INFO: Searching for missing revisions between file:///tmp/user/1001/tmpI5LbEd/tmpwTnjF3/ and http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/
INFO: done
INFO: 2 revisions not in the local tree
INFO: Replaying revision 9734 of http://bazaar.launchpad.net/~therp-nl/openobject-addons/7.0_lp1266480_delivery_with_realtime-stock/ (<email address hidden>)
INFO: http://bazaar.launchpad.net/~therp-nl/openobject-addons/7.0_lp1266480_delivery_with_realtime-stock is permanently redirected to http://bazaar.launchpad.net/~therp-nl/openobject-addons/7.0_lp1266480_delivery_with_realtime-stock/changes
INFO: M stock/stock.py
INFO: All changes applied successfully.
Traceback (most recent call last):
  File "./clone_mp_to_community.py", line 301, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./clone_mp_to_community.py", line 291, in main
    target_copy=arguments.target_copy)
  File "./clone_mp_to_community.py", line 184, in clone_merge_proposals
    replay_missing.main(replay_args)
  File "/home/openeyedev/var/oe_repo/checkouts/lp-community-utils/target_copy_from_shared_repository/replay_missing.py", line 195, in main
    do_nothing=arguments.do_nothing)
  File "/home/openeyedev/var/oe_repo/checkouts/lp-community-utils/target_copy_from_shared_repository/replay_missing.py", line 145, in replay_missing
    commit_missing(wt, oldrev, revid)
  File "/home/openeyedev/var/oe_repo/checkouts/lp-community-utils/target_copy_from_shared_repository/replay_missing.py", line 86, in commit_missing
    committer=committer, authors=authors)
  File "<string>", line 4, in commit_write_locked
  File "/usr/lib/python2.7/dist-packages/bzrlib/workingtree_4.py", line 218, in commit
    result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
  File "<string>", line 4, in commit_write_locked
  File "/usr/lib/python2.7/dist-packages/bzrlib/mutabletree.py", line 211, in commit
    *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commit.py", line 290, in commit
    lossy=lossy)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 132, in run
    self.cleanups, self.func, self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commit.py", line 367, in _commit
    old_revno, old_revid, new_revno = self._check_out_of_date_tree()
  File "/usr/lib/python2.7/dist-packages/bzrlib/commit.py", line 590, in _check_out_of_date_tree
    ...

Read more...

review: Needs Fixing (test)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

could you run this in debug mode and check the tree in your temp directory?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Works like a charm, thanks!

review: Approve (code review, test)
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

After the changes in the code, I would have to test again.

review: Abstain (test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clone_mp_to_community.py'
2--- clone_mp_to_community.py 2013-09-22 14:36:16 +0000
3+++ clone_mp_to_community.py 2014-01-13 16:03:38 +0000
4@@ -149,6 +149,20 @@
5 if target_copy:
6 logging.debug('Using %s as a local copy of %s',
7 target_copy, target_branch_address)
8+ branch_to_copy = Branch.open(target_copy)
9+ if branch_to_copy.repository.is_shared():
10+ if not isinstance(
11+ branch_to_copy.repository.user_transport,
12+ bzrlib.transport.local.LocalTransport):
13+ logging.error(
14+ '%s uses a nonlocal shared directory, I '
15+ 'can\'t work with that')
16+ return 1
17+ os.symlink(
18+ branch_to_copy.repository.user_transport\
19+ .local_abspath('.bzr'),
20+ os.path.join(target_branch_dir, '.bzr'))
21+ target_branch_dir = tempfile.mkdtemp(dir=target_branch_dir)
22 shutil.rmtree(target_branch_dir)
23 shutil.copytree(target_copy, target_branch_dir)
24 copied_branch = Branch.open(target_branch_dir)

Subscribers

People subscribed via source and target branches