# HG changeset patch # User Martin von Zweigbergk # Date 2021-02-12 04:36:46 # Node ID d67732a4b58a3f11e2d4f2e2aa85d759738a6dff # Parent d7685105e504d6d964b32adc7b11234841e5f54f # Parent b910be772eb9bc0b62bd3bc421a2084d3ac72c9f branching: merge with stable diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1853,7 +1853,7 @@ def upgraderequirements(orig, repo): @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 @@ def openlargefile(orig, ui, url_, data=N lfid = url_[len(_lfscheme) :] return storefactory.getlfile(ui, lfid) else: - return orig(ui, url_, data=data) + return orig(ui, url_, data=data, **kwargs) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3145,7 +3145,7 @@ def commitstatus(repo, node, branch, bhe # 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 diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1333,11 +1333,17 @@ coreconfigitem( ) 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, diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -1027,6 +1027,13 @@ Example ``.hg/hgrc``:: 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 diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -157,7 +157,15 @@ def _exthook(ui, repo, htype, name, cmd, 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 @@ def _hookitems(ui, _untrusted=False): """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) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -60,8 +60,6 @@ urlreq = util.urlreq # 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 diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -546,7 +546,11 @@ def _gui(): # 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(): diff --git a/relnotes/5.7 b/relnotes/5.7 --- a/relnotes/5.7 +++ b/relnotes/5.7 @@ -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 ` and `--to ` arguments as clearer alternatives to `-r `. `-r ` has been deprecated. diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs +++ b/rust/hg-core/src/dirstate/status.rs @@ -776,58 +776,66 @@ where #[cfg(not(feature = "dirstate-tree"))] #[timed] pub fn extend_from_dmap(&self, results: &mut Vec>) { - 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 diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t --- a/tests/test-hgweb-diffs.t +++ b/tests/test-hgweb-diffs.t @@ -1138,6 +1138,21 @@ test import rev as raw-rev $ 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 diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -1390,3 +1390,42 @@ Non-blocking hook 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:-''} + > pre-version.testing-yes=echo '### yes #######' plain: \${HGPLAIN:-''} + > pre-version.testing-yes:run-with-plain=yes + > pre-version.testing-no=echo '### no ########' plain: \${HGPLAIN:-''} + > pre-version.testing-no:run-with-plain=no + > pre-version.testing-auto=echo '### auto ######' plain: \${HGPLAIN:-''} + > pre-version.testing-auto:run-with-plain=auto + > EOF + + $ (unset HGPLAIN; hg version --quiet) + ### default ### plain: 1 + ### yes ####### plain: 1 + ### no ######## plain: + ### auto ###### plain: + Mercurial Distributed SCM (*) (glob) + + $ HGPLAIN=1 hg version --quiet + ### default ### plain: 1 + ### yes ####### plain: 1 + ### no ######## plain: + ### auto ###### plain: 1 + Mercurial Distributed SCM (*) (glob) diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -680,3 +680,14 @@ Make sure .hg doesn't show up even as a $ 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