Rev 10: Use the more correct 'tree.revert' rather than merge.transform_tree, which didn't seem to actually do anything. in http://bzr.arbash-meinel.com/plugins/per_file_remerge

John Arbash Meinel john at arbash-meinel.com
Tue Jun 24 17:01:21 BST 2008


At http://bzr.arbash-meinel.com/plugins/per_file_remerge

------------------------------------------------------------
revno: 10
revision-id: john at arbash-meinel.com-20080624160116-9m4q7qsyt295jrry
parent: john at arbash-meinel.com-20080619193942-zxfxqkgdaizr24kq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: per_file_remerge
timestamp: Tue 2008-06-24 11:01:16 -0500
message:
  Use the more correct 'tree.revert' rather than merge.transform_tree, which didn't seem to actually do anything.
-------------- next part --------------
=== modified file 'per_file_remerge.py'
--- a/per_file_remerge.py	2008-06-19 19:39:42 +0000
+++ b/per_file_remerge.py	2008-06-24 16:01:16 +0000
@@ -71,7 +71,16 @@
     cur_conflicts = tree.conflicts()
     other_conflicts, matching_conflicts = cur_conflicts.select_conflicts(
         tree, [relpath])
-    merge.transform_tree(tree, tree.basis_tree(), [file_id])
+    # Make sure we update first
+    basis_tree = tree.basis_tree()
+    basis_tree.lock_read()
+    try:
+        # We don't really care if there are changes, but we need to make sure
+        # the following 'revert to basis' call actually does so
+        # Technically, we probably want backups=False
+        tree.revert([relpath], basis_tree, backups=True, report_changes=True)
+    finally:
+        basis_tree.unlock()
     tree.set_conflicts(conflicts.ConflictList(other_conflicts))
     try:
         conflicts.restore(tree.abspath(relpath))



More information about the bazaar-commits mailing list