Merge with stable
authorChristian Ebert <blacktrash@gmx.net>
Fri, 17 Jan 2014 15:32:21 +0000
changeset 1322 95880c8fedb6
parent 1314 48123437bbc5 (current diff)
parent 1321 79f68c0ed71e (diff)
child 1324 0af7748569a8
Merge with stable
--- a/hgkw/keyword.py	Tue Jan 14 15:51:15 2014 +0000
+++ b/hgkw/keyword.py	Fri Jan 17 15:32:21 2014 +0000
@@ -83,7 +83,7 @@
 
 from mercurial import commands, context, cmdutil, dispatch, filelog, extensions
 from mercurial import localrepo, match, patch, templatefilters, templater, util
-from mercurial import scmutil
+from mercurial import scmutil, pathutil
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
 import os, re, shutil, tempfile
@@ -447,7 +447,7 @@
         if name.split('.', 1)[0].find('commit') > -1:
             repo.ui.setconfig('hooks', name, '')
     msg = _('hg keyword configuration and expansion example')
-    ui.note("hg ci -m '%s'\n" % msg) # check-code-ignore
+    ui.note(("hg ci -m '%s'\n" % msg))
     repo.commit(text=msg)
     ui.status(_('\n\tkeywords expanded\n'))
     ui.write(repo.wread(fn))
@@ -676,7 +676,7 @@
                 expansion. '''
                 source = repo.dirstate.copied(dest)
                 if 'l' in wctx.flags(source):
-                    source = scmutil.canonpath(repo.root, cwd,
+                    source = pathutil.canonpath(repo.root, cwd,
                                                os.path.realpath(source))
                 return kwt.match(source)
 
--- a/tests/run-tests.py	Tue Jan 14 15:51:15 2014 +0000
+++ b/tests/run-tests.py	Fri Jan 17 15:32:21 2014 +0000
@@ -606,7 +606,7 @@
     if el + '\n' == l:
         if os.altsep:
             # matching on "/" is not needed for this line
-            log("\nInfo, unnecessary glob: %s (glob)" % el)
+            return '-glob'
         return True
     i, n = 0, len(el)
     res = ''
@@ -634,9 +634,12 @@
             el = el[:-7].decode('string-escape') + '\n'
         if el == l or os.name == 'nt' and el[:-1] + '\r\n' == l:
             return True
-        if (el.endswith(" (re)\n") and rematch(el[:-6], l) or
-            el.endswith(" (glob)\n") and globmatch(el[:-8], l)):
-            return True
+        if el.endswith(" (re)\n"):
+            return rematch(el[:-6], l)
+        if el.endswith(" (glob)\n"):
+            return globmatch(el[:-8], l)
+        if os.altsep and l.replace('\\', '/') == el:
+            return '+glob'
     return False
 
 def tsttest(test, wd, options, replacements, env):
@@ -790,7 +793,19 @@
             if pos in expected and expected[pos]:
                 el = expected[pos].pop(0)
 
-            if linematch(el, lout):
+            r = linematch(el, lout)
+            if isinstance(r, str):
+                if r == '+glob':
+                    lout = el[:-1] + ' (glob)\n'
+                    r = False
+                elif r == '-glob':
+                    log('\ninfo, unnecessary glob in %s (after line %d):'
+                        ' %s (glob)\n' % (test, pos, el[-1]))
+                    r = True # pass on unnecessary glob
+                else:
+                    log('\ninfo, unknown linematch result: %r\n' % r)
+                    r = False
+            if r:
                 postout.append("  " + el)
             else:
                 if needescape(lout):
@@ -1077,6 +1092,9 @@
             done.put(runone(options, test, count))
         except KeyboardInterrupt:
             pass
+        except: # re-raises
+            done.put(('!', test, 'run-test raised an error, see traceback'))
+            raise
 
     try:
         while tests or running:
@@ -1093,7 +1111,7 @@
                 test = tests.pop(0)
                 if options.loop:
                     tests.append(test)
-                t = threading.Thread(target=job, args=(test, count))
+                t = threading.Thread(target=job, name=test, args=(test, count))
                 t.start()
                 running += 1
                 count += 1