changeset 35751:6d65cef5b038

merge with stable
author Augie Fackler <augie@google.com>
date Fri, 19 Jan 2018 16:28:11 -0500
parents a39a9df7ecca (current diff) 87676e8ee056 (diff)
children 047581ddb6ce
files mercurial/commands.py mercurial/templatefilters.py tests/run-tests.py tests/test-command-template.t
diffstat 4 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jan 12 10:59:58 2018 +0100
+++ b/mercurial/commands.py	Fri Jan 19 16:28:11 2018 -0500
@@ -2712,7 +2712,8 @@
     a list of tags, and a list of bookmarks.
 
     When REV is not given, print a summary of the current state of the
-    repository.
+    repository including the working directory. Specify -r. to get information
+    of the working directory parent without scanning uncommitted changes.
 
     Specifying a path to a repository root or Mercurial bundle will
     cause lookup to operate on that repository/bundle.
--- a/mercurial/templatefilters.py	Fri Jan 12 10:59:58 2018 +0100
+++ b/mercurial/templatefilters.py	Fri Jan 19 16:28:11 2018 -0500
@@ -90,9 +90,8 @@
 @templatefilter('basename')
 def basename(path):
     """Any text. Treats the text as a path, and returns the last
-    component of the path after splitting by the path separator
-    (ignoring trailing separators). For example, "foo/bar/baz" becomes
-    "baz" and "foo/bar//" becomes "bar".
+    component of the path after splitting by the path separator.
+    For example, "foo/bar/baz" becomes "baz" and "foo/bar//" becomes "".
     """
     return os.path.basename(path)
 
--- a/tests/run-tests.py	Fri Jan 12 10:59:58 2018 +0100
+++ b/tests/run-tests.py	Fri Jan 19 16:28:11 2018 -0500
@@ -670,6 +670,7 @@
 
     def __init__(self, path, outputdir, tmpdir, keeptmpdir=False,
                  debug=False,
+                 first=False,
                  timeout=None,
                  startport=None, extraconfigopts=None,
                  py3kwarnings=False, shell=None, hgcommand=None,
@@ -722,6 +723,7 @@
         self._threadtmp = tmpdir
         self._keeptmpdir = keeptmpdir
         self._debug = debug
+        self._first = first
         self._timeout = timeout
         self._slowtimeout = slowtimeout
         self._startport = startport
@@ -906,9 +908,13 @@
                         f.write(line)
 
             # The result object handles diff calculation for us.
-            if self._result.addOutputMismatch(self, ret, out, self._refout):
-                # change was accepted, skip failing
-                return
+            with firstlock:
+                if self._result.addOutputMismatch(self, ret, out, self._refout):
+                    # change was accepted, skip failing
+                    return
+                if self._first:
+                    global firsterror
+                    firsterror = True
 
             if ret:
                 msg = 'output changed and ' + describe(ret)
@@ -1037,7 +1043,7 @@
             offset = '' if i == 0 else '%s' % i
             env["HGPORT%s" % offset] = '%s' % (self._startport + i)
         env = os.environ.copy()
-        env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase')
+        env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
         env['HGEMITWARNINGS'] = '1'
         env['TESTTMP'] = self._testtmp
         env['HOME'] = self._testtmp
@@ -1637,6 +1643,8 @@
         return TTest.ESCAPESUB(TTest._escapef, s)
 
 iolock = threading.RLock()
+firstlock = threading.RLock()
+firsterror = False
 
 class TestResult(unittest._TextTestResult):
     """Holds results when executing via unittest."""
@@ -1722,7 +1730,7 @@
 
     def addOutputMismatch(self, test, ret, got, expected):
         """Record a mismatch in test output for a particular test."""
-        if self.shouldStop:
+        if self.shouldStop or firsterror:
             # don't print, some other test case already failed and
             # printed, we're just stale and probably failed due to our
             # temp dir getting cleaned up.
@@ -2715,6 +2723,7 @@
         t = testcls(refpath, self._outputdir, tmpdir,
                     keeptmpdir=self.options.keep_tmpdir,
                     debug=self.options.debug,
+                    first=self.options.first,
                     timeout=self.options.timeout,
                     startport=self._getport(count),
                     extraconfigopts=self.options.extra_config_opt,
--- a/tests/test-command-template.t	Fri Jan 12 10:59:58 2018 +0100
+++ b/tests/test-command-template.t	Fri Jan 19 16:28:11 2018 -0500
@@ -2228,6 +2228,11 @@
   $ cd ..
   $ rm -rf unstable-hash
 
+Filename filters:
+
+  $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n'
+  bar||foo|
+
 Add a dummy commit to make up for the instability of the above:
 
   $ echo a > a