[Pkg-bazaar-commits] ./bzr/unstable r631: - add deferred patch for finding touching patches from a list
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:20:31 UTC 2009
------------------------------------------------------------
revno: 631
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-06-06 22:33:11 +1000
message:
- add deferred patch for finding touching patches from a list
added:
patches/find-touching-from-seq.diff
-------------- next part --------------
=== added file 'patches/find-touching-from-seq.diff'
--- a/patches/find-touching-from-seq.diff 1970-01-01 00:00:00 +0000
+++ b/patches/find-touching-from-seq.diff 2005-06-06 12:33:11 +0000
@@ -0,0 +1,83 @@
+*** modified file 'bzrlib/commands.py'
+--- bzrlib/commands.py
++++ bzrlib/commands.py
+@@ -610,11 +610,13 @@
+ hidden = True
+ takes_args = ["filename"]
+ def run(self, filename):
++ from bzrlib.log import find_touching_revisions
+ b = Branch(filename, lock_mode='r')
+ inv = b.read_working_inventory()
+ file_id = inv.path2id(b.relpath(filename))
+- for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):
+- print "%6d %s" % (revno, what)
++ rh = b.revision_history()
++ for revision_id, what in find_touching_revisions(b, file_id, rh):
++ print "%-40s %s" % (revision_id, what)
+
+
+ class cmd_ls(Command):
+
+*** modified file 'bzrlib/log.py'
+--- bzrlib/log.py
++++ bzrlib/log.py
+@@ -17,7 +17,7 @@
+
+
+
+-def find_touching_revisions(branch, file_id):
++def find_touching_revisions(branch, file_id, revisions):
+ """Yield a description of revisions which affect the file_id.
+
+ Each returned element is (revno, revision_id, description)
+@@ -25,13 +25,20 @@
+ This is the list of revisions where the file is either added,
+ modified, renamed or deleted.
+
+- TODO: Perhaps some way to limit this to only particular revisions,
+- or to traverse a non-mainline set of revisions?
++ branch
++ Branch to examine
++
++ file_id
++ File to consider
++
++ revisions
++ Sequence of revisions to search, can be
++ branch.revision_history() or a filtered version of that
++ or some sequence of non-mailine revisions.
+ """
+ last_ie = None
+ last_path = None
+- revno = 1
+- for revision_id in branch.revision_history():
++ for revision_id in revisions:
+ this_inv = branch.get_revision_inventory(revision_id)
+ if file_id in this_inv:
+ this_ie = this_inv[file_id]
+@@ -46,19 +53,19 @@
+ # not present in either
+ pass
+ elif this_ie and not last_ie:
+- yield revno, revision_id, "added " + this_path
++ yield revision_id, "added " + this_path
+ elif not this_ie and last_ie:
+ # deleted here
+- yield revno, revision_id, "deleted " + last_path
++ yield revision_id, "deleted " + last_path
+ elif this_path != last_path:
+- yield revno, revision_id, ("renamed %s => %s" % (last_path, this_path))
++ yield revision_id, ("renamed %s => %s" % (last_path, this_path))
+ elif (this_ie.text_size != last_ie.text_size
+ or this_ie.text_sha1 != last_ie.text_sha1):
+- yield revno, revision_id, "modified " + this_path
++ yield revision_id, "modified " + this_path
+
+ last_ie = this_ie
+ last_path = this_path
+- revno += 1
++
+
+
+ def show_log(branch,
+
More information about the Pkg-bazaar-commits
mailing list