Rev 2649: Test that default behavior is as before in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 23 16:55:14 BST 2007


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

------------------------------------------------------------
revno: 2649
revision-id: pqm at pqm.ubuntu.com-20070723155512-ckelzx8u6m5vxyja
parent: pqm at pqm.ubuntu.com-20070723053815-oihay9qovs508r3k
parent: abentley at panoramicfeedback.com-20070723145148-5e1357oxg0ndevw4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-07-23 16:55:12 +0100
message:
  Test that default behavior is as before
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
  bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
  bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.59
    merged: abentley at panoramicfeedback.com-20070723145148-5e1357oxg0ndevw4
    parent: abentley at panoramicfeedback.com-20070723142742-98ye8w4au9bjg5q0
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-07-23 10:51:48 -0400
    message:
      Test that default behavior is as before
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.58
    merged: abentley at panoramicfeedback.com-20070723142742-98ye8w4au9bjg5q0
    parent: abentley at panoramicfeedback.com-20070723132749-9iwoipn261gqjml5
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-07-23 10:27:42 -0400
    message:
      Status honours selected paths for conflicts (#127606)
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.57
    merged: abentley at panoramicfeedback.com-20070723132749-9iwoipn261gqjml5
    parent: abentley at panoramicfeedback.com-20070720202707-x6qb9p0ib510s5x7
    parent: pqm at pqm.ubuntu.com-20070723053815-oihay9qovs508r3k
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-07-23 09:27:49 -0400
    message:
      Merge bzr.dev
=== modified file 'NEWS'
--- a/NEWS	2007-07-23 04:01:30 +0000
+++ b/NEWS	2007-07-23 14:27:42 +0000
@@ -26,6 +26,9 @@
     * ``bzr selftest --bench`` no longer emits deprecation warnings
       (Lukáš Lalinský)
 
+    * ``bzr status`` now honours FILE parameters for conflict lists
+      (Aaron Bentley, #127606)
+
   IMPROVEMENTS:
 
     * Don't show "dots" progress indicators when run non-interactively, such

=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2007-07-10 10:33:45 +0000
+++ b/bzrlib/conflicts.py	2007-07-23 14:27:42 +0000
@@ -233,7 +233,8 @@
                     if e.errno != errno.ENOENT:
                         raise
 
-    def select_conflicts(self, tree, paths, ignore_misses=False):
+    def select_conflicts(self, tree, paths, ignore_misses=False,
+                         recurse=False):
         """Select the conflicts associated with paths in a tree.
         
         File-ids are also used for this.
@@ -258,6 +259,11 @@
                 if cpath in path_set:
                     selected = True
                     selected_paths.add(cpath)
+                if recurse:
+                    if osutils.is_inside_any(path_set, cpath):
+                        selected = True
+                        selected_paths.add(cpath)
+
             for key in ('file_id', 'conflict_file_id'):
                 cfile_id = getattr(conflict, key, None)
                 if cfile_id is None:

=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2007-06-21 03:29:39 +0000
+++ b/bzrlib/status.py	2007-07-23 14:27:42 +0000
@@ -163,12 +163,15 @@
                            show_ids=show_ids,
                            show_unchanged=show_unchanged,
                            short_status=False)
-            conflict_title = False
-            # show the new conflicts only for now. XXX: get them from the delta.
-            for conflict in new.conflicts():
-                if not short and conflict_title is False:
-                    print >> to_file, "conflicts:"
-                    conflict_title = True
+            # show the new conflicts only for now. XXX: get them from the
+            # delta.
+            conflicts = new.conflicts()
+            if specific_files is not None:
+                conflicts = conflicts.select_conflicts(new, specific_files,
+                    ignore_misses=True, recurse=True)[1]
+            if len(conflicts) > 0 and not short:
+                print >> to_file, "conflicts:"
+            for conflict in conflicts:
                 if short:
                     prefix = 'C  '
                 else:

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2007-06-26 20:32:49 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2007-07-23 14:27:42 +0000
@@ -28,7 +28,11 @@
 import sys
 from tempfile import TemporaryFile
 
-from bzrlib import bzrdir, errors
+from bzrlib import (
+    bzrdir,
+    conflicts,
+    errors,
+    )
 import bzrlib.branch
 from bzrlib.builtins import merge
 from bzrlib.osutils import pathjoin
@@ -227,6 +231,30 @@
         tof.seek(0)
         self.assertEquals(tof.readlines(), ['?   dir2/\n'])
 
+    def test_specific_files_conflicts(self):
+        tree = self.make_branch_and_tree('.')
+        self.build_tree(['dir2/'])
+        tree.add('dir2')
+        tree.commit('added dir2')
+        tree.set_conflicts(conflicts.ConflictList(
+            [conflicts.ContentsConflict('foo')]))
+        tof = StringIO()
+        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
+        self.assertEqualDiff('', tof.getvalue())
+        tree.set_conflicts(conflicts.ConflictList(
+            [conflicts.ContentsConflict('dir2')]))
+        tof = StringIO()
+        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
+        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2\n',
+                             tof.getvalue())
+
+        tree.set_conflicts(conflicts.ConflictList(
+            [conflicts.ContentsConflict('dir2/file1')]))
+        tof = StringIO()
+        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
+        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2/file1\n',
+                             tof.getvalue())
+
     def test_status_nonexistent_file(self):
         # files that don't exist in either the basis tree or working tree
         # should give an error

=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2007-03-07 01:14:11 +0000
+++ b/bzrlib/tests/test_conflicts.py	2007-07-23 14:51:48 +0000
@@ -89,6 +89,32 @@
         l = ConflictList([TextConflict('hello')])
         l.remove_files(tree)
 
+    def test_select_conflicts(self):
+        tree = self.make_branch_and_tree('.')
+        tree_conflicts = ConflictList([ContentsConflict('foo'),
+                                       ContentsConflict('bar')])
+        self.assertEqual((ConflictList([ContentsConflict('bar')]),
+                          ConflictList([ContentsConflict('foo')])),
+                         tree_conflicts.select_conflicts(tree, ['foo']))
+        self.assertEqual((ConflictList(), tree_conflicts),
+                         tree_conflicts.select_conflicts(tree, [''],
+                         ignore_misses=True, recurse=True))
+        tree_conflicts = ConflictList([ContentsConflict('foo/baz'),
+                                       ContentsConflict('bar')])
+        self.assertEqual((ConflictList([ContentsConflict('bar')]),
+                          ConflictList([ContentsConflict('foo/baz')])),
+                         tree_conflicts.select_conflicts(tree, ['foo'],
+                                                         recurse=True,
+                                                         ignore_misses=True))
+        tree_conflicts = ConflictList([PathConflict('qux', 'foo/baz')])
+        self.assertEqual((ConflictList(), tree_conflicts),
+                         tree_conflicts.select_conflicts(tree, ['foo'],
+                                                         recurse=True,
+                                                         ignore_misses=True))
+        self.assertEqual((tree_conflicts, ConflictList()),
+                         tree_conflicts.select_conflicts(tree, ['foo'],
+                                                         ignore_misses=True))
+
 
 class TestConflictStanzas(TestCase):
 




More information about the bazaar-commits mailing list