Merge with crew
authorMatt Mackall <mpm@selenic.com>
Tue, 01 Dec 2009 14:37:57 -0600
changeset 9983 46c6bac41dc6
parent 9982 ddc899096b7b (current diff)
parent 9975 2e67734e1453 (diff)
child 9985 279282ca42f0
Merge with crew
mercurial/commands.py
--- a/hgext/convert/convcmd.py	Tue Dec 01 14:37:33 2009 -0600
+++ b/hgext/convert/convcmd.py	Tue Dec 01 14:37:57 2009 -0600
@@ -48,6 +48,8 @@
 
 def convertsource(ui, path, type, rev):
     exceptions = []
+    if type and type not in [s[0] for s in source_converters]:
+        raise util.Abort(_('%s: invalid source repository type') % type)
     for name, source, sortmode in source_converters:
         try:
             if not type or name == type:
@@ -60,6 +62,8 @@
     raise util.Abort(_('%s: missing or unsupported repository') % path)
 
 def convertsink(ui, path, type):
+    if type and type not in [s[0] for s in sink_converters]:
+        raise util.Abort(_('%s: invalid destination repository type') % type)
     for name, sink in sink_converters:
         try:
             if not type or name == type:
--- a/mercurial/cmdutil.py	Tue Dec 01 14:37:33 2009 -0600
+++ b/mercurial/cmdutil.py	Tue Dec 01 14:37:57 2009 -0600
@@ -755,7 +755,8 @@
                                      cache={
                                          'parent': '{rev}:{node|formatnode} ',
                                          'manifest': '{rev}:{node|formatnode}',
-                                         'filecopy': '{name} ({source})'})
+                                         'filecopy': '{name} ({source})',
+                                         'extra': '{key}={value|stringescape}'})
         # Cache mapping from rev to a tuple with tag date, tag
         # distance and tag name
         self._latesttagcache = {-1: (0, 0, 'null')}
--- a/mercurial/context.py	Tue Dec 01 14:37:33 2009 -0600
+++ b/mercurial/context.py	Tue Dec 01 14:37:57 2009 -0600
@@ -433,19 +433,17 @@
         # sort by revision (per file) which is a topological order
         visit = []
         for f in files:
-            fn = [(n.rev(), n) for n in needed if n._path == f]
-            visit.extend(fn)
+            visit.extend(n for n in needed if n._path == f)
 
         hist = {}
-        for r, f in sorted(visit):
+        for f in sorted(visit, key=lambda x: x.rev()):
             curr = decorate(f.data(), f)
             for p in parents(f):
-                if p != nullid:
-                    curr = pair(hist[p], curr)
-                    # trim the history of unneeded revs
-                    needed[p] -= 1
-                    if not needed[p]:
-                        del hist[p]
+                curr = pair(hist[p], curr)
+                # trim the history of unneeded revs
+                needed[p] -= 1
+                if not needed[p]:
+                    del hist[p]
             hist[f] = curr
 
         return zip(hist[f][0], hist[f][1].splitlines(True))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/blacklist	Tue Dec 01 14:37:57 2009 -0600
@@ -0,0 +1,37 @@
+# ConfigParser format
+# Definitions of blacklists for run-tests.py
+#
+# Identify in config sections a list of tests you want to be skipped.
+# Section names are meant to be used as targets for run-tests.py --blacklist
+# option.
+# "test-" prefixes should be omitted from test names. Values are not used.
+#
+# e.g. if your file looks like:
+## [example]
+## hgrc =
+## help = "this string is not used"
+# then calling "run-tests.py --blacklist example" will exclude test-hgrc and
+# test-help from the list of tests to run.
+
+[inotify-failures]
+# When --inotify is activated, help output and config changes:
+debugcomplete =
+empty =
+fncache =
+globalopts =
+help =
+hgrc =
+inherit-mode =
+qrecord =
+strict =
+
+# --inotify activates de facto the inotify extension. It does not play well
+# with inotify-specific tests, which activate/desactivate inotify at will:
+inotify =
+inotify-debuginotify =
+inotify-dirty-dirstate =
+inotify-issue1208 =
+inotify-issue1371 =
+inotify-issue1542 =
+inotify-issue1556 =
+inotify-lookup =
--- a/tests/run-tests.py	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/run-tests.py	Tue Dec 01 14:37:57 2009 -0600
@@ -41,6 +41,7 @@
 # completes fairly quickly, includes both shell and Python scripts, and
 # includes some scripts that run daemon processes.)
 
+from ConfigParser import ConfigParser
 import difflib
 import errno
 import optparse
@@ -130,6 +131,11 @@
         help="use pure Python code instead of C extensions")
     parser.add_option("-3", "--py3k-warnings", action="store_true",
         help="enable Py3k warnings on Python 2.6+")
+    parser.add_option("--inotify", action="store_true",
+        help="enable inotify extension when running tests")
+    parser.add_option("--blacklist", action="append",
+        help="skip tests listed in the specified section of "
+             "the blacklist file")
 
     for option, default in defaults.items():
         defaults[option] = int(os.environ.get(*default))
@@ -195,6 +201,14 @@
     if options.py3k_warnings:
         if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
             parser.error('--py3k-warnings can only be used on Python 2.6+')
+    if options.blacklist:
+        configparser = ConfigParser()
+        configparser.read("blacklist")
+        blacklist = dict()
+        for section in options.blacklist:
+            for (item, value) in configparser.items(section):
+                blacklist["test-" + item] = section
+        options.blacklist = blacklist
 
     return (options, args)
 
@@ -457,6 +471,11 @@
     hgrc.write('backout = -d "0 0"\n')
     hgrc.write('commit = -d "0 0"\n')
     hgrc.write('tag = -d "0 0"\n')
+    if options.inotify:
+        hgrc.write('[extensions]\n')
+        hgrc.write('inotify=\n')
+        hgrc.write('[inotify]\n')
+        hgrc.write('pidfile=%s\n' % DAEMON_PIDS)
     hgrc.close()
 
     err = os.path.join(TESTDIR, test+".err")
@@ -723,6 +742,13 @@
         fails = []
 
         for test in tests:
+            if options.blacklist:
+                section = options.blacklist.get(test)
+                if section is not None:
+                    skips.append((test, "blacklisted (%s section)" % section))
+                    skipped += 1
+                    continue
+
             if options.retest and not os.path.exists(test + ".err"):
                 skipped += 1
                 continue
--- a/tests/test-command-template	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/test-command-template	Tue Dec 01 14:37:57 2009 -0600
@@ -93,7 +93,7 @@
 
 echo "# keys work"
 for key in author branches date desc file_adds file_dels file_mods \
-        files manifest node parents rev tags diffstat; do
+        files manifest node parents rev tags diffstat extras; do
     for mode in '' --verbose --debug; do
         hg log $mode --template "$key$mode: {$key}\n"
     done
--- a/tests/test-command-template.out	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/test-command-template.out	Tue Dec 01 14:37:57 2009 -0600
@@ -569,6 +569,33 @@
 diffstat--debug: 1: +4/-0
 diffstat--debug: 1: +2/-0
 diffstat--debug: 1: +1/-0
+extras: branch=default
+extras: branch=default
+extras: branch=default
+extras: branch=default
+extras: branch=foo
+extras: branch=default
+extras: branch=default
+extras: branch=default
+extras: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=foo
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--verbose: branch=default
+extras--debug: branch=default
+extras--debug: branch=default
+extras--debug: branch=default
+extras--debug: branch=default
+extras--debug: branch=foo
+extras--debug: branch=default
+extras--debug: branch=default
+extras--debug: branch=default
+extras--debug: branch=default
 # filters work
 
 hostname
--- a/tests/test-convert	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/test-convert	Tue Dec 01 14:37:57 2009 -0600
@@ -50,3 +50,10 @@
 # override $PATH to ensure p4 not visible; use $PYTHON in case we're
 # running from a devel copy, not a temp installation
 PATH=$BINDIR $PYTHON $BINDIR/hg convert emptydir 2>&1 | sed 's,file://.*/emptydir,.../emptydir,g'
+
+echo % convert with imaginary source type
+hg convert --source-type foo a a-foo
+echo % convert with imaginary sink type
+hg convert --dest-type foo a a-foo
+
+true
--- a/tests/test-convert.out	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/test-convert.out	Tue Dec 01 14:37:57 2009 -0600
@@ -259,3 +259,8 @@
 emptydir does not look like a Bazaar repo
 cannot find required "p4" tool
 abort: emptydir: missing or unsupported repository
+% convert with imaginary source type
+initializing destination a-foo repository
+abort: foo: invalid source repository type
+% convert with imaginary sink type
+abort: foo: invalid destination repository type
--- a/tests/test-rollback	Tue Dec 01 14:37:33 2009 -0600
+++ b/tests/test-rollback	Tue Dec 01 14:37:57 2009 -0600
@@ -33,7 +33,7 @@
 
 echo '% rollback by pretxncommit saves commit message (issue 1635)'
 echo a >> a
-hg --config hooks.pretxncommit=/bin/false commit -m"precious commit message"
+hg --config hooks.pretxncommit=false commit -m"precious commit message"
 echo '.hg/last-message.txt:'
 cat .hg/last-message.txt ; echo
 
@@ -43,6 +43,6 @@
 echo "another precious commit message" > "$1"
 __EOF__
 chmod +x $HGTMP/editor
-HGEDITOR=$HGTMP/editor hg --config hooks.pretxncommit=/bin/false commit
+HGEDITOR=$HGTMP/editor hg --config hooks.pretxncommit=false commit
 echo '.hg/last-message.txt:'
 cat .hg/last-message.txt