Merge with Matt's tip.
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 20 Jul 2005 03:52:06 -0800
changeset 737 8db4d406b3d3d5b52b704b48c69a16a9f2879cd4
parent 736 1e84f1014f332f7118efc7b18c55d2fa9e12a5d2 (current diff)
parent 721 fed842bb84b29223761e2ee1ac77853e2828598a (diff)
child 738 32a97c9d8e9876541b2c1e061c30a41a58cdc0b7
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
Merge with Matt's tip.
.hgignore
contrib/hgit
doc/FAQ.txt
doc/hg.1.txt
mercurial/commands.py
mercurial/hg.py
mercurial/util.py
templates/map
tests/test-help.out
--- a/contrib/hgit
+++ b/contrib/hgit
@@ -13,17 +13,17 @@ from mercurial import hg, mdiff, fancyop
 def difftree(args, ui, repo):
     def __difftree(repo, files = None, node1 = None, node2 = None):
         def date(c):
             return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
 
         if node2:
             change = repo.changelog.read(node2)
             mmap2 = repo.manifest.read(change[0])
-            (c, a, d) = repo.diffrevs(node1, node2)
+            (c, a, d, u) = repo.changes(node1, node2)
             def read(f): return repo.file(f).read(mmap2[f])
             date2 = date(change)
         else:
             date2 = time.asctime()
             (c, a, d, u) = repo.diffdir(repo.root, node1)
             if not node1:
                 node1 = repo.dirstate.parents()[0]
             def read(f): return file(os.path.join(repo.root, f)).read()
@@ -46,27 +46,26 @@ def difftree(args, ui, repo):
             print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f)
     ##
 
     revs = []
     if args:
         doptions = {}
         opts = [('p', 'patch', None, 'patch'),
                 ('r', 'recursive', None, 'recursive')]
-        args = fancyopts.fancyopts(args, opts, doptions,
-                                   'hg diff-tree [options] sha1 sha1')
+        args = fancyopts.fancyopts(args, opts, doptions)
 
     if len(args) < 2:
         help()
         sys.exit(1)
     revs.append(repo.lookup(args[0]))
     revs.append(repo.lookup(args[1]))
     args = args[2:]
     if doptions['patch']:
-        commands.dodiff(ui, repo, "", args, *revs)
+        commands.dodiff(sys.stdout, ui, repo, args, *revs)
     else:
         __difftree(repo, args, *revs)
 
 def catcommit(repo, n, prefix):
     nlprefix = '\n' + prefix;
     changes = repo.changelog.read(n)
     (p1, p2) = repo.changelog.parents(n)
     (h, h1, h2) = map(hg.hex, (n, p1, p2))
@@ -82,18 +81,17 @@ def catcommit(repo, n, prefix):
     if prefix != "":
         print "%s%s" % (prefix, changes[4].replace('\n', nlprefix).strip())
     else:
         print changes[4]
 
 def catfile(args, ui, repo):
     doptions = {}
     opts = [('s', 'stdin', None, 'stdin')]
-    args = fancyopts.fancyopts(args, opts, doptions,
-                               'hg cat-file type sha1')
+    args = fancyopts.fancyopts(args, opts, doptions)
 
     # in stdin mode, every line except the commit is prefixed with two
     # spaces.  This way the our caller can find the commit without magic
     # strings
     #
     prefix = ""
     if doptions['stdin']:
         try:
@@ -108,17 +106,17 @@ def catfile(args, ui, repo):
             sys.exit(1)
         type = args[0]
         r = args[1]
 
     while r:
         if type != "commit":
             sys.stderr.write("aborting hg cat-file only understands commits\n")
             sys.exit(1);
-        n = repo.changelog.lookup(r)
+        n = repo.lookup(r)
         catcommit(repo, n, prefix)
         if doptions['stdin']:
             try:
                 (type, r) = raw_input().split(' ');
             except EOFError:
                 break
         else:
             break
@@ -143,27 +141,27 @@ def revtree(args, repo, full="tree", max
     reachable = []
     stop_sha1 = []
     want_sha1 = []
     count = 0
 
     # figure out which commits they are asking for and which ones they
     # want us to stop on
     for i in range(len(args)):
-        if args[i].count('^'):
-            s = args[i].split('^')[1]
-            stop_sha1.append(repo.changelog.lookup(s))
+        if args[i].startswith('^'):
+            s = repo.lookup(args[i][1:])
+            stop_sha1.append(s)
             want_sha1.append(s)
         elif args[i] != 'HEAD':
-            want_sha1.append(args[i])
+            want_sha1.append(repo.lookup(args[i]))
 
     # calculate the graph for the supplied commits
     for i in range(len(want_sha1)):
         reachable.append({});
-        n = repo.changelog.lookup(want_sha1[i]);
+        n = want_sha1[i];
         visit = [n];
         reachable[i][n] = 1
         while visit:
             n = visit.pop(0)
             if n in stop_sha1:
                 break
             for p in repo.changelog.parents(n):
                 if p not in reachable[i]:
@@ -204,35 +202,34 @@ def revtree(args, repo, full="tree", max
 
 # git rev-list tries to order things by date, and has the ability to stop
 # at a given commit without walking the whole repo.  TODO add the stop
 # parameter
 def revlist(args, repo):
     doptions = {}
     opts = [('c', 'commit', None, 'commit'),
             ('n', 'max-nr', 0, 'max-nr')]
-    args = fancyopts.fancyopts(args, opts, doptions,
-                               'hg rev-list')
+    args = fancyopts.fancyopts(args, opts, doptions)
     if doptions['commit']:
         full = "commit"
     else:
         full = None
     for i in range(1, len(args)):
         args[i] = '^' + args[i]
     revtree(args, repo, full, doptions['max-nr'])
 
 def catchterm(*args):
     raise SignalInterrupt
 
 def help():
     sys.stderr.write("commands:\n")
     sys.stderr.write("  hgit cat-file [type] sha1\n")
     sys.stderr.write("  hgit diff-tree [-p] [-r] sha1 sha1\n")
     sys.stderr.write("  hgit rev-tree [sha1 ... [^stop sha1]]\n")
-    sys.stderr.write("  hgit rev-list [-c]\n")
+    sys.stderr.write("  hgit rev-list [-c] [sha1 [stop sha1]\n")
 
 cmd = sys.argv[1]
 args = sys.argv[2:]
 u = ui.ui()
 signal.signal(signal.SIGTERM, catchterm)
 repo = hg.repository(ui = u)
 
 if cmd == "diff-tree":
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1670,17 +1670,17 @@ class localrepository:
                     self.ui.warn("file %s:%s unknown parent 2 %s" %
                             (f, short(n), short(p1)))
                     errors += 1
                 nodes[n] = 1
 
             # cross-check
             for node in filenodes[f]:
                 self.ui.warn("node %s in manifests not in %s\n"
-                             % (hex(n), f))
+                             % (hex(node), f))
                 errors += 1
 
         self.ui.status("%d files, %d changesets, %d total revisions\n" %
                        (files, changesets, revisions))
 
         if errors:
             self.ui.warn("%d integrity errors encountered!\n" % errors)
             return 1