Rev 2500: Revert does not try to preserve file contents produced by revert in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jun 1 20:50:42 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2500
revision-id: pqm at pqm.ubuntu.com-20070601195039-ew4306n3v38agaoq
parent: pqm at pqm.ubuntu.com-20070531210833-8ptk86ocu822hjd5
parent: aaron.bentley at utoronto.ca-20070601054311-15wtrjil1onbuea3
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-06-01 20:50:39 +0100
message:
Revert does not try to preserve file contents produced by revert
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_revert.py test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 2499.1.1
merged: aaron.bentley at utoronto.ca-20070601054311-15wtrjil1onbuea3
parent: pqm at pqm.ubuntu.com-20070531210833-8ptk86ocu822hjd5
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: bzr.ab2
timestamp: Fri 2007-06-01 01:43:11 -0400
message:
Revert does not try to preserve file contents produced by revert
=== modified file 'NEWS'
--- a/NEWS 2007-05-31 21:08:33 +0000
+++ b/NEWS 2007-06-01 05:43:11 +0000
@@ -21,6 +21,9 @@
* Added ``bzr log --limit`` to report a limited number of revisions.
(Kent Gibson, #3659)
+ * Revert does not try to preserve file contents that were originally
+ produced by reverting to a historical revision. (Aaron Bentley)
+
BUGFIXES:
* ``bzr push`` should only connect to the remote location one time.
=== modified file 'bzrlib/tests/test_revert.py'
--- a/bzrlib/tests/test_revert.py 2007-03-01 01:02:30 +0000
+++ b/bzrlib/tests/test_revert.py 2007-06-01 05:43:11 +0000
@@ -14,6 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import os
from bzrlib import merge, tests, transform, workingtree
@@ -108,3 +109,17 @@
tt.apply()
transform.revert(tree, tree.basis_tree(), [])
self.assertTrue(tree.is_executable('newfile-id'))
+
+ def test_revert_deletes_files_from_revert(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['file'])
+ tree.add('file')
+ tree.commit('added file', rev_id='rev1')
+ os.unlink('file')
+ tree.commit('removed file')
+ self.failIfExists('file')
+ tree.revert([], old_tree=tree.branch.repository.revision_tree('rev1'))
+ self.failUnlessExists('file')
+ tree.revert([])
+ self.failIfExists('file')
+ self.assertEqual({}, tree.merge_modified())
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2007-03-26 19:39:14 +0000
+++ b/bzrlib/transform.py 2007-06-01 05:43:11 +0000
@@ -1420,8 +1420,8 @@
pp.next_phase()
child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
try:
- _alter_files(working_tree, target_tree, tt, child_pb,
- filenames, backups)
+ merge_modified = _alter_files(working_tree, target_tree, tt,
+ child_pb, filenames, backups)
finally:
child_pb.finished()
pp.next_phase()
@@ -1439,7 +1439,7 @@
warning(conflict)
pp.next_phase()
tt.apply()
- working_tree.set_merge_modified({})
+ working_tree.set_merge_modified(merge_modified)
finally:
target_tree.unlock()
tt.finalize()
@@ -1505,6 +1505,17 @@
elif kind[1] == 'file':
tt.create_file(target_tree.get_file_lines(file_id),
trans_id, mode_id)
+ if basis_tree is None:
+ basis_tree = working_tree.basis_tree()
+ basis_tree.lock_read()
+ new_sha1 = target_tree.get_file_sha1(file_id)
+ if (file_id in basis_tree and new_sha1 ==
+ basis_tree.get_file_sha1(file_id)):
+ if file_id in merge_modified:
+ del merge_modified[file_id]
+ else:
+ merge_modified[file_id] = new_sha1
+
# preserve the execute bit when backing up
if keep_content and executable[0] == executable[1]:
tt.set_executability(executable[1], trans_id)
@@ -1523,6 +1534,7 @@
finally:
if basis_tree is not None:
basis_tree.unlock()
+ return merge_modified
def resolve_conflicts(tt, pb=DummyProgress(), pass_func=None):
More information about the bazaar-commits
mailing list