Rev 3388: (abentley) correct _PreviewTree testing merge in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Apr 28 21:53:39 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3388
revision-id:pqm at pqm.ubuntu.com-20080428205328-bvr1g467xfx7rz9w
parent: pqm at pqm.ubuntu.com-20080428184356-qic5mhqzrgxlwwhs
parent: aaron at aaronbentley.com-20080428185055-642va5h5n13j8mxw
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-04-28 21:53:28 +0100
message:
  (abentley) correct _PreviewTree testing merge
modified:
  bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3363.1.1.1.9.1.5
    revision-id:aaron at aaronbentley.com-20080428185055-642va5h5n13j8mxw
    parent: aaron at aaronbentley.com-20080428163729-vj9c0vf7rqkliani
    parent: aaron at aaronbentley.com-20080428030701-5axl03chky7p1qg9
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: preview-tree
    timestamp: Mon 2008-04-28 14:50:55 -0400
    message:
      Revert changes in preview-tree-changes
    ------------------------------------------------------------
    revno: 3363.1.1.1.9.1.4
    revision-id:aaron at aaronbentley.com-20080428163729-vj9c0vf7rqkliani
    parent: aaron at aaronbentley.com-20080428162835-vvhly03zcvfyo6gd
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: preview-tree
    timestamp: Mon 2008-04-28 12:37:29 -0400
    message:
      Add get_file_size to Tree interface
    modified:
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3363.1.1.1.9.1.3
    revision-id:aaron at aaronbentley.com-20080428162835-vvhly03zcvfyo6gd
    parent: aaron at aaronbentley.com-20080428030347-j81zva7jb3tcg889
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: preview-tree
    timestamp: Mon 2008-04-28 12:28:35 -0400
    message:
      Updates from review
    modified:
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/revisiontree.py'
--- a/bzrlib/revisiontree.py	2008-04-09 00:34:54 +0000
+++ b/bzrlib/revisiontree.py	2008-04-28 16:37:29 +0000
@@ -96,6 +96,7 @@
         return w.annotate(self.inventory[file_id].revision)
 
     def get_file_size(self, file_id):
+        """See Tree.get_file_size"""
         return self._inventory[file_id].text_size
 
     def get_file_sha1(self, file_id, path=None, stat_value=None):

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2008-04-13 22:35:54 +0000
+++ b/bzrlib/transform.py	2008-04-28 18:50:55 +0000
@@ -1373,7 +1373,10 @@
                 return changes
 
     def _content_change(self, file_id):
+        """Return True if the content of this file changed"""
         changes = self._changes(file_id)
+        # changes[2] is true if the file content changed.  See
+        # InterTree.iter_changes.
         return (changes is not None and changes[2])
 
     def _get_file_revision(self, file_id, vf, tree_revision):
@@ -1446,8 +1449,11 @@
         return self._stat_limbo_file(file_id).st_mtime
 
     def get_file_size(self, file_id):
+        """See Tree.get_file_size"""
         if self.kind(file_id) == 'file':
             return self._transform._tree.get_file_size(file_id)
+        else:
+            return None
 
     def get_file_sha1(self, file_id, path=None, stat_value=None):
         return self._transform._tree.get_file_sha1(file_id)
@@ -1939,8 +1945,21 @@
     tt = TreeTransform(working_tree, pb)
     try:
         pp = ProgressPhase("Revert phase", 3, pb)
-        conflicts, merge_modified = _prepare_revert_transform(
-            working_tree, target_tree, tt, filenames, backups, pp)
+        pp.next_phase()
+        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+        try:
+            merge_modified = _alter_files(working_tree, target_tree, tt,
+                                          child_pb, filenames, backups)
+        finally:
+            child_pb.finished()
+        pp.next_phase()
+        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+        try:
+            raw_conflicts = resolve_conflicts(tt, child_pb,
+                lambda t, c: conflict_pass(t, c, target_tree))
+        finally:
+            child_pb.finished()
+        conflicts = cook_conflicts(raw_conflicts, tt)
         if change_reporter:
             change_reporter = delta._ChangeReporter(
                 unversioned_filter=working_tree.is_ignored)
@@ -1957,26 +1976,6 @@
     return conflicts
 
 
-def _prepare_revert_transform(working_tree, target_tree, tt, filenames,
-                              backups, pp):
-    pp.next_phase()
-    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
-    try:
-        merge_modified = _alter_files(working_tree, target_tree, tt,
-                                      child_pb, filenames, backups)
-    finally:
-        child_pb.finished()
-    pp.next_phase()
-    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
-    try:
-        raw_conflicts = resolve_conflicts(tt, child_pb,
-            lambda t, c: conflict_pass(t, c, target_tree))
-    finally:
-        child_pb.finished()
-    conflicts = cook_conflicts(raw_conflicts, tt)
-    return conflicts, merge_modified
-
-
 def _alter_files(working_tree, target_tree, tt, pb, specific_files,
                  backups):
     merge_modified = working_tree.merge_modified()

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2008-03-14 16:32:01 +0000
+++ b/bzrlib/tree.py	2008-04-28 16:37:29 +0000
@@ -254,6 +254,15 @@
         """
         raise NotImplementedError(self.get_file_mtime)
 
+    def get_file_size(self, file_id):
+        """Return the size of a file in bytes.
+
+        This applies only to regular files.  If invoked on directories or
+        symlinks, it will return None.
+        :param file_id: The file-id of the file
+        """
+        raise NotImplementedError(self.get_file_size)
+
     def get_file_by_path(self, path):
         return self.get_file(self._inventory.path2id(path), path)
 

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2008-04-12 19:43:13 +0000
+++ b/bzrlib/workingtree.py	2008-04-28 16:37:29 +0000
@@ -618,6 +618,7 @@
     __contains__ = has_id
 
     def get_file_size(self, file_id):
+        """See Tree.get_file_size"""
         try:
             return os.path.getsize(self.id2abspath(file_id))
         except OSError, e:

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2008-04-09 00:34:54 +0000
+++ b/bzrlib/workingtree_4.py	2008-04-28 16:37:29 +0000
@@ -1570,6 +1570,7 @@
         return self._get_weave(file_id).get_lines(entry[1][4])
 
     def get_file_size(self, file_id):
+        """See Tree.get_file_size"""
         return self.inventory[file_id].text_size
 
     def get_file_text(self, file_id):




More information about the bazaar-commits mailing list