merge with stable
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 22 Jan 2019 10:55:45 -0800
changeset 41302 a322dbee4eda
parent 41289 593f6359681d (current diff)
parent 41301 13c23396c7fe (diff)
child 41309 afc33a5705b9
merge with stable
--- a/.hgsigs	Thu Jan 10 14:57:01 2019 +0100
+++ b/.hgsigs	Tue Jan 22 10:55:45 2019 -0800
@@ -174,3 +174,4 @@
 a91a2837150bdcb27ae76b3646e6c93cd6a15904 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlvclPMQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91fc0EADF/62jqCARFaQRRcKpobPNBZupwSbnQ7E296ZRwHdZvT8CVGfkWBUIStyh+r8bfmBzzea6d9/SUoRqCoV9rwCXuRbeCZZRMMkqx9IblV3foaIOxyQi0KE2lpzGJAHxPiNxD3czZV4B+P6X2wNmG9OLjmHyQ7o64GvPAJ+Ko/EsND1tkx4qB16mEuEHVxtfaG6hbjgpLekIA3+3xur3E8cWBsNO28HtQBK83r2qURwv6eG3TfkbmiE+Ie5TNC15LPVhAOHVSD7miZdI82uk2063puCKZxIJXsy7EMjHfChTM9c7B4+TdEBjms3y+Byz2EV7kRfjplGOnBbYvfY7qiteTn/22+rLrTTQNkndDN/Sqr1DjwsvxKDeIfsqgXzGQPupLOrGdGf4ILAtA0Reme7VKNN5Px6dNxnjKKwsnSrKTQ7ZcmD+W1LKlL63lBEQvEy+TLmmFLfM2xvvBxL5177AKZrj/8gMUzEi1K2MelDGrasA7OSjTlABoleDvZzVOf1nC0Bv83tFc8FeMHLwNOxkFSsjORvZuIH/G9BYUTAd96iLwQRBxXLOVNitxAOQT+s3hs7JEaUzTHlAY+lNeFAxUujb4H0V40Xgr20O1u7PJ53tzApIrg9JQPgvUXntmRs8fpNo6f3P6Sg8XtaCCHIUAB6qTHiose56llf6bzl66A==
 1c8c54cf97256f4468da2eb4dbee24f7f3888e71 0 iQJEBAABCAAuFiEEK8zh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XYbZrpmQ1j4bpOZCEMqWXPfl4HY7a60hWa884mWxtVLGvhYycxnN8r1o5ouS0pAMAI6qEFFW1XFFN4eNDDWl83BkuDa32DTEthoyi15JM5jS7VPDYACdHE3IVqsTsZq7nn60uoFCGpdMcSqrD2mlUd9Z12x8NnCIrxKhlHLkq89OrQAcz8/0bbluGuzm3FHKb+8VQWr0MgkvOLTqqvOqn97oBdKqo0eyT0IPz8QeVYPbZfQ==
--- a/.hgtags	Thu Jan 10 14:57:01 2019 +0100
+++ b/.hgtags	Tue Jan 22 10:55:45 2019 -0800
@@ -187,3 +187,4 @@
 a91a2837150bdcb27ae76b3646e6c93cd6a15904 4.8
 1c8c54cf97256f4468da2eb4dbee24f7f3888e71 4.8.1
 197f092b2cd9691e2a55d198f717b231af9be6f9 4.8.2
+593718ff5844cad7a27ee3eb5adad89ac8550949 4.9rc0
--- a/mercurial/configitems.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/configitems.py	Tue Jan 22 10:55:45 2019 -0800
@@ -556,6 +556,9 @@
 coreconfigitem('experimental', 'mergetempdirprefix',
     default=None,
 )
+coreconfigitem('experimental', 'mmapindexthreshold',
+    default=None,
+)
 coreconfigitem('experimental', 'narrow',
     default=False,
 )
@@ -987,10 +990,6 @@
 coreconfigitem('push', 'pushvars.server',
     default=False,
 )
-coreconfigitem('storage', 'mmap-threshold',
-    default='1MB',
-    alias=[('experimental', 'mmapindexthreshold')],
-)
 coreconfigitem('rewrite', 'backup-bundle',
     default=True,
     alias=[('ui', 'history-editing-backup')],
--- a/mercurial/help/internals/extensions.txt	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/help/internals/extensions.txt	Tue Jan 22 10:55:45 2019 -0800
@@ -28,11 +28,16 @@
 
 Example using ``@command`` decorator (requires Mercurial 1.9)::
 
-    from mercurial import cmdutil
     from mercurial.i18n import _
 
     cmdtable = {}
-    command = cmdutil.command(cmdtable)
+    try:
+        from mercurial import registrar
+        command = registrar.command(cmdtable)
+    except (AttributeError, ImportError):
+        # Fallback to hg < 4.3 support
+        from mercurial import cmdutil
+        command = cmdutil.command(cmdtable)
 
     @command('print-parents',
         [('s', 'short', None, _('print short form')),
@@ -308,6 +313,14 @@
 
     buglink = 'https://bitbucket.org/USER/REPO/issues'
 
+If an extension requires a minimum version of Mercurial, it can be declared
+with the ``minimumhgversion`` variable::
+
+    minimumhgversion = '4.6'
+
+Older clients will print a warning that the extension requires a new version,
+instead of attempting to load it.
+
 Wrap up: what belongs where?
 ============================
 
--- a/mercurial/localrepo.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/localrepo.py	Tue Jan 22 10:55:45 2019 -0800
@@ -758,7 +758,8 @@
     if 0 <= chainspan:
         options[b'maxdeltachainspan'] = chainspan
 
-    mmapindexthreshold = ui.configbytes(b'storage', b'mmap-threshold')
+    mmapindexthreshold = ui.configbytes(b'experimental',
+                                        b'mmapindexthreshold')
     if mmapindexthreshold is not None:
         options[b'mmapindexthreshold'] = mmapindexthreshold
 
--- a/mercurial/narrowspec.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/narrowspec.py	Tue Jan 22 10:55:45 2019 -0800
@@ -190,12 +190,14 @@
 def restorewcbackup(repo, backupname):
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return
-    util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
+    # It may not exist in old repos
+    if repo.vfs.exists(backupname):
+        util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
 
 def clearwcbackup(repo, backupname):
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return
-    repo.vfs.unlink(backupname)
+    repo.vfs.tryunlink(backupname)
 
 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
     r""" Restricts the patterns according to repo settings,
--- a/mercurial/revlog.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/revlog.py	Tue Jan 22 10:55:45 2019 -0800
@@ -896,6 +896,8 @@
             common = [nullrev]
 
         if rustext is not None:
+            # TODO: WdirUnsupported should be raised instead of GraphError
+            # if common includes wdirrev
             return rustext.ancestor.MissingAncestors(self.index, common)
         return ancestor.incrementalmissingancestors(self.parentrevs, common)
 
--- a/mercurial/revset.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/revset.py	Tue Jan 22 10:55:45 2019 -0800
@@ -1765,6 +1765,20 @@
         return baseset()
     return subset & baseset([l])
 
+@predicate('_rev(number)', safe=True)
+def _rev(repo, subset, x):
+    # internal version of "rev(x)" that raise error if "x" is invalid
+    # i18n: "rev" is a keyword
+    l = getargs(x, 1, 1, _("rev requires one argument"))
+    try:
+        # i18n: "rev" is a keyword
+        l = int(getstring(l[0], _("rev requires a number")))
+    except (TypeError, ValueError):
+        # i18n: "rev" is a keyword
+        raise error.ParseError(_("rev expects a number"))
+    repo.changelog.node(l) # check that the rev exists
+    return subset & baseset([l])
+
 @predicate('revset(set)', safe=True, takeorder=True)
 def revsetpredicate(repo, subset, x, order):
     """Strictly interpret the content as a revset.
--- a/mercurial/revsetlang.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/revsetlang.py	Tue Jan 22 10:55:45 2019 -0800
@@ -585,7 +585,7 @@
 
 def _formatargtype(c, arg):
     if c == 'd':
-        return 'rev(%d)' % int(arg)
+        return '_rev(%d)' % int(arg)
     elif c == 's':
         return _quote(arg)
     elif c == 'r':
@@ -663,9 +663,9 @@
     >>> formatspec(b'%r:: and %lr', b'10 or 11', (b"this()", b"that()"))
     '(10 or 11):: and ((this()) or (that()))'
     >>> formatspec(b'%d:: and not %d::', 10, 20)
-    'rev(10):: and not rev(20)::'
+    '_rev(10):: and not _rev(20)::'
     >>> formatspec(b'%ld or %ld', [], [1])
-    "_list('') or rev(1)"
+    "_list('') or _rev(1)"
     >>> formatspec(b'keyword(%s)', b'foo\\xe9')
     "keyword('foo\\\\xe9')"
     >>> b = lambda: b'default'
--- a/mercurial/templatekw.py	Thu Jan 10 14:57:01 2019 +0100
+++ b/mercurial/templatekw.py	Tue Jan 22 10:55:45 2019 -0800
@@ -81,8 +81,15 @@
                     pdate, pdist, ptag = max(ptags)
                 else:
                     def key(x):
-                        changessincetag = len(repo.revs('only(%d, %s)',
-                                                        ctx.rev(), x[2][0]))
+                        tag = x[2][0]
+                        if ctx.rev() is None:
+                            # only() doesn't support wdir
+                            prevs = [c.rev() for c in ctx.parents()]
+                            changes = repo.revs('only(%ld, %s)', prevs, tag)
+                            changessincetag = len(changes) + 1
+                        else:
+                            changes = repo.revs('only(%d, %s)', ctx.rev(), tag)
+                            changessincetag = len(changes)
                         # Smallest number of changes since tag wins. Date is
                         # used as tiebreaker.
                         return [-changessincetag, x[0]]
--- a/tests/test-narrow-share.t	Thu Jan 10 14:57:01 2019 +0100
+++ b/tests/test-narrow-share.t	Tue Jan 22 10:55:45 2019 -0800
@@ -166,7 +166,7 @@
   R d7/f
 Make it look like a repo from before narrow+share was supported
   $ rm .hg/narrowspec.dirstate
-  $ hg st
+  $ hg ci -Am test
   abort: working copy's narrowspec is stale
   (run 'hg tracked --update-working-copy')
   [255]
--- a/tests/test-template-keywords.t	Thu Jan 10 14:57:01 2019 +0100
+++ b/tests/test-template-keywords.t	Tue Jan 22 10:55:45 2019 -0800
@@ -1056,6 +1056,41 @@
   o  0: null+1,1
   
 
+Tags of working-directory parents (issue6055):
+
+  $ hg update -q 3
+  $ echo a > head3
+  $ hg ci -qAm h3a
+  $ hg merge -q 2
+  $ hg log -Gr'::wdir()' -T "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+  o    2147483647: at3+2,3 t3+2,3
+  |\
+  | @  12: at3+1,1 t3+1,1
+  | |
+  | o  3: at3+0,0 t3+0,0
+  | |
+  @ |  2: t2+0,0
+  |/
+  o  1: t1+0,0
+  |
+  o  0: null+1,1
+  
+
+  $ hg ci -m merge
+  $ hg log -Gr'::.' -T "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+  @    13: at3+2,3 t3+2,3
+  |\
+  | o  12: at3+1,1 t3+1,1
+  | |
+  | o  3: at3+0,0 t3+0,0
+  | |
+  o |  2: t2+0,0
+  |/
+  o  1: t1+0,0
+  |
+  o  0: null+1,1
+  
+
   $ cd ..
 
 Set up repository containing template fragments in commit metadata: