Merge with BOS
authormpm@selenic.com
Thu, 04 Aug 2005 13:31:25 -0800
changeset 839 9c918287d10b4018e27f9148e247e68ff5fe952c
parent 836 1fe3b14c704408d57e0b33efdaaf5adba6d87617 (current diff)
parent 838 0fc4b1ab57e384a7db91505feb5d812b8f482bbe (diff)
child 840 141744605b516a4011f29f2bd5347cb5d0743336
child 868 6a8a50bcc14380c142865158fbfc4bd1d0e53eca
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
Merge with BOS
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
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -48,21 +48,27 @@ def pathto(n1, n2):
     if not n1: return n2
     a, b = n1.split(os.sep), n2.split(os.sep)
     a.reverse(), b.reverse()
     while a and b and a[-1] == b[-1]:
         a.pop(), b.pop()
     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 = ':'
 
 def revrange(ui, repo, revs, revlog=None):
     if revlog is None:
         revlog = repo.changelog
     revcount = revlog.count()
     def fix(val, defval):
@@ -148,21 +154,21 @@ def make_file(repo, r, pat, node=None,
         else: return sys.stdin
     if hasattr(pat, 'write') and 'w' in mode:
         return pat
     if hasattr(pat, 'read') and 'r' in mode:
         return pat
     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))
 
     if not c and not a and not d:
         return
 
     if node2:
         change = repo.changelog.read(node2)
@@ -583,19 +589,20 @@ def diff(ui, repo, *pats, **opts):
     revs = []
     if opts['rev']:
         revs = map(lambda x: repo.lookup(x), opts['rev'])
 
     if len(revs) > 2:
         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)
     prev, other = repo.changelog.parents(node)
     change = repo.changelog.read(node)
 
     fp = make_file(repo, repo.changelog, opts['output'],
                    node=node, total=total, seqno=seqno,