[Pkg-bazaar-commits] ./bzr/unstable r437: - new command 'bzr modified' to exercise the statcache

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:19:46 UTC 2009


------------------------------------------------------------
revno: 437
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Tue 2005-05-10 16:48:34 +1000
message:
  - new command 'bzr modified' to exercise the statcache
modified:
  bzrlib/commands.py
  bzrlib/statcache.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-05-10 06:34:41 +0000
+++ b/bzrlib/commands.py	2005-05-10 06:48:34 +0000
@@ -453,6 +453,9 @@
         show_diff(Branch('.'), revision, file_list)
 
 
+        
+
+
 class cmd_deleted(Command):
     """List files deleted in the working tree.
 
@@ -475,6 +478,28 @@
                 else:
                     print path
 
+
+class cmd_modified(Command):
+    """List files modified in working tree."""
+    hidden = True
+    def run(self):
+        import statcache
+        b = Branch('.')
+        sc = statcache.update_cache(b)
+        basis = b.basis_tree()
+        basis_inv = basis.inventory
+        for path, ie in basis_inv.iter_entries():
+            if ie.kind != 'file':
+                continue
+            cacheentry = sc.get(ie.file_id)
+            if not cacheentry:
+                # deleted
+                continue
+            if cacheentry[statcache.SC_SHA1] != ie.text_sha1:
+                print path
+                
+        
+
 class cmd_root(Command):
     """Show the tree root directory.
 

=== modified file 'bzrlib/statcache.py'
--- a/bzrlib/statcache.py	2005-05-10 06:34:41 +0000
+++ b/bzrlib/statcache.py	2005-05-10 06:48:34 +0000
@@ -64,6 +64,10 @@
 FP_DEV   = 4
 
 
+SC_FILE_ID = 0
+SC_SHA1    = 1 
+
+
 def fingerprint(path, abspath):
     try:
         fs = os.lstat(abspath)



More information about the Pkg-bazaar-commits mailing list