changeset 839:9c918287d10b

Merge with BOS
author mpm@selenic.com
date Thu, 04 Aug 2005 13:31:25 -0800
parents 1fe3b14c7044 (current diff) 0fc4b1ab57e3 (diff)
children 141744605b51 6a8a50bcc143
files doc/hg.1.txt hgeditor hgmerge mercurial/bdiff.c mercurial/commands.py mercurial/hg.py mercurial/hgweb.py mercurial/util.py tests/run-tests tests/test-clone tests/test-clone-failure tests/test-merge-revert tests/test-merge-revert.out tests/test-merge-revert2 tests/test-merge-revert2.out tests/test-merge5.out tests/test-push-warn tests/test-push-warn.out
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 04 13:27:41 2005 -0800
+++ b/mercurial/commands.py	Thu Aug 04 13:31:25 2005 -0800
@@ -53,11 +53,17 @@
     b.reverse()
     return os.sep.join((['..'] * len(a)) + b)
 
-def walk(repo, pats, opts, head = ''):
+def makewalk(repo, pats, opts, head = ''):
     cwd = repo.getcwd()
     files, matchfn = matchpats(cwd, pats, opts, head)
-    for src, fn in repo.walk(files = files, match = matchfn):
-        yield src, fn, pathto(cwd, fn)
+    def walk():
+        for src, fn in repo.walk(files = files, match = matchfn):
+            yield src, fn, pathto(cwd, fn)
+    return files, matchfn, walk()
+
+def walk(repo, pats, opts, head = ''):
+    files, matchfn, results = makewalk(repo, pats, opts, head)
+    for r in results: yield r
 
 revrangesep = ':'
 
@@ -153,11 +159,11 @@
     return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
                 mode)
 
-def dodiff(fp, ui, repo, files=None, node1=None, node2=None):
+def dodiff(fp, ui, repo, files=None, node1=None, node2=None, match=util.always):
     def date(c):
         return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
 
-    (c, a, d, u) = repo.changes(node1, node2, files)
+    (c, a, d, u) = repo.changes(node1, node2, files, match = match)
     if files:
         c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
 
@@ -588,9 +594,10 @@
         raise Abort("too many revisions to diff")
 
     files = []
-    for src, abs, rel in walk(repo, pats, opts):
+    roots, match, results = makewalk(repo, pats, opts)
+    for src, abs, rel in results:
         files.append(abs)
-    dodiff(sys.stdout, ui, repo, files, *revs)
+    dodiff(sys.stdout, ui, repo, files, *revs, **{'match': match})
 
 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
     node = repo.lookup(changeset)