changeset 7414:040484030491

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Tue, 25 Nov 2008 16:24:22 -0600
parents 5751631246de (diff) 0b6428da1f22 (current diff)
children 6163ef936a00
files hgext/mq.py mercurial/commands.py mercurial/util.py templates/coal/changeset.tmpl templates/coal/error.tmpl templates/coal/fileannotate.tmpl templates/coal/filediff.tmpl templates/coal/filelog.tmpl templates/coal/filelogentry.tmpl templates/coal/filerevision.tmpl templates/coal/footer.tmpl templates/coal/graph.tmpl templates/coal/index.tmpl templates/coal/manifest.tmpl templates/coal/notfound.tmpl templates/coal/search.tmpl templates/coal/shortlog.tmpl templates/coal/shortlogentry.tmpl templates/coal/tags.tmpl
diffstat 8 files changed, 46 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/hgext/mq.py	Tue Nov 25 16:24:22 2008 -0600
@@ -1662,7 +1662,7 @@
     An existing changeset may be placed under mq control with --rev
     (e.g. qimport --rev tip -n patch will place tip under mq control).
     With --git, patches imported with --rev will use the git diff
-    format. See the gitdiffs help topic for information on why this is
+    format. See the diffs help topic for information on why this is
     important for preserving rename/copy information and permission changes.
     """
     q = repo.mq
@@ -1829,9 +1829,10 @@
     -e, -m or -l set the patch header as well as the commit message. If none
     is specified, the header is empty and the commit message is '[mq]: PATCH'.
 
-    Use the --git option to keep the patch in the git extended diff format.
-    Read the gitdiffs help topic for more information on why this is
-    important for preserving permission changes and copy/rename information.
+    Use the --git option to keep the patch in the git extended diff
+    format. Read the diffs help topic for more information on why this
+    is important for preserving permission changes and copy/rename
+    information.
     """
     msg = cmdutil.logmessage(opts)
     def getmsg(): return ui.edit(msg, ui.username())
@@ -1858,7 +1859,7 @@
 
     hg add/remove/copy/rename work as usual, though you might want to use
     git-style patches (--git or [diff] git=1) to track copies and renames.
-    See the gitdiffs help topic for more information on the git diff format.
+    See the diffs help topic for more information on the git diff format.
     """
     q = repo.mq
     message = cmdutil.logmessage(opts)
--- a/mercurial/commands.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/mercurial/commands.py	Tue Nov 25 16:24:22 2008 -0600
@@ -1005,7 +1005,7 @@
     probably with undesirable results.
 
     Use the --git option to generate diffs in the git extended diff
-    format. Read the gitdiffs help topic for more information.
+    format. Read the diffs help topic for more information.
     """
     node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
 
@@ -1042,7 +1042,7 @@
     probably with undesirable results.
 
     Use the --git option to generate diffs in the git extended diff
-    format. Read the gitdiffs help topic for more information.
+    format. Read the diffs help topic for more information.
 
     With the --switch-parent option, the diff will be against the second
     parent. It can be useful to review a merge.
--- a/mercurial/dispatch.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/mercurial/dispatch.py	Tue Nov 25 16:24:22 2008 -0600
@@ -7,7 +7,7 @@
 
 from i18n import _
 from repo import RepoError
-import os, sys, atexit, signal, pdb, traceback, socket, errno, shlex, time
+import os, sys, atexit, signal, pdb, socket, errno, shlex, time
 import util, commands, hg, lock, fancyopts, revlog, version, extensions, hook
 import cmdutil
 import ui as _ui
@@ -356,9 +356,9 @@
                     raise RepoError(_("There is no Mercurial repository here"
                                       " (.hg not found)"))
                 raise
-        d = lambda: func(ui, repo, *args, **cmdoptions)
-    else:
-        d = lambda: func(ui, *args, **cmdoptions)
+        args.insert(0, repo)
+
+    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
 
     # run pre-hook, and abort if it fails
     ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs))
@@ -374,11 +374,7 @@
     def checkargs():
         try:
             return cmdfunc()
-        except TypeError:
-            # was this an argument error?
-            tb = traceback.extract_tb(sys.exc_info()[2])
-            if len(tb) != 2: # no
-                raise
+        except util.SignatureError:
             raise ParseError(cmd, _("invalid arguments"))
 
     if options['profile']:
--- a/mercurial/extensions.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/mercurial/extensions.py	Tue Nov 25 16:24:22 2008 -0600
@@ -96,7 +96,8 @@
 
     origfn = entry[0]
     def wrap(*args, **kwargs):
-        return wrapper(origfn, *args, **kwargs)
+        return util.checksignature(wrapper)(
+            util.checksignature(origfn), *args, **kwargs)
 
     wrap.__doc__ = getattr(origfn, '__doc__')
     wrap.__module__ = getattr(origfn, '__module__')
--- a/mercurial/help.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/mercurial/help.py	Tue Nov 25 16:24:22 2008 -0600
@@ -216,34 +216,31 @@
     gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2.
     ''')),
 
-    (['gitdiffs'], _('Git Extended Diff Format'),
+    (['diffs'], _('Diff Formats'),
      _(r'''
     Mercurial's default format for showing changes between two versions
-    of a file is compatible to the unified format of GNU diff, which
+    of a file is compatible with the unified format of GNU diff, which
     can be used by GNU patch and many other standard tools.
 
-    While this de facto standardized format is often enough, there are
-    cases where additional change information should be included in the
-    generated diff file:
+    While this standard format is often enough, it does not encode the
+    following information:
 
      - executable status
      - copy or rename information
      - changes in binary files
      - creation or deletion of empty files
 
-    Mercurial adopted the extended diff format which was invented for
-    the git VCS to support above features.
+    Mercurial also supports the extended diff format from the git VCS
+    which addresses these limitations. The git diff format is not
+    produced by default because there are very few tools which
+    understand this format.
 
-    The git extended diff format is not produced by default, because
-    there are only very few tools (yet) which understand the additional
-    information provided by them.
-
-    This means that, when generating diffs from a Mercurial repository
+    This means that when generating diffs from a Mercurial repository
     (e.g. with "hg export"), you should be careful about things like
     file copies and renames or other things mentioned above, because
     when applying a standard diff to a different repository, this extra
     information is lost. Mercurial's internal operations (like push and
-    pull) are not affected by this, because they use a different, binary
+    pull) are not affected by this, because they use an internal binary
     format for communicating changes.
 
     To make Mercurial produce the git extended diff format, use the
--- a/mercurial/util.py	Tue Nov 25 23:13:14 2008 +0100
+++ b/mercurial/util.py	Tue Nov 25 16:24:22 2008 -0600
@@ -13,7 +13,7 @@
 """
 
 from i18n import _
-import cStringIO, errno, getpass, re, shutil, sys, tempfile
+import cStringIO, errno, getpass, re, shutil, sys, tempfile, traceback
 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
 import imp
 
@@ -702,6 +702,21 @@
         if cwd is not None and oldcwd != cwd:
             os.chdir(oldcwd)
 
+class SignatureError:
+    pass
+
+def checksignature(func):
+    '''wrap a function with code to check for calling errors'''
+    def check(*args, **kwargs):
+        try:
+            return func(*args, **kwargs)
+        except TypeError:
+            if len(traceback.extract_tb(sys.exc_info()[2])) == 1:
+                raise SignatureError
+            raise
+
+    return check
+
 # os.path.lexists is not available on python2.3
 def lexists(filename):
     "test whether a file with this name exists. does not follow symlinks"
--- a/tests/test-globalopts.out	Tue Nov 25 23:13:14 2008 +0100
+++ b/tests/test-globalopts.out	Tue Nov 25 16:24:22 2008 -0600
@@ -205,7 +205,7 @@
  environment  Environment Variables
  revisions    Specifying Single Revisions
  multirevs    Specifying Multiple Revisions
- gitdiffs     Git Extended Diff Format
+ diffs        Diff Formats
 
 use "hg -v help" to show aliases and global options
 Mercurial Distributed SCM
@@ -268,7 +268,7 @@
  environment  Environment Variables
  revisions    Specifying Single Revisions
  multirevs    Specifying Multiple Revisions
- gitdiffs     Git Extended Diff Format
+ diffs        Diff Formats
 
 use "hg -v help" to show aliases and global options
 %% not tested: --debugger
--- a/tests/test-help.out	Tue Nov 25 23:13:14 2008 +0100
+++ b/tests/test-help.out	Tue Nov 25 16:24:22 2008 -0600
@@ -96,7 +96,7 @@
  environment  Environment Variables
  revisions    Specifying Single Revisions
  multirevs    Specifying Multiple Revisions
- gitdiffs     Git Extended Diff Format
+ diffs        Diff Formats
 
 use "hg -v help" to show aliases and global options
  add          add the specified files on the next commit
@@ -155,7 +155,7 @@
  environment  Environment Variables
  revisions    Specifying Single Revisions
  multirevs    Specifying Multiple Revisions
- gitdiffs     Git Extended Diff Format
+ diffs        Diff Formats
 hg add [OPTION]... [FILE]...
 
 add the specified files on the next commit
@@ -216,7 +216,7 @@
     probably with undesirable results.
 
     Use the --git option to generate diffs in the git extended diff
-    format. Read the gitdiffs help topic for more information.
+    format. Read the diffs help topic for more information.
 
 options: