changeset 46546:d67732a4b58a

branching: merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 11 Feb 2021 20:36:46 -0800
parents d7685105e504 (current diff) b910be772eb9 (diff)
children 5aac1a1a5beb
files hgext/largefiles/overrides.py mercurial/configitems.py mercurial/helptext/config.txt relnotes/5.7 rust/hg-core/src/dirstate/status.rs tests/test-hook.t
diffstat 12 files changed, 159 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/hgext/largefiles/overrides.py	Thu Feb 11 20:36:46 2021 -0800
@@ -1853,7 +1853,7 @@
 
 
 @eh.wrapfunction(urlmod, b'open')
-def openlargefile(orig, ui, url_, data=None):
+def openlargefile(orig, ui, url_, data=None, **kwargs):
     if url_.startswith(_lfscheme):
         if data:
             msg = b"cannot use data on a 'largefile://' url"
@@ -1861,4 +1861,4 @@
         lfid = url_[len(_lfscheme) :]
         return storefactory.getlfile(ui, lfid)
     else:
-        return orig(ui, url_, data=data)
+        return orig(ui, url_, data=data, **kwargs)
--- a/mercurial/cmdutil.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/cmdutil.py	Thu Feb 11 20:36:46 2021 -0800
@@ -3145,7 +3145,7 @@
         # avoid reporting something like "committed new head" when
         # recommitting old changesets, and issue a helpful warning
         # for most instances
-        repo.ui.warn(_("warning: commit already existed in the repository!\n"))
+        repo.ui.warn(_(b"warning: commit already existed in the repository!\n"))
     elif (
         not opts.get(b'amend')
         and bheads
--- a/mercurial/configitems.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/configitems.py	Thu Feb 11 20:36:46 2021 -0800
@@ -1333,11 +1333,17 @@
 )
 coreconfigitem(
     b'hooks',
-    b'.*',
+    b'[^:]*',
     default=dynamicdefault,
     generic=True,
 )
 coreconfigitem(
+    b'hooks',
+    b'.*:run-with-plain',
+    default=True,
+    generic=True,
+)
+coreconfigitem(
     b'hgweb-paths',
     b'.*',
     default=list,
--- a/mercurial/helptext/config.txt	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/helptext/config.txt	Thu Feb 11 20:36:46 2021 -0800
@@ -1027,6 +1027,13 @@
   incoming.autobuild = /my/build/hook
   # force autobuild hook to run before other incoming hooks
   priority.incoming.autobuild = 1
+  ###  control HGPLAIN setting when running autobuild hook
+  # HGPLAIN always set (default from Mercurial 5.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)
+  incoming.autobuild:run-with-plain = auto
 
 Most hooks are run with environment variables set that give useful
 additional information. For each hook below, the environment variables
--- a/mercurial/hook.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/hook.py	Thu Feb 11 20:36:46 2021 -0800
@@ -157,7 +157,15 @@
             env[b'HG_PENDING'] = repo.root
     env[b'HG_HOOKTYPE'] = htype
     env[b'HG_HOOKNAME'] = name
-    env[b'HGPLAIN'] = b'1'
+
+    if ui.config(b'hooks', b'%s:run-with-plain' % name) == b'auto':
+        plain = ui.plain()
+    else:
+        plain = ui.configbool(b'hooks', b'%s:run-with-plain' % name)
+    if plain:
+        env[b'HGPLAIN'] = b'1'
+    else:
+        env[b'HGPLAIN'] = b''
 
     for k, v in pycompat.iteritems(args):
         # transaction changes can accumulate MBs of data, so skip it
@@ -224,7 +232,11 @@
     """return all hooks items ready to be sorted"""
     hooks = {}
     for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
-        if name.startswith(b'priority.') or name.startswith(b'tonative.'):
+        if (
+            name.startswith(b'priority.')
+            or name.startswith(b'tonative.')
+            or b':' in name
+        ):
             continue
 
         priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
--- a/mercurial/ui.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/ui.py	Thu Feb 11 20:36:46 2021 -0800
@@ -60,8 +60,6 @@
 # The config knobs that will be altered (if unset) by ui.tweakdefaults.
 tweakrc = b"""
 [ui]
-# Gives detailed exit codes for input/user errors, config errors, etc.
-detailed-exit-code = True
 # The rollback command is dangerous. As a rule, don't use it.
 rollback = False
 # Make `hg status` report copy information
--- a/mercurial/utils/procutil.py	Thu Feb 04 15:04:53 2021 +0100
+++ b/mercurial/utils/procutil.py	Thu Feb 11 20:36:46 2021 -0800
@@ -546,7 +546,11 @@
             # pure build; use a safe default
             return True
     else:
-        return pycompat.iswindows or encoding.environ.get(b"DISPLAY")
+        return (
+            pycompat.iswindows
+            or encoding.environ.get(b"DISPLAY")
+            or encoding.environ.get(b"WAYLAND_DISPLAY")
+        )
 
 
 def gui():
--- a/relnotes/5.7	Thu Feb 04 15:04:53 2021 +0100
+++ b/relnotes/5.7	Thu Feb 11 20:36:46 2021 -0800
@@ -19,9 +19,6 @@
 
  * `hg purge` is now a core command using `--confirm` by default.
 
- * `hg strip`, from the strip extension, is now a core command, `hg
-   debugstrip`. The extension remains for compatibility.
-
  * `hg diff` and `hg extdiff` now support `--from <rev>` and `--to <rev>`
    arguments as clearer alternatives to `-r <revs>`. `-r <revs>` has been
    deprecated.
--- a/rust/hg-core/src/dirstate/status.rs	Thu Feb 04 15:04:53 2021 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Thu Feb 11 20:36:46 2021 -0800
@@ -776,58 +776,66 @@
     #[cfg(not(feature = "dirstate-tree"))]
     #[timed]
     pub fn extend_from_dmap(&self, results: &mut Vec<DispatchedPath<'a>>) {
-        results.par_extend(self.dmap.par_iter().map(
-            move |(filename, entry)| {
-                let filename: &HgPath = filename;
-                let filename_as_path = match hg_path_to_path_buf(filename) {
-                    Ok(f) => f,
-                    Err(_) => {
-                        return (
+        results.par_extend(
+            self.dmap
+                .par_iter()
+                .filter(|(path, _)| self.matcher.matches(path))
+                .map(move |(filename, entry)| {
+                    let filename: &HgPath = filename;
+                    let filename_as_path = match hg_path_to_path_buf(filename)
+                    {
+                        Ok(f) => f,
+                        Err(_) => {
+                            return (
+                                Cow::Borrowed(filename),
+                                INVALID_PATH_DISPATCH,
+                            )
+                        }
+                    };
+                    let meta = self
+                        .root_dir
+                        .join(filename_as_path)
+                        .symlink_metadata();
+                    match meta {
+                        Ok(m)
+                            if !(m.file_type().is_file()
+                                || m.file_type().is_symlink()) =>
+                        {
+                            (
+                                Cow::Borrowed(filename),
+                                dispatch_missing(entry.state),
+                            )
+                        }
+                        Ok(m) => (
                             Cow::Borrowed(filename),
-                            INVALID_PATH_DISPATCH,
-                        )
-                    }
-                };
-                let meta =
-                    self.root_dir.join(filename_as_path).symlink_metadata();
-                match meta {
-                    Ok(m)
-                        if !(m.file_type().is_file()
-                            || m.file_type().is_symlink()) =>
-                    {
-                        (
-                            Cow::Borrowed(filename),
-                            dispatch_missing(entry.state),
-                        )
+                            dispatch_found(
+                                filename,
+                                *entry,
+                                HgMetadata::from_metadata(m),
+                                &self.dmap.copy_map,
+                                self.options,
+                            ),
+                        ),
+                        Err(e)
+                            if e.kind() == ErrorKind::NotFound
+                                || e.raw_os_error() == Some(20) =>
+                        {
+                            // Rust does not yet have an `ErrorKind` for
+                            // `NotADirectory` (errno 20)
+                            // It happens if the dirstate contains `foo/bar`
+                            // and foo is not a
+                            // directory
+                            (
+                                Cow::Borrowed(filename),
+                                dispatch_missing(entry.state),
+                            )
+                        }
+                        Err(e) => {
+                            (Cow::Borrowed(filename), dispatch_os_error(&e))
+                        }
                     }
-                    Ok(m) => (
-                        Cow::Borrowed(filename),
-                        dispatch_found(
-                            filename,
-                            *entry,
-                            HgMetadata::from_metadata(m),
-                            &self.dmap.copy_map,
-                            self.options,
-                        ),
-                    ),
-                    Err(e)
-                        if e.kind() == ErrorKind::NotFound
-                            || e.raw_os_error() == Some(20) =>
-                    {
-                        // Rust does not yet have an `ErrorKind` for
-                        // `NotADirectory` (errno 20)
-                        // It happens if the dirstate contains `foo/bar`
-                        // and foo is not a
-                        // directory
-                        (
-                            Cow::Borrowed(filename),
-                            dispatch_missing(entry.state),
-                        )
-                    }
-                    Err(e) => (Cow::Borrowed(filename), dispatch_os_error(&e)),
-                }
-            },
-        ));
+                }),
+        );
     }
 
     /// Checks all files that are in the dirstate but were not found during the
--- a/tests/test-hgweb-diffs.t	Thu Feb 04 15:04:53 2021 +0100
+++ b/tests/test-hgweb-diffs.t	Thu Feb 11 20:36:46 2021 -0800
@@ -1138,6 +1138,21 @@
   $ cd test1
   $ hg import -q --bypass --exact http://localhost:$HGPORT/rev/1
 
+repeat test above, with largefiles enabled
+
+  $ cd ..
+  $ rm -r test1
+  $ hg clone -r0 test test1
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 2 changes to 2 files
+  new changesets 0cd96de13884
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd test1
+  $ hg import --config extensions.largefiles= -q --bypass --exact http://localhost:$HGPORT/rev/1
+
 raw revision with diff block numbers
 
   $ killdaemons.py
--- a/tests/test-hook.t	Thu Feb 04 15:04:53 2021 +0100
+++ b/tests/test-hook.t	Thu Feb 11 20:36:46 2021 -0800
@@ -1390,3 +1390,42 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
+
+unsetup the test
+----------------
+
+# touch the file to unconfuse chg with a diffrent mtime
+  $ sleep 1
+  $ touch $TESTTMP/untrusted.py
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > untrusted=!
+  > EOF
+
+HGPLAIN setting in hooks
+========================
+
+  $ cat << EOF >> .hg/hgrc
+  > [hooks]
+  > pre-version.testing-default=echo '### default ###' plain: \${HGPLAIN:-'<unset>'}
+  > pre-version.testing-yes=echo '### yes #######' plain: \${HGPLAIN:-'<unset>'}
+  > pre-version.testing-yes:run-with-plain=yes
+  > pre-version.testing-no=echo '### no ########' plain: \${HGPLAIN:-'<unset>'}
+  > pre-version.testing-no:run-with-plain=no
+  > pre-version.testing-auto=echo '### auto ######' plain: \${HGPLAIN:-'<unset>'}
+  > pre-version.testing-auto:run-with-plain=auto
+  > EOF
+
+  $ (unset HGPLAIN; hg version --quiet)
+  ### default ### plain: 1
+  ### yes ####### plain: 1
+  ### no ######## plain: <unset>
+  ### auto ###### plain: <unset>
+  Mercurial Distributed SCM (*) (glob)
+
+  $ HGPLAIN=1 hg version --quiet
+  ### default ### plain: 1
+  ### yes ####### plain: 1
+  ### no ######## plain: <unset>
+  ### auto ###### plain: 1
+  Mercurial Distributed SCM (*) (glob)
--- a/tests/test-status.t	Thu Feb 04 15:04:53 2021 +0100
+++ b/tests/test-status.t	Thu Feb 11 20:36:46 2021 -0800
@@ -680,3 +680,14 @@
   $ cd symlink-repo0
   $ ln -s ../repo0/.hg
   $ hg status
+
+Check using include flag with pattern when status does not need to traverse
+the working directory (issue6483)
+
+  $ cd ..
+  $ hg init issue6483
+  $ cd issue6483
+  $ touch a.py b.rs
+  $ hg add a.py b.rs
+  $ hg st -aI "*.py"
+  A a.py