How to fix code that uses Merger.check_basis

Francis Devereux francis at devrx.org
Fri May 4 12:44:10 UTC 2012


Hi,

I use the bzr-transplant plugin, and it stopped working when I upgraded to bzr 2.5 because it uses Merger.has_changes().

I've done a fix that seems to work, but I'd appreciate a quick review from someone who understands what has_changes does before I submit a merge proposal.

Here's the change I made (http://bazaar.launchpad.net/~frankoid/bzr-transplant/bzr25-fix/revision/19):

=== modified file '__init__.py'
--- __init__.py	2011-01-20 17:04:16 +0000
+++ __init__.py	2012-05-04 12:39:14 +0000
@@ -76,8 +76,9 @@
     if len(source_revision.parent_ids) > 1:
         raise errors.BzrCommandError("Don't know how to transplant merges.")
     base_revid = source_revision.parent_ids[0]
+    if target_wt.has_changes():
+        raise errors.UncommittedChanges(target_wt)
     m = merge.Merger.from_revision_ids(None, target_wt, source_revid, other_branch=source_branch, base=base_revid)
-    m.check_basis(True)
     m.merge_type = merge_type
     m.do_merge()
     try:

Thanks,

Francis




More information about the bazaar mailing list