merge: with stable
authorAugie Fackler <augie@google.com>
Fri, 12 Mar 2021 13:13:13 -0500
changeset 46675 6f4a481f182a
parent 46674 79cfe18c20b5 (current diff)
parent 46574 ed3fb1ae5ab1 (diff)
child 46676 b41f551c5dc7
merge: with stable
mercurial/filelog.py
mercurial/helptext/config.txt
mercurial/localrepo.py
mercurial/logcmdutil.py
mercurial/util.py
tests/test-log.t
--- a/.hgsigs	Wed Mar 10 18:24:23 2021 +0100
+++ b/.hgsigs	Fri Mar 12 13:13:13 2021 -0500
@@ -207,3 +207,4 @@
 1d5189a57405ceca5aa244052c9f948977f4699b 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAl/JMCcQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91d8VEADPmycxSrG/9WClJrXrZXVugf2Bp6SiKWarCWmZQ32sh/Xkl6Km8I6uVQL0k82lQO71jOin6APY2HJeOC57mBeX9HOPcN/l+I8g4HecdI6UO8+tQzPqzno92Nm+tj0XxSelmMZ1KwDYpiHBo8F9VMILTZSdFdC5zBBMQOHhJDAtIUJx5W8n2/mcDvFEpv5OHqS2kYzHHqn9/V+J6iOweP2ftd3N84EZZHb7e8hYbLHS1aNJRe7SsruCYJujHr8Ym5izl5YTpwvVCvudbK/OnrFd0MqT3oRS8WRPwwYcYJkj5AtDLA0VLbx47KeR0vLCC7hTkFoOtFtxc7WIJOZVb/DPi38UsSJLG2tFuSvnW8b1YBCUD5o39F/4FxUuug/JxEG3nvP0Hf6PbPiAn/ZPJqNOyyY51YfjAaAGZeP+UNM4OgOdsSq1gAcCQEMclb54YuRe/J/fuBkQVKbaPuVYPCypqdc/KppS9hZzD3R3OEiztNXqn8u2tl33qsvdEJBlZq9NCD/wJMIzKC/6I5YNkYtgdfAH+xhqHgPvohGyc5q7jS8UvfIl6Wro8e+nWEXkOv2yQSU8nq/5hcyQj5SctznUxArpAt7CbNmGze42t29EdrP4P5w2K6t1lELUw1SVjzt/j9Xc5k/sDj4M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ZnQB6JhgOSCjfcLD5ZFl8GiRiz84ZT3ges5RTyVcE6jJNUV+nwmNdW2qLQP9JydInKNwTrEgZcrJDv6i+lu519p8+zcOgIF1J+CO8qQaq3+j5MA4Dttat3anWOQNIzbx4yuG75NezVN3jnRGmoSGwg1YLseqjQCBlpJrBWTD1SsuWpgbKx4EiELDN+PcDovxB2pYa+NzFfv0ZFcnWuLpr6KjCgzBkTK5KfmTqu7I+eM29g+2JvmCao+kk8MVyVmV9H2f5xRvuhrEBmDNlLb7uOhJW3a7EvZG6g9EfW9
--- a/.hgtags	Wed Mar 10 18:24:23 2021 +0100
+++ b/.hgtags	Fri Mar 12 13:13:13 2021 -0500
@@ -220,3 +220,4 @@
 1d5189a57405ceca5aa244052c9f948977f4699b 5.6.1
 9da65e3cf3706ff41e08b311381c588440c27baf 5.7rc0
 0e2e7300f4302b02412b0b734717697049494c4c 5.7
+d5d9177c0045d206db575bae6daa98e2cb2fe5bc 5.7.1
--- a/mercurial/filelog.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/filelog.py	Fri Mar 12 13:13:13 2021 -0500
@@ -280,14 +280,12 @@
             return super(narrowfilelog, self).size(rev)
 
     def cmp(self, node, text):
-        different = super(narrowfilelog, self).cmp(node, text)
+        # We don't call `super` because narrow parents can be buggy in case of a
+        # ambiguous dirstate. Always take the slow path until there is a better
+        # fix, see issue6150.
 
-        # Because renamed() may lie, we may get false positives for
-        # different content. Check for this by comparing against the original
-        # renamed() implementation.
-        if different:
-            if super(narrowfilelog, self).renamed(node):
-                t2 = self.read(node)
-                return t2 != text
+        # Censored files compare against the empty file.
+        if self.iscensored(self.rev(node)):
+            return text != b''
 
-        return different
+        return self.read(node) != text
--- a/mercurial/helptext/config.txt	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/helptext/config.txt	Fri Mar 12 13:13:13 2021 -0500
@@ -1032,7 +1032,7 @@
   incoming.autobuild:run-with-plain = yes
   # HGPLAIN never set
   incoming.autobuild:run-with-plain = no
-  # HGPLAIN inherited from environment (default before Mercurila 5.7)
+  # HGPLAIN inherited from environment (default before Mercurial 5.7)
   incoming.autobuild:run-with-plain = auto
 
 Most hooks are run with environment variables set that give useful
--- a/mercurial/localrepo.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/localrepo.py	Fri Mar 12 13:13:13 2021 -0500
@@ -543,7 +543,7 @@
         except ValueError as e:
             # Can be raised on Python 3.8 when path is invalid.
             raise error.Abort(
-                _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
+                _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
             )
 
         raise error.RepoError(_(b'repository %s not found') % path)
@@ -571,7 +571,7 @@
     # repository was shared the old way. We check the share source .hg/requires
     # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
     # to be reshared
-    hint = _("see `hg help config.format.use-share-safe` for more information")
+    hint = _(b"see `hg help config.format.use-share-safe` for more information")
     if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
 
         if (
@@ -1137,7 +1137,7 @@
     """File storage when using revlogs."""
 
     def file(self, path):
-        if path[0] == b'/':
+        if path.startswith(b'/'):
             path = path[1:]
 
         return filelog.filelog(self.svfs, path)
@@ -1148,7 +1148,7 @@
     """File storage when using revlogs and narrow files."""
 
     def file(self, path):
-        if path[0] == b'/':
+        if path.startswith(b'/'):
             path = path[1:]
 
         return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
--- a/mercurial/logcmdutil.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/logcmdutil.py	Fri Mar 12 13:13:13 2021 -0500
@@ -876,7 +876,7 @@
         # slowpath; otherwise, we can turn off the slowpath
         if slowpath:
             for path in match.files():
-                if path == b'.' or path in repo.store:
+                if not path or path in repo.store:
                     break
             else:
                 slowpath = False
--- a/mercurial/patch.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/patch.py	Fri Mar 12 13:13:13 2021 -0500
@@ -20,6 +20,7 @@
 from .i18n import _
 from .node import (
     hex,
+    nullhex,
     short,
 )
 from .pycompat import open
@@ -3099,12 +3100,12 @@
 
     ctx1, fctx1, path1, flag1, content1, date1 = data1
     ctx2, fctx2, path2, flag2, content2, date2 = data2
+    index1 = _gitindex(content1) if path1 in ctx1 else nullhex
+    index2 = _gitindex(content2) if path2 in ctx2 else nullhex
     if binary and opts.git and not opts.nobinary:
         text = mdiff.b85diff(content1, content2)
         if text:
-            header.append(
-                b'index %s..%s' % (_gitindex(content1), _gitindex(content2))
-            )
+            header.append(b'index %s..%s' % (index1, index2))
         hunks = ((None, [text]),)
     else:
         if opts.git and opts.index > 0:
@@ -3114,8 +3115,8 @@
             header.append(
                 b'index %s..%s %s'
                 % (
-                    _gitindex(content1)[0 : opts.index],
-                    _gitindex(content2)[0 : opts.index],
+                    index1[0 : opts.index],
+                    index2[0 : opts.index],
                     _gitmode[flag],
                 )
             )
--- a/mercurial/pycompat.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/pycompat.py	Fri Mar 12 13:13:13 2021 -0500
@@ -510,7 +510,7 @@
 # This wrapper file are always open in byte mode.
 def unnamedtempfile(mode=None, *args, **kwargs):
     if mode is None:
-        mode = b'w+b'
+        mode = 'w+b'
     else:
         mode = sysstr(mode)
     assert 'b' in mode
--- a/mercurial/util.py	Wed Mar 10 18:24:23 2021 +0100
+++ b/mercurial/util.py	Fri Mar 12 13:13:13 2021 -0500
@@ -2185,7 +2185,7 @@
         global _re2
         try:
             # check if match works, see issue3964
-            _re2 = bool(re2.match(r'\[([^\[]+)\]', b'[ui]'))
+            _re2 = bool(re2.match(br'\[([^\[]+)\]', b'[ui]'))
         except ImportError:
             _re2 = False
 
--- a/tests/test-diff-unified.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-diff-unified.t	Fri Mar 12 13:13:13 2021 -0500
@@ -456,3 +456,26 @@
     .
 
   $ cd ..
+
+Make sure `hg diff --git` differentiate "file did not exists" and "file is empty"
+for git blob oids
+
+  $ hg init bloboids
+  $ cd bloboids
+
+  $ touch a
+  $ hg ci -Am "empty a"
+  adding a
+  $ hg diff -c 0 --git --config experimental.extendedheader.index=full | grep index
+  index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
+
+Make sure `hg diff --git` differentiate "file was empty" and "file is removed"
+for git blob oids
+
+  $ rm a
+  $ hg ci -Am "removed a"
+  removing a
+  $ hg diff -c 1 --git --config experimental.extendedheader.index=full | grep index
+  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 100644
+
+  $ cd ..
--- a/tests/test-diff-upgrade.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-diff-upgrade.t	Fri Mar 12 13:13:13 2021 -0500
@@ -185,7 +185,7 @@
   % git=auto: git diff for newbinary
   diff --git a/newbinary b/newbinary
   new file mode 100644
-  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d
+  index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d
   GIT binary patch
   literal 1
   Ic${MZ000310RR91
@@ -202,7 +202,7 @@
   % git=auto: git diff for rmbinary
   diff --git a/rmbinary b/rmbinary
   deleted file mode 100644
-  index f76dd238ade08917e6712764a16a22005a50573d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+  index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000
   GIT binary patch
   literal 0
   Hc$@<O00001
--- a/tests/test-diffstat.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-diffstat.t	Fri Mar 12 13:13:13 2021 -0500
@@ -111,7 +111,7 @@
   
   diff --git c c
   new file mode 100644
-  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d
+  index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d
   GIT binary patch
   literal 1
   Ic${MZ000310RR91
--- a/tests/test-git-export.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-git-export.t	Fri Mar 12 13:13:13 2021 -0500
@@ -346,7 +346,7 @@
   $ cat b.diff
   diff --git a/binfile.bin b/binfile.bin
   new file mode 100644
-  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
+  index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
   GIT binary patch
   literal 593
   zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
--- a/tests/test-log-linerange.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-log-linerange.t	Fri Mar 12 13:13:13 2021 -0500
@@ -1114,7 +1114,7 @@
   
   diff --git a/dir/binary b/dir/binary
   new file mode 100644
-  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45
+  index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
   GIT binary patch
   literal 17
   Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
--- a/tests/test-log.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-log.t	Fri Mar 12 13:13:13 2021 -0500
@@ -102,6 +102,41 @@
   summary:     c
   
 
+log empty path (or repo root) of slow path shouldn't crash (issue6478)
+
+  $ hg log -ql1 '' inexistent
+  4:7e4639b4691b
+  $ hg log -ql1 . inexistent
+  4:7e4639b4691b
+  $ hg log -ql1 "`pwd`" inexistent
+  4:7e4639b4691b
+
+  $ hg log -ql1 '' e
+  4:7e4639b4691b
+  $ hg log -ql1 . e
+  4:7e4639b4691b
+  $ hg log -ql1 "`pwd`" e
+  4:7e4639b4691b
+
+log -f empty path (or repo root) shouldn't crash
+
+  $ hg log -qfl1 '' inexistent
+  abort: cannot follow file not in parent revision: "inexistent"
+  [255]
+  $ hg log -qfl1 . inexistent
+  abort: cannot follow file not in parent revision: "inexistent"
+  [255]
+  $ hg log -qfl1 "`pwd`" inexistent
+  abort: cannot follow file not in parent revision: "inexistent"
+  [255]
+
+  $ hg log -qfl1 '' e
+  4:7e4639b4691b
+  $ hg log -qfl1 . e
+  4:7e4639b4691b
+  $ hg log -qfl1 "`pwd`" e
+  4:7e4639b4691b
+
 -X, with explicit path
 
   $ hg log a -X a
--- a/tests/test-narrow-shallow.t	Wed Mar 10 18:24:23 2021 +0100
+++ b/tests/test-narrow-shallow.t	Fri Mar 12 13:13:13 2021 -0500
@@ -92,28 +92,8 @@
   1: Commit rev2 of f8, d1/f8, d2/f8
   0...: Commit rev2 of f7, d1/f7, d2/f7
 
-XXX flaky output (see issue6150)
-XXX
-XXX The filectx implementation is buggy and return wrong data during status.
-XXX Leading to more file being "merged". The right output is the one with just
-XXX 10 files updated.
-
   $ hg update 4
-  merging d2/f1 (?)
-  merging d2/f2 (?)
-  merging d2/f3 (?)
-  merging d2/f4 (?)
-  merging d2/f5 (?)
-  merging d2/f6 (?)
-  merging d2/f7 (?)
-  3 files updated, 7 files merged, 0 files removed, 0 files unresolved (?)
-  4 files updated, 6 files merged, 0 files removed, 0 files unresolved (?)
-  5 files updated, 5 files merged, 0 files removed, 0 files unresolved (?)
-  6 files updated, 4 files merged, 0 files removed, 0 files unresolved (?)
-  7 files updated, 3 files merged, 0 files removed, 0 files unresolved (?)
-  8 files updated, 2 files merged, 0 files removed, 0 files unresolved (?)
-  9 files updated, 1 files merged, 0 files removed, 0 files unresolved (?)
-  10 files updated, 0 files merged, 0 files removed, 0 files unresolved (?)
+  10 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat d2/f7 d2/f8
   d2/f7 rev3
   d2/f8 rev2