changeset 45268:5780a04a1b46

merge stable in default
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 31 Jul 2020 17:09:31 +0530
parents e0bfde04f957 (current diff) 53a6febafc66 (diff)
children ad7006830106
files tests/test-rebase-inmemory.t
diffstat 11 files changed, 399 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/infinitepush/store.py	Thu Jul 30 01:10:10 2020 +0200
+++ b/hgext/infinitepush/store.py	Fri Jul 31 17:09:31 2020 +0530
@@ -8,7 +8,6 @@
 import abc
 import os
 import subprocess
-import tempfile
 
 from mercurial.pycompat import open
 from mercurial import (
--- a/hgext/rebase.py	Thu Jul 30 01:10:10 2020 +0200
+++ b/hgext/rebase.py	Fri Jul 31 17:09:31 2020 +0530
@@ -1442,6 +1442,10 @@
     if b'branch' in extra:
         branch = extra[b'branch']
 
+    # FIXME: We call _compact() because it's required to correctly detect
+    # changed files. This was added to fix a regression shortly before the 5.5
+    # release. A proper fix will be done in the default branch.
+    wctx._compact()
     memctx = wctx.tomemctx(
         commitmsg,
         date=date,
--- a/mercurial/context.py	Thu Jul 30 01:10:10 2020 +0200
+++ b/mercurial/context.py	Fri Jul 31 17:09:31 2020 +0530
@@ -2530,6 +2530,43 @@
     def clean(self):
         self._cache = {}
 
+    def _compact(self):
+        """Removes keys from the cache that are actually clean, by comparing
+        them with the underlying context.
+
+        This can occur during the merge process, e.g. by passing --tool :local
+        to resolve a conflict.
+        """
+        keys = []
+        # This won't be perfect, but can help performance significantly when
+        # using things like remotefilelog.
+        scmutil.prefetchfiles(
+            self.repo(),
+            [
+                (
+                    self.p1().rev(),
+                    scmutil.matchfiles(self.repo(), self._cache.keys()),
+                )
+            ],
+        )
+
+        for path in self._cache.keys():
+            cache = self._cache[path]
+            try:
+                underlying = self._wrappedctx[path]
+                if (
+                    underlying.data() == cache[b'data']
+                    and underlying.flags() == cache[b'flags']
+                ):
+                    keys.append(path)
+            except error.ManifestLookupError:
+                # Path not in the underlying manifest (created).
+                continue
+
+        for path in keys:
+            del self._cache[path]
+        return keys
+
     def _markdirty(
         self, path, exists, data=None, date=None, flags=b'', copied=None
     ):
--- a/mercurial/exchange.py	Thu Jul 30 01:10:10 2020 +0200
+++ b/mercurial/exchange.py	Fri Jul 31 17:09:31 2020 +0530
@@ -905,32 +905,27 @@
         # if repo.obsstore == False --> no obsolete
         # then, save the iteration
         if unfi.obsstore:
-            obsoletes = []
-            unstables = []
-            for node in outgoing.missing:
+            # this message are here for 80 char limit reason
+            mso = _(b"push includes obsolete changeset: %s!")
+            mspd = _(b"push includes phase-divergent changeset: %s!")
+            mscd = _(b"push includes content-divergent changeset: %s!")
+            mst = {
+                b"orphan": _(b"push includes orphan changeset: %s!"),
+                b"phase-divergent": mspd,
+                b"content-divergent": mscd,
+            }
+            # If we are to push if there is at least one
+            # obsolete or unstable changeset in missing, at
+            # least one of the missinghead will be obsolete or
+            # unstable. So checking heads only is ok
+            for node in outgoing.ancestorsof:
                 ctx = unfi[node]
                 if ctx.obsolete():
-                    obsoletes.append(ctx)
+                    raise error.Abort(mso % ctx)
                 elif ctx.isunstable():
-                    unstables.append(ctx)
-            if obsoletes or unstables:
-                msg = b""
-                if obsoletes:
-                    msg += _(b"push includes obsolete changesets:\n")
-                    msg += b"\n".join(b'  %s' % ctx for ctx in obsoletes)
-                if unstables:
-                    if msg:
-                        msg += b"\n"
-                    msg += _(b"push includes unstable changesets:\n")
-                    msg += b"\n".join(
-                        b'  %s (%s)'
-                        % (
-                            ctx,
-                            b", ".join(_(ins) for ins in ctx.instabilities()),
-                        )
-                        for ctx in unstables
-                    )
-                raise error.Abort(msg)
+                    # TODO print more than one instability in the abort
+                    # message
+                    raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
         discovery.checkheads(pushop)
     return True
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relnotes/5.5	Fri Jul 31 17:09:31 2020 +0530
@@ -0,0 +1,80 @@
+== New Features ==
+
+ * clonebundles can be annotated with the expected memory requirements
+   using the `REQUIREDRAM` option. This allows clients to skip
+   bundles created with large zstd windows and fallback to larger, but
+   less demanding bundles.
+
+ * The `phabricator` extension now provides more functionality of the
+   arcanist CLI like changing the status of a differential.
+
+ * Phases processing is much faster, especially for repositories with
+   old non-public changesets.
+
+
+== New Experimental Features ==
+
+ * The core of some hg operations have been (and are being)
+   implemented in rust, for speed. `hg status` on a repository with
+   300k tracked files goes from 1.8s to 0.6s for instance.
+   This has currently been tested only on linux, and does not build on
+   windows. See rust/README.rst in the mercurial repository for
+   instructions to opt into this.
+
+ * An experimental config `rewrite.empty-successor` was introduced to control
+   what happens when rewrite operations result in empty changesets.
+
+
+== Bug Fixes ==
+
+ * For the case when connected to a TTY, stdout was fixed to be line-buffered
+   on Python 3 (where it was block-buffered before, causing the process to seem
+   hanging) and Windows on Python 2 (where it was unbuffered before).
+
+ * Subversion sources of the convert extension were fixed to work on Python 3.
+
+ * Subversion sources of the convert extension now interpret the encoding of
+   URLs like Subversion. Previously, there were situations where the convert
+   extension recognized a repository as present but Subversion did not, and
+   vice versa.
+
+ * The empty changeset check of in-memory rebases was fixed to match that of
+   normal rebases (and that of the commit command).
+
+ * The push command now checks the correct set of outgoing changesets for
+   obsolete and unstable changesets. Previously, it could happen that the check
+   prevented pushing changesets which were already on the server.
+
+
+== Backwards Compatibility Changes ==
+
+ * Mercurial now requires at least Python 2.7.9 or a Python version that
+   backported modern SSL/TLS features (as defined in PEP 466), and that Python
+   was compiled against a OpenSSL version supporting TLS 1.1 or TLS 1.2
+   (likely this requires the OpenSSL version to be at least 1.0.1).
+ 
+ * The `hg perfwrite` command from contrib/perf.py was made more flexible and
+   changed its default behavior. To get the previous behavior, run `hg perfwrite
+   --nlines=100000 --nitems=1 --item='Testing write performance' --batch-line`.
+
+ * The absorb extension now preserves changesets with no file changes that can
+   be created by the commit command (those which change the branch name
+   compared to the parent and those closing a branch head).
+
+
+== Internal API Changes ==
+
+ * logcmdutil.diffordiffstat() now takes contexts instead of nodes.
+
+ * The `mergestate` class along with some related methods and constants have
+   moved from `mercurial.merge` to a new `mercurial.mergestate` module.
+
+ * The `phasecache` class now uses sparse dictionaries for the phase data.
+   New accessors are provided to detect if any non-public changeset exists
+   (`hasnonpublicphases`) and get the correponsponding root set
+   (`nonpublicphaseroots`).
+
+ * The `stdin`, `stdout` and `stderr` attributes of the `mercurial.pycompat`
+   module were removed. Instead, the attributes of same name from the
+   `mercurial.utils.procutil` module should be used, which provide more
+   consistent behavior across Python versions and platforms.
--- a/relnotes/next	Thu Jul 30 01:10:10 2020 +0200
+++ b/relnotes/next	Fri Jul 31 17:09:31 2020 +0530
@@ -1,80 +1,18 @@
 == New Features ==
 
- * clonebundles can be annotated with the expected memory requirements
-   using the `REQUIREDRAM` option. This allows clients to skip
-   bundles created with large zstd windows and fallback to larger, but
-   less demanding bundles.
-
- * The `phabricator` extension now provides more functionality of the
-   arcanist CLI like changing the status of a differential.
-
- * Phases processing is much faster, especially for repositories with
-   old non-public changesets.
 
 
 == New Experimental Features ==
 
- * The core of some hg operations have been (and are being)
-   implemented in rust, for speed. `hg status` on a repository with
-   300k tracked files goes from 1.8s to 0.6s for instance.
-   This has currently been tested only on linux, and does not build on
-   windows. See rust/README.rst in the mercurial repository for
-   instructions to opt into this.
-
- * An experimental config `rewrite.empty-successor` was introduced to control
-   what happens when rewrite operations result in empty changesets.
 
 
 == Bug Fixes ==
 
- * For the case when connected to a TTY, stdout was fixed to be line-buffered
-   on Python 3 (where it was block-buffered before, causing the process to seem
-   hanging) and Windows on Python 2 (where it was unbuffered before).
-
- * Subversion sources of the convert extension were fixed to work on Python 3.
-
- * Subversion sources of the convert extension now interpret the encoding of
-   URLs like Subversion. Previously, there were situations where the convert
-   extension recognized a repository as present but Subversion did not, and
-   vice versa.
-
- * The empty changeset check of in-memory rebases was fixed to match that of
-   normal rebases (and that of the commit command).
-
- * The push command now checks the correct set of outgoing changesets for
-   obsolete and unstable changesets. Previously, it could happen that the check
-   prevented pushing changesets which were already on the server.
 
 
 == Backwards Compatibility Changes ==
 
- * Mercurial now requires at least Python 2.7.9 or a Python version that
-   backported modern SSL/TLS features (as defined in PEP 466), and that Python
-   was compiled against a OpenSSL version supporting TLS 1.1 or TLS 1.2
-   (likely this requires the OpenSSL version to be at least 1.0.1).
- 
- * The `hg perfwrite` command from contrib/perf.py was made more flexible and
-   changed its default behavior. To get the previous behavior, run `hg perfwrite
-   --nlines=100000 --nitems=1 --item='Testing write performance' --batch-line`.
-
- * The absorb extension now preserves changesets with no file changes that can
-   be created by the commit command (those which change the branch name
-   compared to the parent and those closing a branch head).
 
 
 == Internal API Changes ==
 
- * logcmdutil.diffordiffstat() now takes contexts instead of nodes.
-
- * The `mergestate` class along with some related methods and constants have
-   moved from `mercurial.merge` to a new `mercurial.mergestate` module.
-
- * The `phasecache` class now uses sparse dictionaries for the phase data.
-   New accessors are provided to detect if any non-public changeset exists
-   (`hasnonpublicphases`) and get the correponsponding root set
-   (`nonpublicphaseroots`).
-
- * The `stdin`, `stdout` and `stderr` attributes of the `mercurial.pycompat`
-   module were removed. Instead, the attributes of same name from the
-   `mercurial.utils.procutil` module should be used, which provide more
-   consistent behavior across Python versions and platforms.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-obsolete-check-push.t	Fri Jul 31 17:09:31 2020 +0530
@@ -0,0 +1,236 @@
+=======================================================
+Test check for obsolescence and instability during push
+=======================================================
+
+  $ . $TESTDIR/testlib/obsmarker-common.sh
+
+  $ cat >> $HGRCPATH << EOF
+  > [phases]
+  > publish=false
+  > [experimental]
+  > evolution = all
+  > EOF
+
+
+Tests that pushing orphaness to the server is detected
+======================================================
+
+initial setup
+
+  $ mkdir base
+  $ cd base
+  $ hg init server
+  $ cd server
+  $ mkcommit root
+  $ hg phase --public .
+  $ mkcommit commit_A0_
+  $ mkcommit commit_B0_
+  $ cd ..
+  $ hg init client
+  $ cd client
+  $ echo '[paths]' >> .hg/hgrc
+  $ echo 'default=../server' >> .hg/hgrc
+  $ hg pull
+  pulling from $TESTTMP/base/server
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files
+  new changesets 1e4be0697311:c09d8ab29fda (2 drafts)
+  (run 'hg update' to get a working copy)
+  $ hg up 'desc("root")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(having some unrelated change affects discovery result, we should ideally test both case)
+  $ hg branch unrelated --quiet
+  $ mkcommit unrelated
+  $ hg up null
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg log -G
+  o  changeset:   3:16affbe0f986
+  |  branch:      unrelated
+  |  tag:         tip
+  |  parent:      0:1e4be0697311
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     unrelated
+  |
+  | o  changeset:   2:c09d8ab29fda
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     commit_B0_
+  | |
+  | o  changeset:   1:37624bf21024
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     root
+  
+  $ cd ..
+  $ cd ..
+
+
+Orphan from pruning
+-------------------
+
+Setup
+
+  $ cp -R base check-pruned
+  $ cd check-pruned/client
+  $ hg debugobsolete --record-parents `getid 'desc("commit_A0_")'`
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  $ hg log -G
+  o  changeset:   3:16affbe0f986
+  |  branch:      unrelated
+  |  tag:         tip
+  |  parent:      0:1e4be0697311
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     unrelated
+  |
+  | *  changeset:   2:c09d8ab29fda
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  instability: orphan
+  | |  summary:     commit_B0_
+  | |
+  | x  changeset:   1:37624bf21024
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    pruned
+  |    summary:     commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     root
+  
+
+Pushing the result is prevented with a message
+
+  $ hg push --new-branch
+  pushing to $TESTTMP/check-pruned/server
+  searching for changes
+  abort: push includes orphan changeset: c09d8ab29fda!
+  [255]
+
+  $ cd ../..
+
+
+Orphan from superseding
+-----------------------
+
+Setup
+
+  $ cp -R base check-superseded
+  $ cd check-superseded/client
+  $ hg up 'desc("commit_A0_")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch other
+  marked working directory as branch other
+  $ hg commit --amend -m commit_A1_
+  1 new orphan changesets
+  $ hg log -G
+  @  changeset:   4:df9b82a99e21
+  |  branch:      other
+  |  tag:         tip
+  |  parent:      0:1e4be0697311
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     commit_A1_
+  |
+  | o  changeset:   3:16affbe0f986
+  |/   branch:      unrelated
+  |    parent:      0:1e4be0697311
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     unrelated
+  |
+  | *  changeset:   2:c09d8ab29fda
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  instability: orphan
+  | |  summary:     commit_B0_
+  | |
+  | x  changeset:   1:37624bf21024
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using amend as 4:df9b82a99e21
+  |    summary:     commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     root
+  
+
+Pushing the result is prevented with a message
+
+  $ hg push --new-branch
+  pushing to $TESTTMP/check-superseded/server
+  searching for changes
+  abort: push includes orphan changeset: c09d8ab29fda!
+  [255]
+
+  $ cd ../..
+
+Tests that user get warned if it is about to publish obsolete/unstable content
+------------------------------------------------------------------------------
+
+Orphan from pruning
+-------------------
+
+Make sure the only difference is phase:
+
+  $ cd check-pruned/client
+  $ hg push --force --rev 'not desc("unrelated")'
+  pushing to $TESTTMP/check-pruned/server
+  searching for changes
+  no changes found
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  [1]
+
+Check something prevents a silent publication of the obsolete changeset
+
+  $ hg push --publish --new-branch
+  pushing to $TESTTMP/check-pruned/server
+  searching for changes
+  abort: push includes orphan changeset: c09d8ab29fda!
+  [255]
+
+  $ cd ../..
+
+Orphan from superseding
+-----------------------
+
+Make sure the only difference is phase:
+
+  $ cd check-superseded/client
+  $ hg push --force --rev 'not desc("unrelated")'
+  pushing to $TESTTMP/check-superseded/server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files (+1 heads)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+
+Check something prevents a silent publication of the obsolete changeset
+
+  $ hg push --publish --new-branch
+  pushing to $TESTTMP/check-superseded/server
+  searching for changes
+  abort: push includes orphan changeset: c09d8ab29fda!
+  [255]
+
+  $ cd ../..
--- a/tests/test-obsolete-divergent.t	Thu Jul 30 01:10:10 2020 +0200
+++ b/tests/test-obsolete-divergent.t	Fri Jul 31 17:09:31 2020 +0530
@@ -118,9 +118,7 @@
   $ hg push ../other
   pushing to ../other
   searching for changes
-  abort: push includes unstable changesets:
-    82623d38b9ba (content-divergent)
-    392fd25390da (content-divergent)
+  abort: push includes content-divergent changeset: 392fd25390da!
   [255]
 
   $ cd ..
--- a/tests/test-obsolete.t	Thu Jul 30 01:10:10 2020 +0200
+++ b/tests/test-obsolete.t	Fri Jul 31 17:09:31 2020 +0530
@@ -251,8 +251,7 @@
   $ hg push ../tmpa
   pushing to ../tmpa
   searching for changes
-  abort: push includes unstable changesets:
-    5601fb93a350 (phase-divergent)
+  abort: push includes phase-divergent changeset: 5601fb93a350!
   [255]
 
 Fixing "bumped" situation
@@ -617,8 +616,7 @@
   $ hg push ../tmpc/ -r 'desc("original_d")'
   pushing to ../tmpc/
   searching for changes
-  abort: push includes obsolete changesets:
-    94b33453f93b
+  abort: push includes obsolete changeset: 94b33453f93b!
   [255]
 
 refuse to push unstable changeset
@@ -626,10 +624,7 @@
   $ hg push ../tmpc/
   pushing to ../tmpc/
   searching for changes
-  abort: push includes obsolete changesets:
-    94b33453f93b
-  push includes unstable changesets:
-    cda648ca50f5 (orphan)
+  abort: push includes orphan changeset: cda648ca50f5!
   [255]
 
 with --force it will work anyway
@@ -652,26 +647,6 @@
   no changes found
   [1]
 
-pushing should work even if the outgoing changes contain an unrelated changeset
-(neither obsolete nor unstable) (issue6372)
-
-  $ hg up 1 -q
-  $ hg branch new -q
-  $ mkcommit c
-
-  $ hg push ../tmpc/ --new-branch
-  pushing to ../tmpc/
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 1 changesets with 1 changes to 1 files (+1 heads)
-
-make later tests work unmodified
-
-  $ hg --config extensions.strip= strip tip -q
-  $ hg up 5 -q
-
 Test that extinct changeset are properly detected
 
   $ hg log -r 'extinct()'
@@ -1221,14 +1196,6 @@
   phase-divergent: immutable predecessor 245b
   content-divergent: predecessor 245b
 
-  $ hg push  ../tmpf -r 50c51b361e60
-  pushing to ../tmpf
-  searching for changes
-  abort: push includes unstable changesets:
-    50c51b361e60 (orphan, phase-divergent, content-divergent)
-  [255]
-
-
 #if serve
 
   $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
--- a/tests/test-phases.t	Thu Jul 30 01:10:10 2020 +0200
+++ b/tests/test-phases.t	Fri Jul 31 17:09:31 2020 +0530
@@ -896,13 +896,11 @@
   $ hg --config "phases.new-commit=internal" commit -m "my test internal commit" 2>&1 | grep ProgrammingError
   ** ProgrammingError: this repository does not support the internal phase
       raise error.ProgrammingError(msg)
-  mercurial.error.ProgrammingError: this repository does not support the internal phase (no-chg !)
-  ProgrammingError: this repository does not support the internal phase (chg !)
+  *ProgrammingError: this repository does not support the internal phase (glob)
   $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" 2>&1 | grep ProgrammingError
   ** ProgrammingError: this repository does not support the archived phase
       raise error.ProgrammingError(msg)
-  mercurial.error.ProgrammingError: this repository does not support the archived phase (no-chg !)
-  ProgrammingError: this repository does not support the archived phase (chg !)
+  *ProgrammingError: this repository does not support the archived phase (glob)
 
   $ cd ..
 
--- a/tests/test-rebase-inmemory.t	Thu Jul 30 01:10:10 2020 +0200
+++ b/tests/test-rebase-inmemory.t	Fri Jul 31 17:09:31 2020 +0530
@@ -963,3 +963,21 @@
   |/
   o  0: d20a80d4def3 'base'
   
+
+  $ cd ..
+
+Test (virtual) working directory without changes, created by merge conflict
+resolution. There was a regression where the file was incorrectly detected as
+changed although the file contents were the same as in the parent.
+
+  $ hg init nofilechanges
+  $ cd nofilechanges
+  $ echo a > a; hg add a; hg ci -m a
+  $ echo foo > test; hg add test; hg ci -m b
+  $ hg up 0 -q
+  $ echo bar > test; hg add test; hg ci -m c
+  created new head
+  $ hg rebase -d 2 -d 1 --tool :local
+  rebasing 2:ca2749322ee5 "c" (tip)
+  note: not rebasing 2:ca2749322ee5 "c" (tip), its destination already has all its changes
+  saved backup bundle to $TESTTMP/nofilechanges/.hg/strip-backup/ca2749322ee5-6dc7e94b-rebase.hg