Convert diff command over to using walk code.
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 20 Jul 2005 03:16:20 -0800
changeset 732 ba0b6d17a6de
parent 731 91ca3afab8e8
child 733 1966c553f652
Convert diff command over to using walk code.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Jul 20 03:01:23 2005 -0800
+++ b/mercurial/commands.py	Wed Jul 20 03:16:20 2005 -0800
@@ -549,7 +549,7 @@
             ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
     ui.write("}\n")
 
-def diff(ui, repo, *files, **opts):
+def diff(ui, repo, *pats, **opts):
     """diff working directory (or selected files)"""
     revs = []
     if opts['rev']:
@@ -558,11 +558,9 @@
     if len(revs) > 2:
         raise Abort("too many revisions to diff")
 
-    if files:
-        files = relpath(repo, files)
-    else:
-        files = relpath(repo, [""])
-
+    files = []
+    for src, abs, rel in walk(repo, pats, opts):
+        files.append(abs)
     dodiff(sys.stdout, ui, repo, files, *revs)
 
 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
@@ -1126,7 +1124,9 @@
     "debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
     "^diff":
         (diff,
-         [('r', 'rev', [], 'revision')],
+         [('I', 'include', [], 'include path in search'),
+          ('X', 'exclude', [], 'exclude path from search'),
+          ('r', 'rev', [], 'revision')],
          'hg diff [-r REV1 [-r REV2]] [FILE]...'),
     "^export":
         (export,