merge with stable
authorAugie Fackler <augie@google.com>
Thu, 10 Aug 2017 14:23:41 -0400
changeset 33736 86aca74a063b
parent 33735 e6d8ee3c9ec3 (current diff)
parent 33647 98e990bb7330 (diff)
child 33737 02a745c20121
merge with stable
hgext/rebase.py
mercurial/cmdutil.py
mercurial/ui.py
mercurial/util.py
tests/test-extension.t
--- a/.hgsigs	Wed Aug 02 19:49:57 2017 +0200
+++ b/.hgsigs	Thu Aug 10 14:23:41 2017 -0400
@@ -147,3 +147,5 @@
 c850f0ed54c1d42f9aa079ad528f8127e5775217 0 iQIVAwUAWTQINUemf/qjRqrOAQjZDw//b4pEgHYfWRVDEmLZtevysfhlJzbSyLAnWgNnRUVdSwl4WRF1r6ds/q7N4Ege5wQHjOpRtx4jC3y/riMbrLUlaeUXzCdqKgm4JcINS1nXy3IfkeDdUKyOR9upjaVhIEzCMRpyzabdYuflh5CoxayO7GFk2iZ8c1oAl4QzuLSspn9w+znqDg0HrMDbRNijStSulNjkqutih9UqT/PYizhE1UjL0NSnpYyD1vDljsHModJc2dhSzuZ1c4VFZHkienk+CNyeLtVKg8aC+Ej/Ppwq6FlE461T/RxOEzf+WFAc9F4iJibSN2kAFB4ySJ43y+OKkvzAwc5XbUx0y6OlWn2Ph+5T54sIwqasG3DjXyVrwVtAvCrcWUmOyS0RfkKoDVepMPIhFXyrhGqUYSq25Gt6tHVtIrlcWARIGGWlsE+PSHi87qcnSjs4xUzZwVvJWz4fuM1AUG/GTpyt4w3kB85XQikIINkmSTmsM/2/ar75T6jBL3kqOCGOL3n7bVZsGXllhkkQ7e/jqPPWnNXm8scDYdT3WENNu34zZp5ZmqdTXPAIIaqGswnU04KfUSEoYtOMri3E2VvrgMkiINm9BOKpgeTsMb3dkYRw2ZY3UAH9QfdX9BZywk6v3kkE5ghLWMUoQ4sqRlTo7mJKA8+EodjmIGRV/kAv1f7pigg6pIWWEyo=
 26c49ed51a698ec016d2b4c6b44ca3c3f73cc788 0 iQIcBAABCAAGBQJZXQSmAAo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4jifnaCI8F8OQNYmZ3cQhxx6qV2Tyow8arvWb1NYXrocG
+943c91326b23954e6e1c6960d0239511f9530258 0 iQIcBAABCAAGBQJZjKKZAAoJELnJ3IJKpb3VGQkP/0iF6Khef0lBaRhbSAPwa7RUBb3iaBeuwmeic/hUjMoU1E5NR36bDDaF3u2di5mIYPBONFIeCPf9/DKyFkidueX1UnlAQa3mjh/QfKTb4/yO2Nrk7eH+QtrYxVUUYYjwgp4rS0Nd/++I1IUOor54vqJzJ7ZnM5O1RsE7VI1esAC/BTlUuO354bbm08B0owsZBwVvcVvpV4zeTvq5qyPxBJ3M0kw83Pgwh3JZB9IYhOabhSUBcA2fIPHgYGYnJVC+bLOeMWI1HJkJeoYfClNUiQUjAmi0cdTC733eQnHkDw7xyyFi+zkKu6JmU1opxkHSuj4Hrjul7Gtw3vVWWUPufz3AK7oymNp2Xr5y1HQLDtNJP3jicTTG1ae2TdX5Az3ze0I8VGbpR81/6ShAvY2cSKttV3I+2k4epxTTTf0xaZS1eUdnFOox6acElG2reNzx7EYYxpHj17K8N2qNzyY78iPgbJ+L39PBFoiGXMZJqWCxxIHoK1MxlXa8WwSnsXAU768dJvEn2N1x3fl+aeaWzeM4/5Qd83YjFuCeycuRnIo3rejSX3rWFAwZE0qQHKI5YWdKDLxIfdHTjdfMP7np+zLcHt0DV/dHmj2hKQgU0OK04fx7BrmdS1tw67Y9bL3H3TDohn7khU1FrqrKVuqSLbLsxnNyWRbZQF+DCoYrHlIW
--- a/.hgtags	Wed Aug 02 19:49:57 2017 +0200
+++ b/.hgtags	Thu Aug 10 14:23:41 2017 -0400
@@ -160,3 +160,5 @@
 c850f0ed54c1d42f9aa079ad528f8127e5775217 4.2.1
 26c49ed51a698ec016d2b4c6b44ca3c3f73cc788 4.2.2
 857876ebaed4e315f63157bd157d6ce553c7ab73 4.3-rc
+5544af8622863796a0027566f6b646e10d522c4c 4.3
+943c91326b23954e6e1c6960d0239511f9530258 4.2.3
--- a/README	Wed Aug 02 19:49:57 2017 +0200
+++ b/README	Thu Aug 10 14:23:41 2017 -0400
@@ -4,14 +4,14 @@
 Mercurial is a fast, easy to use, distributed revision control tool
 for software developers.
 
-Basic install:
+Basic install::
 
  $ make            # see install targets
  $ make install    # do a system-wide install
  $ hg debuginstall # sanity-check setup
  $ hg              # see help
 
-Running without installing:
+Running without installing::
 
  $ make local      # build for inplace usage
  $ ./hg --version  # should show the latest version
--- a/contrib/chg/Makefile	Wed Aug 02 19:49:57 2017 +0200
+++ b/contrib/chg/Makefile	Thu Aug 10 14:23:41 2017 -0400
@@ -5,7 +5,7 @@
 OBJS = $(SRCS:.c=.o)
 
 CFLAGS ?= -O2 -Wall -Wextra -pedantic -g
-CPPFLAGS ?= -D_FORTIFY_SOURCE=2
+CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
 override CFLAGS += -std=gnu99
 ifdef HGPATH
 override CPPFLAGS += -DHGPATH=\"$(HGPATH)\"
--- a/contrib/docker/centos5	Wed Aug 02 19:49:57 2017 +0200
+++ b/contrib/docker/centos5	Thu Aug 10 14:23:41 2017 -0400
@@ -1,4 +1,7 @@
 FROM centos:centos5
+RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
+RUN sed -i 's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/' /etc/yum.repos.d/*.repo
+RUN sed -i 's/\$releasever/5.11/' /etc/yum.repos.d/*.repo
 RUN yum install -y gcc make rpm-build gettext tar
 RUN yum install -y python-devel python-docutils
 # For creating repo meta data
--- a/hgext/rebase.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/hgext/rebase.py	Thu Aug 10 14:23:41 2017 -0400
@@ -472,7 +472,7 @@
                 commitmsg = self.collapsemsg
             else:
                 commitmsg = 'Collapsed revision'
-                for rebased in self.state:
+                for rebased in sorted(self.state):
                     if rebased not in self.skipped and\
                        self.state[rebased] > nullmerge:
                         commitmsg += '\n* %s' % repo[rebased].description()
--- a/i18n/hggettext	Wed Aug 02 19:49:57 2017 +0200
+++ b/i18n/hggettext	Thu Aug 10 14:23:41 2017 -0400
@@ -112,14 +112,20 @@
 
     for func, rstrip in functions:
         if func.__doc__:
+            funcmod = inspect.getmodule(func)
+            extra = ''
+            if funcmod.__package__ == funcmod.__name__:
+                extra = '/__init__'
+            actualpath = '%s%s.py' % (funcmod.__name__.replace('.', '/'), extra)
+
             src = inspect.getsource(func)
-            name = "%s.%s" % (path, func.__name__)
+            name = "%s.%s" % (actualpath, func.__name__)
             lineno = inspect.getsourcelines(func)[1]
             doc = func.__doc__
             if rstrip:
                 doc = doc.rstrip()
             lineno += offset(src, doc, name, 1)
-            print(poentry(path, lineno, doc))
+            print(poentry(actualpath, lineno, doc))
 
 
 def rawtext(path):
--- a/mercurial/cmdutil.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/mercurial/cmdutil.py	Thu Aug 10 14:23:41 2017 -0400
@@ -26,6 +26,7 @@
     changelog,
     copies,
     crecord as crecordmod,
+    dirstateguard,
     encoding,
     error,
     formatter,
@@ -2889,14 +2890,23 @@
     message = logmessage(ui, opts)
     matcher = scmutil.match(repo[None], pats, opts)
 
+    dsguard = None
     # extract addremove carefully -- this function can be called from a command
     # that doesn't support addremove
-    if opts.get('addremove'):
-        if scmutil.addremove(repo, matcher, "", opts) != 0:
-            raise error.Abort(
-                _("failed to mark all new/missing files as added/removed"))
-
-    return commitfunc(ui, repo, message, matcher, opts)
+    try:
+        if opts.get('addremove'):
+            dsguard = dirstateguard.dirstateguard(repo, 'commit')
+            if scmutil.addremove(repo, matcher, "", opts) != 0:
+                raise error.Abort(
+                    _("failed to mark all new/missing files as added/removed"))
+
+        r = commitfunc(ui, repo, message, matcher, opts)
+        if dsguard:
+            dsguard.close()
+        return r
+    finally:
+        if dsguard:
+            dsguard.release()
 
 def samefile(f, ctx1, ctx2):
     if f in ctx1.manifest():
--- a/mercurial/dispatch.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/mercurial/dispatch.py	Thu Aug 10 14:23:41 2017 -0400
@@ -828,6 +828,7 @@
             color.setup(ui_)
 
         if util.parsebool(options['pager']):
+            # ui.pager() expects 'internal-always-' prefix in this case
             ui.pager('internal-always-' + cmd)
         elif options['pager'] != 'auto':
             ui.disablepager()
--- a/mercurial/pycompat.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/mercurial/pycompat.py	Thu Aug 10 14:23:41 2017 -0400
@@ -16,6 +16,7 @@
 import sys
 
 ispy3 = (sys.version_info[0] >= 3)
+ispypy = (r'__pypy__' in sys.builtin_module_names)
 
 if not ispy3:
     import cookielib
--- a/mercurial/ui.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/mercurial/ui.py	Thu Aug 10 14:23:41 2017 -0400
@@ -945,8 +945,14 @@
                    not "history, "summary" not "summ", etc.
         """
         if (self._disablepager
-            or self.pageractive
-            or command in self.configlist('pager', 'ignore')
+            or self.pageractive):
+            # how pager should do is already determined
+            return
+
+        if not command.startswith('internal-always-') and (
+            # explicit --pager=on (= 'internal-always-' prefix) should
+            # take precedence over disabling factors below
+            command in self.configlist('pager', 'ignore')
             or not self.configbool('ui', 'paginate')
             or not self.configbool('pager', 'attend-' + command, True)
             # TODO: if we want to allow HGPLAINEXCEPT=pager,
@@ -1209,6 +1215,7 @@
         # call write() so output goes through subclassed implementation
         # e.g. color extension on Windows
         self.write(prompt, prompt=True)
+        self.flush()
 
         # instead of trying to emulate raw_input, swap (self.fin,
         # self.fout) with (sys.stdin, sys.stdout)
--- a/mercurial/util.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/mercurial/util.py	Thu Aug 10 14:23:41 2017 -0400
@@ -584,6 +584,14 @@
             del self[key]
         super(sortdict, self).__setitem__(key, value)
 
+    if pycompat.ispypy:
+        # __setitem__() isn't called as of PyPy 5.8.0
+        def update(self, src):
+            if isinstance(src, dict):
+                src = src.iteritems()
+            for k, v in src:
+                self[k] = v
+
 @contextlib.contextmanager
 def acceptintervention(tr=None):
     """A context manager that closes the transaction on InterventionRequired
--- a/tests/pdiff	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/pdiff	Thu Aug 10 14:23:41 2017 -0400
@@ -41,6 +41,9 @@
     diff -u "$file1" "$file2" |
     sed "s@^--- /dev/null\(.*\)\$@--- $1\1@" |
     sed "s@^\+\+\+ /dev/null\(.*\)\$@+++ $2\1@"
+
+    # in this case, files differ from each other
+    return 1
 }
 
 if test -d "$1" -o -d "$2"; then
@@ -53,6 +56,14 @@
     while read file; do
         filediff "$1/$file" "$2/$file" "diff -Nru $1/$file $2/$file"
     done
+
+    # TODO: there is no portable way for current while-read based
+    # implementation to return 1 at detecting changes.
+    #
+    # On bash and dash, assignment to variable inside while-block
+    # doesn't affect outside, because inside while-block is executed
+    # in sub-shell. BTW, it affects outside while-block on ksh (as sh
+    # on Solaris).
 else
     filediff "$1" "$2"
 fi
--- a/tests/test-cache-abuse.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-cache-abuse.t	Thu Aug 10 14:23:41 2017 -0400
@@ -47,21 +47,21 @@
   >  echo bad > $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** overwrite corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption"
   >  echo corruption >> $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** append corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** append corruption"
   >  rm $CACHE
   >  mkdir $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** read-only corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** read-only corruption"
   >  test -d $CACHE || echo "*** directory clobbered"
   >  rmdir $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** missing corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption"
   >  test -f $CACHE || echo "not rebuilt"
   > }
 
--- a/tests/test-commit.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-commit.t	Thu Aug 10 14:23:41 2017 -0400
@@ -147,6 +147,18 @@
   oldhash=bar
   sourcehash=foo
 
+Failed commit with --addremove should not update dirstate
+
+  $ echo foo > newfile
+  $ hg status
+  ? newfile
+  $ HGEDITOR=false hg ci --addremove
+  adding newfile
+  abort: edit failed: false exited with status 1
+  [255]
+  $ hg status
+  ? newfile
+
 Make sure we do not obscure unknown requires file entries (issue2649)
 
   $ echo foo >> foo
--- a/tests/test-extdiff.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-extdiff.t	Thu Aug 10 14:23:41 2017 -0400
@@ -263,8 +263,16 @@
 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
 and start tool
 
+#if windows
+  $ cat > 'diff tool.bat' << EOF
+  > @$PYTHON "`pwd`/diff tool.py"
+  > EOF
+  $ hg extdiff -p "`pwd`/diff tool.bat"
+  [1]
+#else
   $ hg extdiff -p "`pwd`/diff tool.py"
   [1]
+#endif
 
 Diff in working directory, after:
 
--- a/tests/test-extension.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-extension.t	Thu Aug 10 14:23:41 2017 -0400
@@ -245,6 +245,7 @@
 
 #if no-py3k
   $ rm "$TESTTMP"/extroot/foo.*
+  $ rm -Rf "$TESTTMP/extroot/__pycache__"
   $ cat > $TESTTMP/extroot/foo.py <<EOF
   > # test relative import
   > buf = []
@@ -1238,6 +1239,7 @@
 If the extension specifies a buglink, show that:
   $ echo 'buglink = "http://example.com/bts"' >> throw.py
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension throw
   ** which supports versions unknown of Mercurial.
@@ -1253,6 +1255,7 @@
   $ echo "testedwith = '1.9.3'" >> older.py
   $ echo "testedwith = '2.1.1'" >> throw.py
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension older
@@ -1266,6 +1269,7 @@
 One extension only tested with older, one only with newer versions:
   $ echo "util.version = lambda:'2.1'" >> older.py
   $ rm -f older.pyc older.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension older
@@ -1279,6 +1283,7 @@
 Older extension is tested with current version, the other only with newer:
   $ echo "util.version = lambda:'1.9.3'" >> older.py
   $ rm -f older.pyc older.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension throw
@@ -1305,6 +1310,7 @@
   >   echo "unable to fetch a mercurial version. Make sure __version__ is correct";
   > fi
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** unknown exception encountered, please report by visiting
   ** https://mercurial-scm.org/wiki/BugTracker
@@ -1316,6 +1322,7 @@
   $ echo "testedwith = '3.2'" >> throw.py
   $ echo "util.version = lambda:'3.2.2'" >> throw.py
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** unknown exception encountered, please report by visiting
   ** https://mercurial-scm.org/wiki/BugTracker
@@ -1326,6 +1333,7 @@
 Test version number support in 'hg version':
   $ echo '__version__ = (1, 2, 3)' >> throw.py
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg version -v
   Mercurial Distributed SCM (version *) (glob)
   (see https://mercurial-scm.org for more information)
@@ -1350,6 +1358,7 @@
     throw  external  1.2.3
   $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
   $ rm -f throw.pyc throw.pyo
+  $ rm -Rf __pycache__
   $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
   Mercurial Distributed SCM (version *) (glob)
   (see https://mercurial-scm.org for more information)
@@ -1674,7 +1683,7 @@
 
 Even though the extension fails during uisetup, hg is still basically usable:
   $ hg version
-  *** failed to set up extension baduisetup: No module named bdiff
+  \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
   Mercurial Distributed SCM (version *) (glob)
   (see https://mercurial-scm.org for more information)
   
@@ -1696,8 +1705,8 @@
       mod = _hgextimport(_origimport, head, globals, locals, None, level)
     File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob)
       return importfunc(name, globals, *args, **kwargs)
-  ImportError: No module named bdiff
-  *** failed to set up extension baduisetup: No module named bdiff
+  ImportError: No module named (mercurial\.)?bdiff (re)
+  \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re)
   Mercurial Distributed SCM (version *) (glob)
   (see https://mercurial-scm.org for more information)
   
--- a/tests/test-flagprocessor.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-flagprocessor.t	Thu Aug 10 14:23:41 2017 -0400
@@ -152,6 +152,7 @@
   $ hg commit -Aqm 'fail+base64+gzip+noop'
   abort: missing processor for flag '0x1'!
   [255]
+  $ rm fail-base64-gzip-noop
 
 # TEST: ensure we cannot register several flag processors on the same flag
   $ cat >> .hg/hgrc << EOF
@@ -159,11 +160,11 @@
   > extension=$TESTDIR/flagprocessorext.py
   > duplicate=$TESTDIR/flagprocessorext.py
   > EOF
-  $ echo 'this should fail' > file
-  $ hg commit -Aqm 'add file'
+  $ hg debugrebuilddirstate
   *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
-  abort: missing processor for flag '0x1'!
-  [255]
+  $ hg st 2>&1 | egrep 'cannot register multiple processors|flagprocessorext'
+  *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
+    File "*/tests/flagprocessorext.py", line *, in b64decode (glob)
 
   $ cd ..
 
--- a/tests/test-pager.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-pager.t	Thu Aug 10 14:23:41 2017 -0400
@@ -80,6 +80,34 @@
   paged! 'summary:     modify a 10\n'
   paged! '\n'
 
+explicit --pager=on should take precedence over other configurations
+(issue5580)
+
+  $ cat >> $HGRCPATH <<EOF
+  > [ui]
+  > paginate = false
+  > EOF
+  $ hg log --limit 1 --pager=on
+  paged! 'changeset:   10:46106edeeb38\n'
+  paged! 'tag:         tip\n'
+  paged! 'user:        test\n'
+  paged! 'date:        Thu Jan 01 00:00:00 1970 +0000\n'
+  paged! 'summary:     modify a 10\n'
+  paged! '\n'
+
+  $ cat >> $HGRCPATH <<EOF
+  > [ui]
+  > # true is default value of ui.paginate
+  > paginate = true
+  > EOF
+  $ hg log --limit 1 --pager=off
+  changeset:   10:46106edeeb38
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify a 10
+  
+
 We can enable the pager on id:
 
 BROKEN: should be paged
--- a/tests/test-progress.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-progress.t	Thu Aug 10 14:23:41 2017 -0400
@@ -312,6 +312,7 @@
 from each other.
 
   $ rm -f loop.pyc
+  $ rm -Rf __pycache__
   $ cat >> loop.py <<EOF
   > # use non-ascii characters as loop items of progress
   > loopitems = [
--- a/tests/test-revlog-raw.py	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-revlog-raw.py	Thu Aug 10 14:23:41 2017 -0400
@@ -144,12 +144,18 @@
             text = None
             cachedelta = (deltaparent, rlog.revdiff(deltaparent, r))
         flags = rlog.flags(r)
-        ifh = dlog.opener(dlog.indexfile, 'a+')
-        dfh = None
-        if not dlog._inline:
-            dfh = dlog.opener(dlog.datafile, 'a+')
-        dlog._addrevision(rlog.node(r), text, tr, r, p1, p2, flags, cachedelta,
-                          ifh, dfh)
+        ifh = dfh = None
+        try:
+            ifh = dlog.opener(dlog.indexfile, 'a+')
+            if not dlog._inline:
+                dfh = dlog.opener(dlog.datafile, 'a+')
+            dlog._addrevision(rlog.node(r), text, tr, r, p1, p2, flags,
+                              cachedelta, ifh, dfh)
+        finally:
+            if dfh is not None:
+                dfh.close()
+            if ifh is not None:
+                ifh.close()
     return dlog
 
 # Utilities to generate revisions for testing
--- a/tests/test-username-newline.t	Wed Aug 02 19:49:57 2017 +0200
+++ b/tests/test-username-newline.t	Thu Aug 10 14:23:41 2017 -0400
@@ -14,10 +14,12 @@
   $ rm .hg/hgrc
 
   $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
+  adding a
   abort: username 'foo\nbar2' contains a newline
   
   [255]
   $ hg ci -Am m -u "`(echo foo; echo bar3)`"
+  adding a
   transaction abort!
   rollback completed
   abort: username 'foo\nbar3' contains a newline!