changeset 11696:708291e9389c

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Tue, 27 Jul 2010 16:03:42 -0500
parents ee8f36a6c766 (diff) b6360a113478 (current diff)
children efcdf6a953a0
files mercurial/dispatch.py
diffstat 5 files changed, 50 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Sun Jul 25 21:20:05 2010 -0500
+++ b/contrib/perf.py	Tue Jul 27 16:03:42 2010 -0500
@@ -133,6 +133,16 @@
         title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
         timer(d, title)
 
+def perfrevlog(ui, repo, file_, **opts):
+    from mercurial import revlog
+    dist = opts['dist']
+    def d():
+        r = revlog.revlog(lambda fn: open(fn, 'rb'), file_)
+        for x in xrange(0, len(r), dist):
+            r.revision(r.node(x))
+
+    timer(d)
+
 cmdtable = {
     'perflookup': (perflookup, []),
     'perfparents': (perfparents, []),
@@ -149,4 +159,5 @@
                 [('', 'rename', False, 'ask log to follow renames')]),
     'perftemplating': (perftemplating, []),
     'perfdiffwd': (perfdiffwd, []),
+    'perfrevlog': (perfrevlog, [('d', 'dist', 100, 'distance between the revisions')],"[INDEXFILE]"),
 }
--- a/mercurial/dispatch.py	Sun Jul 25 21:20:05 2010 -0500
+++ b/mercurial/dispatch.py	Tue Jul 27 16:03:42 2010 -0500
@@ -223,6 +223,18 @@
         cmd = args.pop(0)
         args = map(util.expandpath, args)
 
+        for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
+            if _earlygetopt([invalidarg], args):
+                def fn(ui, *args):
+                    ui.warn(_("error in definition for alias '%s': %s may only "
+                              "be given on the command line\n")
+                            % (self.name, invalidarg))
+                    return 1
+
+                self.fn = fn
+                self.badalias = True
+                return
+
         try:
             tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
             if len(tableentry) > 2:
--- a/mercurial/revlog.py	Sun Jul 25 21:20:05 2010 -0500
+++ b/mercurial/revlog.py	Tue Jul 27 16:03:42 2010 -0500
@@ -533,6 +533,8 @@
         return self.index[rev][1]
     def base(self, rev):
         return self.index[rev][3]
+    def flags(self, rev):
+        return self.index[rev][0] & 0xFFFF
 
     def size(self, rev):
         """return the length of the uncompressed text for a given revision"""
@@ -1020,9 +1022,9 @@
         base = self.base(rev)
 
         # check rev flags
-        if self.index[rev][0] & 0xFFFF:
+        if self.flags(rev):
             raise RevlogError(_('incompatible revision flag %x') %
-                              (self.index[rev][0] & 0xFFFF))
+                              (self.flags(rev)))
 
         # do we have useful data cached?
         if self._cache and self._cache[1] >= base and self._cache[1] < rev:
--- a/tests/test-alias	Sun Jul 25 21:20:05 2010 -0500
+++ b/tests/test-alias	Tue Jul 27 16:03:42 2010 -0500
@@ -8,6 +8,10 @@
 ambiguous = s
 recursive = recursive
 nodefinition =
+no--cwd = status --cwd elsewhere
+no-R = status -R elsewhere
+no--repo = status --repo elsewhere
+no--repository = status --repository elsewhere
 mylog = log
 lognull = log -r null
 shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
@@ -42,6 +46,16 @@
 hg nodef
 hg help nodef
 
+echo '% invalid options'
+hg no--cwd
+hg help no--cwd
+hg no-R
+hg help no-R
+hg no--repo
+hg help no--repo
+hg no--repository
+hg help no--repository
+
 cd alias
 
 echo '% no usage'
--- a/tests/test-alias.out	Sun Jul 25 21:20:05 2010 -0500
+++ b/tests/test-alias.out	Tue Jul 27 16:03:42 2010 -0500
@@ -11,6 +11,15 @@
 % no definition
 no definition for alias 'nodefinition'
 no definition for alias 'nodefinition'
+% invalid options
+error in definition for alias 'no--cwd': --cwd may only be given on the command line
+error in definition for alias 'no--cwd': --cwd may only be given on the command line
+error in definition for alias 'no-R': -R may only be given on the command line
+error in definition for alias 'no-R': -R may only be given on the command line
+error in definition for alias 'no--repo': --repo may only be given on the command line
+error in definition for alias 'no--repo': --repo may only be given on the command line
+error in definition for alias 'no--repository': --repository may only be given on the command line
+error in definition for alias 'no--repository': --repository may only be given on the command line
 % no usage
 no rollback information available
 adding foo