/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to patches/find-touching-from-seq.diff

  • Committer: Martin Pool
  • Date: 2005-06-28 03:02:31 UTC
  • Revision ID: mbp@sourcefrog.net-20050628030231-d311e4ebcd467ef4
Merge John's import-speedup branch:

                                                                                         
  777 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:32 -0500
      revision-id: john@arbash-meinel.com-20050627032031-e82a50db3863b18e
      bzr selftest was not using the correct bzr

  776 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:22 -0500
      revision-id: john@arbash-meinel.com-20050627032021-c9f21fde989ddaee
      Add was using an old mutter

  775 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:02:33 -0500
      revision-id: john@arbash-meinel.com-20050627030233-9165cfe98fc63298
      Cleaned up to be less different

  774 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:54:53 -0500
      revision-id: john@arbash-meinel.com-20050627025452-4260d0e744edef43
      Allow BZR_PLUGIN_PATH='' to negate plugin loading.

  773 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:49:34 -0500
      revision-id: john@arbash-meinel.com-20050627024933-b7158f67b7b9eae5
      Finished the previous cleanup (allowing load_plugins to be called twice)

  772 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:45:08 -0500
      revision-id: john@arbash-meinel.com-20050627024508-723b1df510d196fc
      Work on making the tests pass. versioning.py is calling run_cmd directly, but plugins have been loaded.

  771 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:32:29 -0500
      revision-id: john@arbash-meinel.com-20050627023228-79972744d7c53e15
      Got it down a little bit more by removing import of tree and inventory.

  770 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:26:05 -0500
      revision-id: john@arbash-meinel.com-20050627022604-350b9773ef622f95
      Reducing the number of import from bzrlib/__init__.py and bzrlib/branch.py

  769 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:32:25 -0500
      revision-id: john@arbash-meinel.com-20050627013225-32dd044f10d23948
      Updated revision.py and xml.py to include SubElement.

  768 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:56 -0500
      revision-id: john@arbash-meinel.com-20050627010356-ee66919e1c377faf
      Minor typo

  767 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:13 -0500
      revision-id: john@arbash-meinel.com-20050627010312-40d024007eb85051
      Caching the import

  766 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:51:47 -0500
      revision-id: john@arbash-meinel.com-20050627005147-5281c99e48ed1834
      Created wrapper functions for lazy import of ElementTree

  765 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:46:37 -0500
      revision-id: john@arbash-meinel.com-20050627004636-bf432902004a94c5
      Removed all of the test imports of cElementTree

  764 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:43:59 -0500
      revision-id: john@arbash-meinel.com-20050627004358-d137fbe9570dd71b
      Trying to make bzr startup faster.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
*** modified file 'bzrlib/commands.py'
 
2
--- bzrlib/commands.py 
 
3
+++ bzrlib/commands.py 
 
4
@@ -610,11 +610,13 @@
 
5
     hidden = True
 
6
     takes_args = ["filename"]
 
7
     def run(self, filename):
 
8
+        from bzrlib.log import find_touching_revisions
 
9
         b = Branch(filename, lock_mode='r')
 
10
         inv = b.read_working_inventory()
 
11
         file_id = inv.path2id(b.relpath(filename))
 
12
-        for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):
 
13
-            print "%6d %s" % (revno, what)
 
14
+        rh = b.revision_history()
 
15
+        for revision_id, what in find_touching_revisions(b, file_id, rh):
 
16
+            print "%-40s %s" % (revision_id, what)
 
17
 
 
18
 
 
19
 class cmd_ls(Command):
 
20
 
 
21
*** modified file 'bzrlib/log.py'
 
22
--- bzrlib/log.py 
 
23
+++ bzrlib/log.py 
 
24
@@ -17,7 +17,7 @@
 
25
 
 
26
 
 
27
 
 
28
-def find_touching_revisions(branch, file_id):
 
29
+def find_touching_revisions(branch, file_id, revisions):
 
30
     """Yield a description of revisions which affect the file_id.
 
31
 
 
32
     Each returned element is (revno, revision_id, description)
 
33
@@ -25,13 +25,20 @@
 
34
     This is the list of revisions where the file is either added,
 
35
     modified, renamed or deleted.
 
36
 
 
37
-    TODO: Perhaps some way to limit this to only particular revisions,
 
38
-    or to traverse a non-mainline set of revisions?
 
39
+    branch
 
40
+        Branch to examine
 
41
+
 
42
+    file_id
 
43
+        File to consider
 
44
+
 
45
+    revisions
 
46
+        Sequence of revisions to search, can be
 
47
+        branch.revision_history() or a filtered version of that
 
48
+        or some sequence of non-mailine revisions.
 
49
     """
 
50
     last_ie = None
 
51
     last_path = None
 
52
-    revno = 1
 
53
-    for revision_id in branch.revision_history():
 
54
+    for revision_id in revisions:
 
55
         this_inv = branch.get_revision_inventory(revision_id)
 
56
         if file_id in this_inv:
 
57
             this_ie = this_inv[file_id]
 
58
@@ -46,19 +53,19 @@
 
59
             # not present in either
 
60
             pass
 
61
         elif this_ie and not last_ie:
 
62
-            yield revno, revision_id, "added " + this_path
 
63
+            yield revision_id, "added " + this_path
 
64
         elif not this_ie and last_ie:
 
65
             # deleted here
 
66
-            yield revno, revision_id, "deleted " + last_path
 
67
+            yield revision_id, "deleted " + last_path
 
68
         elif this_path != last_path:
 
69
-            yield revno, revision_id, ("renamed %s => %s" % (last_path, this_path))
 
70
+            yield revision_id, ("renamed %s => %s" % (last_path, this_path))
 
71
         elif (this_ie.text_size != last_ie.text_size
 
72
               or this_ie.text_sha1 != last_ie.text_sha1):
 
73
-            yield revno, revision_id, "modified " + this_path
 
74
+            yield revision_id, "modified " + this_path
 
75
 
 
76
         last_ie = this_ie
 
77
         last_path = this_path
 
78
-        revno += 1
 
79
+
 
80
 
 
81
 
 
82
 def show_log(branch,
 
83