Rev 5519: (mbp) status shows missing newly-added files (Rory Yorke) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 29 18:26:07 BST 2010


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

------------------------------------------------------------
revno: 5519 [merge]
revision-id: pqm at pqm.ubuntu.com-20101029172603-nzb390is9yby1mjb
parent: pqm at pqm.ubuntu.com-20101028000659-ctg5tomt4f7in3bp
parent: rory.yorke at gmail.com-20101020143853-9kfd2ldcjfroh8jw
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-10-29 18:26:03 +0100
message:
  (mbp) status shows missing newly-added files (Rory Yorke)
modified:
  bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
  bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
  bzrlib/tests/test_delta.py     test_delta.py-20070110134455-sqpd1y7mbjndelxf-1
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/delta.py'
--- a/bzrlib/delta.py	2010-04-30 11:35:43 +0000
+++ b/bzrlib/delta.py	2010-10-20 14:38:53 +0000
@@ -61,6 +61,7 @@
         self.modified = []
         self.unchanged = []
         self.unversioned = []
+        self.missing = []
 
     def __eq__(self, other):
         if not isinstance(other, TreeDelta):
@@ -137,7 +138,7 @@
             else:
                 delta.removed.append((path[0], file_id, kind[0]))
         elif fully_present[0] is False:
-            continue
+            delta.missing.append((path[1], file_id, kind[1]))
         elif name[0] != name[1] or parent_id[0] != parent_id[1]:
             # If the name changes, or the parent_id changes, we have a rename
             # (if we move a parent, that doesn't count as a rename for the
@@ -160,6 +161,7 @@
     delta.removed.sort()
     delta.added.sort()
     delta.renamed.sort()
+    delta.missing.sort()
     # TODO: jam 20060529 These lists shouldn't need to be sorted
     #       since we added them in alphabetical order.
     delta.modified.sort()
@@ -202,7 +204,9 @@
                              'unchanged': ' ',
                              'created': 'N',
                              'modified': 'M',
-                             'deleted': 'D'}
+                             'deleted': 'D',
+                             'missing': '!',
+                             }
         self.versioned_map = {'added': '+', # versioned target
                               'unchanged': ' ', # versioned in both
                               'removed': '-', # versioned in source
@@ -325,6 +329,8 @@
         else:
             if content_change:
                 modified = "modified"
+            elif kind[0] is None:
+                modified = "missing"
             else:
                 modified = "unchanged"
             if kind[1] == "file":
@@ -417,6 +423,7 @@
 
     show_list(delta.removed, 'removed', 'D')
     show_list(delta.added, 'added', 'A')
+    show_list(delta.missing, 'missing', '!')
     extra_modified = []
     # Reorder delta.renamed tuples so that all lists share the same
     # order for their 3 first fields and that they also begin like

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2010-10-18 21:34:05 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2010-10-29 17:26:03 +0000
@@ -211,12 +211,18 @@
         wt = self.make_branch_and_tree('.')
         b = wt.branch
 
-        self.build_tree(['directory/','directory/hello.c', 'bye.c','test.c','dir2/'])
+        self.build_tree(['directory/','directory/hello.c',
+                         'bye.c','test.c','dir2/',
+                         'missing.c'])
         wt.add('directory')
         wt.add('test.c')
         wt.commit('testing')
+        wt.add('missing.c')
+        unlink('missing.c')
 
         self.assertStatus([
+                'missing:\n',
+                '  missing.c\n',
                 'unknown:\n',
                 '  bye.c\n',
                 '  dir2/\n',
@@ -227,6 +233,7 @@
         self.assertStatus([
                 '?   bye.c\n',
                 '?   dir2/\n',
+                '+!  missing.c\n',
                 '?   directory/hello.c\n'
                 ],
                 wt, short=True)
@@ -269,6 +276,20 @@
         tof.seek(0)
         self.assertEquals(tof.readlines(), ['+N  test.c\n'])
 
+        tof = StringIO()
+        show_tree_status(wt, specific_files=['missing.c'], to_file=tof)
+        tof.seek(0)
+        self.assertEquals(tof.readlines(),
+                          ['missing:\n',
+                           '  missing.c\n'])
+
+        tof = StringIO()
+        show_tree_status(wt, specific_files=['missing.c'], to_file=tof,
+                         short=True)
+        tof.seek(0)
+        self.assertEquals(tof.readlines(),
+                          ['+!  missing.c\n'])
+
     def test_specific_files_conflicts(self):
         tree = self.make_branch_and_tree('.')
         self.build_tree(['dir2/'])

=== modified file 'bzrlib/tests/test_delta.py'
--- a/bzrlib/tests/test_delta.py	2010-10-08 05:36:17 +0000
+++ b/bzrlib/tests/test_delta.py	2010-10-20 14:38:53 +0000
@@ -122,6 +122,12 @@
             renamed=False, modified='created', exe_change=False,
             kind=(None, 'file'), unversioned_filter=lambda x:True)
 
+    def test_missing(self):
+        self.assertReport('+!  missing.c', file_id=None, path='missing.c',
+             old_path=None, versioned_change='added',
+             renamed=False, modified='missing', exe_change=False,
+             kind=(None, None))
+
     def test_view_filtering(self):
         # If a file in within the view, it should appear in the output
         expected_lines = [
@@ -279,24 +285,32 @@
                                   ('branch/f2', '2\n'),
                                   ('branch/f3', '3\n'),
                                   ('branch/f4', '4\n'),
+                                  ('branch/f5', '5\n'),
                                   ('branch/dir/',),
                                  ])
         wt.add(['f1', 'f2', 'f3', 'f4', 'dir'],
                ['f1-id', 'f2-id', 'f3-id', 'f4-id', 'dir-id'])
         wt.commit('commit one', rev_id='1')
 
+        # TODO add rename,removed,etc. here?
+        wt.add('f5')
+        os.unlink('branch/f5')
+
         long_status = """added:
   dir/
   f1
   f2
   f3
   f4
+missing:
+  f5
 """
         short_status = """A  dir/
 A  f1
 A  f2
 A  f3
 A  f4
+!  f5
 """
 
         repo = wt.branch.repository

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2010-10-26 13:53:31 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2010-10-29 17:26:03 +0000
@@ -61,6 +61,9 @@
 
 * Make ``bzr tag --quiet`` really quiet. (Neil Martinsen-Burrell, #239523)
 
+* Missing files (files bzr add'ed and then OS deleted) are now shown in ``bzr
+  status`` output. (Rory Yorke, #134168)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list