D9927: config: use level to properly deal with value priority

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  A higher priority alias will now take precedence over lower priority ones.
  
  This was a requirements step before using alias more widely, especially to
  rename existing and established config option.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9927

AFFECTED FILES
  mercurial/ui.py
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -477,8 +477,7 @@
   $ HGRCPATH="file-B.rc" hg log -r .
   value-B
   $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
-  value-A (known-bad-output !)
-  value-B (missing-correct-output !)
+  value-B
 
 Alias and include
 -
@@ -486,15 +485,12 @@
 The pre/post include priority should also apply when tie-breaking alternatives.
 
   $ HGRCPATH="file-C.rc" hg log -r .
-  value-included (known-bad-output !)
-  value-C (missing-correct-output !)
+  value-C
   $ HGRCPATH="file-D.rc" hg log -r .
-  value-D (known-bad-output !)
-  value-included (missing-correct-output !)
+  value-included
 
 command line override
 -
 
   $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config 
ui.logtemplate="value-CLI\n"
-  value-A (known-bad-output !)
-  value-CLI (missing-correct-output !)
+  value-CLI
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -664,11 +664,18 @@
 msg %= (section, name, pycompat.bytestr(default))
 self.develwarn(msg, 2, b'warn-config-default')
 
+candidates = []
+config = self._data(untrusted)
 for s, n in alternates:
-candidate = self._data(untrusted).get(s, n, None)
+candidate = config.get(s, n, None)
 if candidate is not None:
-value = candidate
-break
+candidates.append((s, n, candidate))
+if candidates:
+
+def level(x):
+return config.level(x[0], x[1])
+
+value = max(candidates, key=level)[2]
 
 if self.debugflag and not untrusted and self._reportuntrusted:
 for s, n in alternates:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9926: config: track the "level" of a value

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Config value now remember the "level" of the config that loaded it. This will 
be
  used to ensure good priority management for alias.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9926

AFFECTED FILES
  mercurial/config.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -304,6 +304,11 @@
 if k in self.environ:
 self._exportableenviron[k] = self.environ[k]
 
+def _new_source(self):
+self._ocfg.new_source()
+self._tcfg.new_source()
+self._ucfg.new_source()
+
 @classmethod
 def load(cls):
 """Create a ui and load global and user configs"""
@@ -315,6 +320,7 @@
 elif t == b'resource':
 u.read_resource_config(f, trust=True)
 elif t == b'items':
+u._new_source()
 sections = set()
 for section, name, value, source in f:
 # do not set u._ocfg
@@ -327,6 +333,7 @@
 else:
 raise error.ProgrammingError(b'unknown rctype: %s' % t)
 u._maybetweakdefaults()
+u._new_source()  # anything after that is a different level
 return u
 
 def _maybetweakdefaults(self):
diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -22,11 +22,19 @@
 
 class config(object):
 def __init__(self, data=None):
+self._current_source_level = 0
 self._data = {}
 self._unset = []
 if data:
 for k in data._data:
 self._data[k] = data[k].copy()
+self._current_source_level = data._current_source_level + 1
+
+def new_source(self):
+"""increment the source counter
+
+This is used to define source priority when reading"""
+self._current_source_level += 1
 
 def copy(self):
 return config(self)
@@ -45,6 +53,9 @@
 yield d
 
 def update(self, src):
+current_level = self._current_source_level
+current_level += 1
+max_level = self._current_source_level
 for s, n in src._unset:
 ds = self._data.get(s, None)
 if ds is not None and n in ds:
@@ -56,7 +67,12 @@
 self._data[s] = ds.preparewrite()
 else:
 self._data[s] = util.cowsortdict()
-self._data[s].update(src._data[s])
+for k, v in src._data[s].items():
+value, source, level = v
+level += current_level
+max_level = max(level, current_level)
+self._data[s][k] = (value, source, level)
+self._current_source_level = max_level
 
 def _get(self, section, item):
 return self._data.get(section, {}).get(item)
@@ -85,12 +101,18 @@
 return b""
 return result[1]
 
+def level(self, section, item):
+result = self._get(section, item)
+if result is None:
+return None
+return result[2]
+
 def sections(self):
 return sorted(self._data.keys())
 
 def items(self, section):
 items = pycompat.iteritems(self._data.get(section, {}))
-return [(k, v) for (k, (v, s)) in items]
+return [(k, v[0]) for (k, v) in items]
 
 def set(self, section, item, value, source=b""):
 if pycompat.ispy3:
@@ -107,7 +129,7 @@
 self._data[section] = util.cowsortdict()
 else:
 self._data[section] = self._data[section].preparewrite()
-self._data[section][item] = (value, source)
+self._data[section][item] = (value, source, self._current_source_level)
 
 def alter(self, section, key, new_value):
 """alter a value, to be used by `ui.fixconfig`"""
@@ -213,6 +235,7 @@
 raise error.ConfigError(message, (b"%s:%d" % (src, line)))
 
 def read(self, path, fp=None, sections=None, remap=None):
+self.new_source()
 if not fp:
 fp = util.posixfile(path, b'rb')
 assert (
@@ -227,6 +250,8 @@
 def include(rel, remap, sections):
 abs = os.path.normpath(os.path.join(dir, rel))
 self.read(abs, remap=remap, sections=sections)
+# anything after the include has a higher level
+self.new_source()
 
 self.parse(
 path, fp.read(), sections=sections, remap=remap, include=include



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9924: config: use a new `alter` method in `fixconfig`

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `set` function is doing various work related to metadata (eg: the source,
  later the level). However the `fixconfig` call only updating some values
  according to standard processing, not changing any of the related metadata. So
  we introduce a new method and use it there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9924

AFFECTED FILES
  mercurial/config.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -556,7 +556,7 @@
 p = util.expandpath(p)
 if not util.hasscheme(p) and not os.path.isabs(p):
 p = os.path.normpath(os.path.join(root, p))
-c.set(b"paths", n, p)
+c.alter(b"paths", n, p)
 
 if section in (None, b'ui'):
 # update ui options
diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -108,6 +108,14 @@
 self._source = self._source.preparewrite()
 self._source[(section, item)] = source
 
+def alter(self, section, key, new_value):
+"""alter a value, to be used by `ui.fixconfig`"""
+item = self._data[section][key]
+size = len(item)
+new_item = (new_value,) + item[1:]
+assert len(new_item) == size
+self._data[section][key] = new_item
+
 def restore(self, data):
 """restore data returned by self.backup"""
 self._source = self._source.preparewrite()



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9925: config: track "source" along side value

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Currently the source is stored in a entirely different way than the data. This
  is impractical. Especially if we are about to add more of such metadata. So 
lets
  put them back together.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9925

AFFECTED FILES
  mercurial/config.py

CHANGE DETAILS

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -27,9 +27,6 @@
 if data:
 for k in data._data:
 self._data[k] = data[k].copy()
-self._source = data._source.copy()
-else:
-self._source = util.cowdict()
 
 def copy(self):
 return config(self)
@@ -48,13 +45,11 @@
 yield d
 
 def update(self, src):
-self._source = self._source.preparewrite()
 for s, n in src._unset:
 ds = self._data.get(s, None)
 if ds is not None and n in ds:
 self._data[s] = ds.preparewrite()
 del self._data[s][n]
-del self._source[(s, n)]
 for s in src:
 ds = self._data.get(s, None)
 if ds:
@@ -62,31 +57,40 @@
 else:
 self._data[s] = util.cowsortdict()
 self._data[s].update(src._data[s])
-self._source.update(src._source)
+
+def _get(self, section, item):
+return self._data.get(section, {}).get(item)
 
 def get(self, section, item, default=None):
-return self._data.get(section, {}).get(item, default)
+result = self._get(section, item)
+if result is None:
+return default
+return result[0]
 
-def backup(self, section, item):
+def backup(self, section, key):
 """return a tuple allowing restore to reinstall a previous value
 
 The main reason we need it is because it handles the "no data" case.
 """
 try:
-value = self._data[section][item]
-source = self.source(section, item)
-return (section, item, value, source)
+item = self._data[section][key]
 except KeyError:
-return (section, item)
+return (section, key)
+else:
+return (section, key) + item
 
 def source(self, section, item):
-return self._source.get((section, item), b"")
+result = self._get(section, item)
+if result is None:
+return b""
+return result[1]
 
 def sections(self):
 return sorted(self._data.keys())
 
 def items(self, section):
-return list(pycompat.iteritems(self._data.get(section, {})))
+items = pycompat.iteritems(self._data.get(section, {}))
+return [(k, v) for (k, (v, s)) in items]
 
 def set(self, section, item, value, source=b""):
 if pycompat.ispy3:
@@ -103,10 +107,7 @@
 self._data[section] = util.cowsortdict()
 else:
 self._data[section] = self._data[section].preparewrite()
-self._data[section][item] = value
-if source:
-self._source = self._source.preparewrite()
-self._source[(section, item)] = source
+self._data[section][item] = (value, source)
 
 def alter(self, section, key, new_value):
 """alter a value, to be used by `ui.fixconfig`"""
@@ -118,19 +119,17 @@
 
 def restore(self, data):
 """restore data returned by self.backup"""
-self._source = self._source.preparewrite()
-if len(data) == 4:
+if len(data) != 2:
 # restore old data
-section, item, value, source = data
+section, key = data[:2]
+item = data[2:]
 self._data[section] = self._data[section].preparewrite()
-self._data[section][item] = value
-self._source[(section, item)] = source
+self._data[section][key] = item
 else:
 # no data before, remove everything
 section, item = data
 if section in self._data:
 self._data[section].pop(item, None)
-self._source.pop((section, item), None)
 
 def parse(self, src, data, sections=None, remap=None, include=None):
 sectionre = util.re.compile(br'\[([^\[]+)\]')



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9923: config: use the right API to access git-submodule

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9923

AFFECTED FILES
  hgext/convert/git.py

CHANGE DETAILS

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -247,7 +247,8 @@
 b'\n'.join(line.strip() for line in content.split(b'\n')),
 )
 for sec in c.sections():
-s = c[sec]
+# turn the config object into a real dict
+s = dict(c.items(sec))
 if b'url' in s and b'path' in s:
 self.submodules.append(submodule(s[b'path'], b'', s[b'url']))
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9922: config: use the right API to access template access

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Preventing direct access to the underlying dict will help a coming refactoring
  of `config`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9922

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -891,7 +891,7 @@
 fp = _open_mapfile(path)
 cache, tmap, aliases = _readmapfile(fp, path)
 
-for key, val in conf[b'templates'].items():
+for key, val in conf.items(b'templates'):
 if not val:
 raise error.ParseError(
 _(b'missing value'), conf.source(b'templates', key)
@@ -904,7 +904,7 @@
 cache[key] = unquotestring(val)
 elif key != b'__base__':
 tmap[key] = os.path.join(base, val)
-aliases.extend(conf[b'templatealias'].items())
+aliases.extend(conf.items(b'templatealias'))
 return cache, tmap, aliases
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9921: config: use the right API to access subrepository section

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Preventing direct access to the underlying dict will help a coming refactoring
  of `config`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9921

AFFECTED FILES
  mercurial/subrepoutil.py

CHANGE DETAILS

diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py
--- a/mercurial/subrepoutil.py
+++ b/mercurial/subrepoutil.py
@@ -105,7 +105,7 @@
 return src
 
 state = {}
-for path, src in p[b''].items():
+for path, src in p.items(b''):
 kind = b'hg'
 if src.startswith(b'['):
 if b']' not in src:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9920: config: test priority involving alias and cli

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9920

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -491,3 +491,10 @@
   $ HGRCPATH="file-D.rc" hg log -r .
   value-D (known-bad-output !)
   value-included (missing-correct-output !)
+
+command line override
+-
+
+  $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config 
ui.logtemplate="value-CLI\n"
+  value-A (known-bad-output !)
+  value-CLI (missing-correct-output !)



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9919: config: test priority involving alias and include

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9919

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -418,6 +418,29 @@
   > post-include= value-included
   > EOF
 
+  $ cat > file-C.rc << EOF
+  > %include ./included-alias-C.rc
+  > [ui]
+  > logtemplate = "value-C\n"
+  > EOF
+
+  $ cat > included-alias-C.rc << EOF
+  > [command-templates]
+  > log = "value-included\n"
+  > EOF
+
+
+  $ cat > file-D.rc << EOF
+  > [command-templates]
+  > log = "value-D\n"
+  > %include ./included-alias-D.rc
+  > EOF
+
+  $ cat > included-alias-D.rc << EOF
+  > [ui]
+  > logtemplate = "value-included\n"
+  > EOF
+
 Simple order checking
 -
 
@@ -456,3 +479,15 @@
   $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
   value-A (known-bad-output !)
   value-B (missing-correct-output !)
+
+Alias and include
+-
+
+The pre/post include priority should also apply when tie-breaking alternatives.
+
+  $ HGRCPATH="file-C.rc" hg log -r .
+  value-included (known-bad-output !)
+  value-C (missing-correct-output !)
+  $ HGRCPATH="file-D.rc" hg log -r .
+  value-D (known-bad-output !)
+  value-included (missing-correct-output !)



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9918: config: test priority involving alias

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9918

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -400,11 +400,15 @@
   > pre-include= value-A
   > %include ./included.rc
   > post-include= value-A
+  > [command-templates]
+  > log = "value-A\n"
   > EOF
 
   $ cat > file-B.rc << EOF
   > [config-test]
   > basic = value-B
+  > [ui]
+  > logtemplate = "value-B\n"
   > EOF
 
 
@@ -437,3 +441,18 @@
 
   $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic --config 
config-test.basic=value-CLI
   value-CLI
+
+Alias ordering
+--
+
+The higher level alternative should win.
+
+BROKEN: currently not the case.
+
+  $ HGRCPATH="file-A.rc" hg log -r .
+  value-A
+  $ HGRCPATH="file-B.rc" hg log -r .
+  value-B
+  $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
+  value-A (known-bad-output !)
+  value-B (missing-correct-output !)



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9917: config: test priority involving the command line

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9917

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -431,3 +431,9 @@
   value-included
   $ HGRCPATH="file-A.rc" hg config config-test.post-include
   value-A
+
+command line override
+-
+
+  $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic --config 
config-test.basic=value-CLI
+  value-CLI



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9916: config: test priority involving include

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9916

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -397,6 +397,9 @@
   $ cat > file-A.rc << EOF
   > [config-test]
   > basic = value-A
+  > pre-include= value-A
+  > %include ./included.rc
+  > post-include= value-A
   > EOF
 
   $ cat > file-B.rc << EOF
@@ -404,6 +407,13 @@
   > basic = value-B
   > EOF
 
+
+  $ cat > included.rc << EOF
+  > [config-test]
+  > pre-include= value-included
+  > post-include= value-included
+  > EOF
+
 Simple order checking
 -
 
@@ -411,3 +421,13 @@
 
   $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic
   value-B
+
+Ordering from include
+-
+
+value from an include overwrite value defined before the include, but not the 
one defined after the include
+
+  $ HGRCPATH="file-A.rc" hg config config-test.pre-include
+  value-included
+  $ HGRCPATH="file-A.rc" hg config config-test.post-include
+  value-A



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9915: config: add a test for priority when includes are involved

2021-01-29 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9915

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -388,3 +388,26 @@
   > done
   $ HGRCPATH=configs hg config section.key
   99
+
+Configuration priority
+==
+
+setup necessary file
+
+  $ cat > file-A.rc << EOF
+  > [config-test]
+  > basic = value-A
+  > EOF
+
+  $ cat > file-B.rc << EOF
+  > [config-test]
+  > basic = value-B
+  > EOF
+
+Simple order checking
+-
+
+If file B is read after file A, value from B overwrite value from A.
+
+  $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic
+  value-B



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9912: errors: use StateError more in merge module

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9912

AFFECTED FILES
  mercurial/merge.py
  tests/test-audit-subrepo.t
  tests/test-largefiles.t
  tests/test-merge-remove.t
  tests/test-merge1.t
  tests/test-pathconflicts-basic.t
  tests/test-pathconflicts-update.t
  tests/test-remotefilelog-prefetch.t
  tests/test-rename-dir-merge.t
  tests/test-resolve.t
  tests/test-up-local-change.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -324,7 +324,7 @@
   $ hg up -q 4
   abort: conflicting changes
   (commit or update --clean to discard changes)
-  [255]
+  [20]
   $ hg up -m 4
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -175,7 +175,7 @@
   $ hg up 1
   b: untracked file differs
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ rm b
 
 test conflicting untracked ignored file
@@ -195,7 +195,7 @@
   $ hg up 'desc("add ignored file")'
   ignored: untracked file differs
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
 
 test a local add
 
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -153,15 +153,15 @@
   $ hg up 0
   abort: outstanding merge conflicts
   (use 'hg resolve' to resolve)
-  [255]
+  [20]
   $ hg merge 2
   abort: outstanding merge conflicts
   (use 'hg resolve' to resolve)
-  [255]
+  [20]
   $ hg merge --force 2
   abort: outstanding merge conflicts
   (use 'hg resolve' to resolve)
-  [255]
+  [20]
 
 set up conflict-free merge
 
diff --git a/tests/test-rename-dir-merge.t b/tests/test-rename-dir-merge.t
--- a/tests/test-rename-dir-merge.t
+++ b/tests/test-rename-dir-merge.t
@@ -110,7 +110,7 @@
   $ hg merge 2
   b/c: untracked file differs
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ cat b/c
   target
 but it should succeed if the content matches
diff --git a/tests/test-remotefilelog-prefetch.t 
b/tests/test-remotefilelog-prefetch.t
--- a/tests/test-remotefilelog-prefetch.t
+++ b/tests/test-remotefilelog-prefetch.t
@@ -180,7 +180,7 @@
   x: untracked file differs
   3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob)
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg revert --all
 
 # Test batch fetching of lookup files during hg status
diff --git a/tests/test-pathconflicts-update.t 
b/tests/test-pathconflicts-update.t
--- a/tests/test-pathconflicts-update.t
+++ b/tests/test-pathconflicts-update.t
@@ -49,7 +49,7 @@
   $ hg up dir
   a/b: untracked file conflicts with directory
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg up dir --config merge.checkunknown=warn
   a/b: replacing untracked file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -70,7 +70,7 @@
   $ hg up dir
   a/b: untracked file conflicts with directory
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg up dir --config merge.checkunknown=warn
   a/b: replacing untracked file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -89,7 +89,7 @@
   $ hg up file
   a/b: untracked directory conflicts with file
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg up file --config merge.checkunknown=warn
   a/b: replacing untracked files in directory
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -107,7 +107,7 @@
   $ hg up link
   a/b: untracked directory conflicts with file
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg up link --config merge.checkunknown=warn
   a/b: replacing untracked files in directory
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-pathconflicts-basic.t b/tests/test-pathconflicts-basic.t
--- a/tests/test-pathconflicts-basic.t
+++ b/tests/test-pathconflicts-basic.t
@@ -53,7 +53,7 @@
   $ hg up file
   a: untracked directory conflicts with file
   abort: untracked files in working directory differ from files in requested 
revision
-  [255]
+  [20]
   $ hg up --clean file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark file)
diff --git a/tests/test-merge1.t 

D9914: errors: use more specific errors in rebase extension

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9914

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-collapse.t
  tests/test-rebase-dest.t
  tests/test-rebase-mq.t
  tests/test-rebase-named-branches.t
  tests/test-rebase-newancestor.t
  tests/test-rebase-obsolete.t
  tests/test-rebase-parameters.t
  tests/test-rebase-scenario-global.t

CHANGE DETAILS

diff --git a/tests/test-rebase-scenario-global.t 
b/tests/test-rebase-scenario-global.t
--- a/tests/test-rebase-scenario-global.t
+++ b/tests/test-rebase-scenario-global.t
@@ -266,14 +266,14 @@
 
   $ hg rebase -s 5 -d 6
   abort: source and destination form a cycle
-  [255]
+  [10]
 
 G onto B - merge revision with both parents not in ancestors of target:
 
   $ hg rebase -s 6 -d 1
   rebasing 6:eea13746799a "G"
   abort: cannot rebase 6:eea13746799a without moving at least one of its 
parents
-  [255]
+  [10]
   $ hg rebase --abort
   rebase aborted
 
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -66,7 +66,7 @@
 
   $ hg rebase --continue --collapse
   abort: cannot use collapse with continue or abort
-  [255]
+  [10]
 
   $ hg rebase --continue --dest 4
   abort: cannot specify both --continue and --dest
@@ -94,15 +94,15 @@
 
   $ hg rebase --rev 'wdir()' --dest 6
   abort: cannot rebase the working copy
-  [255]
+  [10]
 
   $ hg rebase --source 'wdir()' --dest 6
   abort: cannot rebase the working copy
-  [255]
+  [10]
 
   $ hg rebase --source 1 --source 'wdir()' --dest 6
   abort: cannot rebase the working copy
-  [255]
+  [10]
 
   $ hg rebase --source '1 & !1' --dest 8
   empty "source" revision set - nothing to rebase
@@ -508,11 +508,11 @@
 
   $ hg rebase -i
   abort: interactive history editing is supported by the 'histedit' extension 
(see "hg --config extensions.histedit= help -e histedit")
-  [255]
+  [10]
 
   $ hg rebase --interactive
   abort: interactive history editing is supported by the 'histedit' extension 
(see "hg --config extensions.histedit= help -e histedit")
-  [255]
+  [10]
 
   $ cd ..
 
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -560,7 +560,7 @@
   rebasing 2:b18e25de2cf5 D "D"
   rebasing 6:f15c3adaf214 F tip "F"
   abort: cannot rebase 6:f15c3adaf214 without moving at least one of its 
parents
-  [255]
+  [10]
 
   $ cd ..
 
@@ -948,7 +948,7 @@
   $ hg rebase -s 10 -d 12
   abort: this rebase will cause divergences from: 121d9e3bc4c6
   (to force the rebase please set experimental.evolution.allowdivergence=True)
-  [255]
+  [10]
   $ hg log -G
   @  14:73568ab6879d bar foo
   |
@@ -1152,7 +1152,7 @@
   $ hg rebase -r 'c'::'f' -d 'x'
   abort: this rebase will cause divergences from: 76be324c128b
   (to force the rebase please set experimental.evolution.allowdivergence=True)
-  [255]
+  [10]
   $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' 
-d 'x'
   rebasing 3:a82ac2b38757 c "c"
   rebasing 4:76be324c128b d "d"
@@ -1566,7 +1566,7 @@
   $ hg rebase -b 'desc("D")' -d 'desc("J")'
   abort: this rebase will cause divergences from: 112478962961
   (to force the rebase please set experimental.evolution.allowdivergence=True)
-  [255]
+  [10]
 
 Rebase merge where both parents have successors in destination
 
@@ -1585,7 +1585,7 @@
   note: not rebasing 5:b23a2cc00842 B "B", already in destination as 
1:058c1e1fb10a D "D"
   rebasing 7:dac5d11c5a7d E tip "E"
   abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 
3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
-  [255]
+  [10]
   $ cd ..
 
 Rebase a non-clean merge. One parent has successor in destination, the other
@@ -1941,7 +1941,7 @@
   $ hg rebase --stop
   abort: cannot remove original changesets with unrebased descendants
   (either enable obsmarkers to allow unstable revisions or use --keep to keep 
original changesets)
-  [255]
+  [20]
   $ hg rebase --abort
   saved backup bundle to 
$TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
   rebase aborted
@@ -2020,7 +2020,7 @@
   [240]
   $ hg rebase --stop
   abort: cannot stop in --collapse session
-  [255]
+  [20]
   $ hg rebase --abort
   rebase aborted
   $ hg diff
diff --git a/tests/test-rebase-newancestor.t b/tests/test-rebase-newancestor.t
--- a/tests/test-rebase-newancestor.t
+++ b/tests/test-rebase-newancestor.t
@@ -154,7 +154,7 @@
   rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
   rebasing 4:4b019212aaf6 "dev: merge default"
   abort: rebasing 4:4b019212aaf6 will include unwanted changes from 
1:1d1a643d390e
-  [255]
+  [10]
   $ cd ..
 
 
@@ -314,7 +314,7 @@
   rebasing 6:b296604d9846 E "E"
   rebasing 7:caa9781e507d F tip "F"
   abort: rebasing 7:caa9781e507d will 

D9913: errors: use InputError for incorrectly formatted dates

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9913

AFFECTED FILES
  mercurial/utils/dateutil.py
  tests/test-parse-date.t

CHANGE DETAILS

diff --git a/tests/test-parse-date.t b/tests/test-parse-date.t
--- a/tests/test-parse-date.t
+++ b/tests/test-parse-date.t
@@ -103,43 +103,43 @@
 
   $ hg log -d "--2"
   abort: -2 must be nonnegative (see 'hg help dates')
-  [255]
+  [10]
 
 Whitespace only
 
   $ hg log -d " "
   abort: dates cannot consist entirely of whitespace
-  [255]
+  [10]
 
 Test date formats with '>' or '<' accompanied by space characters
 
   $ hg log -d '>' --template '{date|date}\n'
   abort: invalid day spec, use '>DATE'
-  [255]
+  [10]
   $ hg log -d '<' --template '{date|date}\n'
   abort: invalid day spec, use '' --template '{date|date}\n'
   abort: invalid day spec, use '>DATE'
-  [255]
+  [10]
   $ hg log -d ' <' --template '{date|date}\n'
   abort: invalid day spec, use ' ' --template '{date|date}\n'
   abort: invalid day spec, use '>DATE'
-  [255]
+  [10]
   $ hg log -d '< ' --template '{date|date}\n'
   abort: invalid day spec, use ' ' --template '{date|date}\n'
   abort: invalid day spec, use '>DATE'
-  [255]
+  [10]
   $ hg log -d ' < ' --template '{date|date}\n'
   abort: invalid day spec, use '02/01' --template '{date|date}\n'
   $ hg log -d '<02/01' --template '{date|date}\n'
diff --git a/mercurial/utils/dateutil.py b/mercurial/utils/dateutil.py
--- a/mercurial/utils/dateutil.py
+++ b/mercurial/utils/dateutil.py
@@ -68,7 +68,9 @@
 timestamp = time.time()
 if timestamp < 0:
 hint = _(b"check your clock")
-raise error.Abort(_(b"negative timestamp: %d") % timestamp, hint=hint)
+raise error.InputError(
+_(b"negative timestamp: %d") % timestamp, hint=hint
+)
 delta = datetime.datetime.utcfromtimestamp(
 timestamp
 ) - datetime.datetime.fromtimestamp(timestamp)
@@ -328,24 +330,26 @@
 date = date.strip()
 
 if not date:
-raise error.Abort(_(b"dates cannot consist entirely of whitespace"))
+raise error.InputError(
+_(b"dates cannot consist entirely of whitespace")
+)
 elif date[0:1] == b"<":
 if not date[1:]:
-raise error.Abort(_(b"invalid day spec, use '":
 if not date[1:]:
-raise error.Abort(_(b"invalid day spec, use '>DATE'"))
+raise error.InputError(_(b"invalid day spec, use '>DATE'"))
 when = lower(date[1:])
 return lambda x: x >= when
 elif date[0:1] == b"-":
 try:
 days = int(date[1:])
 except ValueError:
-raise error.Abort(_(b"invalid day spec: %s") % date[1:])
+raise error.InputError(_(b"invalid day spec: %s") % date[1:])
 if days < 0:
-raise error.Abort(
+raise error.InputError(
 _(b"%s must be nonnegative (see 'hg help dates')") % date[1:]
 )
 when = makedate()[0] - days * 3600 * 24



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9911: errors: use InputError in uncommit extension

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9911

AFFECTED FILES
  hgext/uncommit.py
  tests/test-unamend.t
  tests/test-uncommit.t

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -114,12 +114,12 @@
   $ hg uncommit nothinghere
   abort: cannot uncommit "nothinghere"
   (file does not exist)
-  [255]
+  [10]
   $ hg status
   $ hg uncommit file-abc
   abort: cannot uncommit "file-abc"
   (file was not changed in working directory parent)
-  [255]
+  [10]
   $ hg status
 
 Try partial uncommit, also moves bookmark
@@ -419,7 +419,7 @@
 
   $ hg uncommit
   abort: cannot uncommit merge changeset
-  [255]
+  [10]
 
   $ hg status
   $ hg log -G -T '{rev}:{node} {desc}' --hidden
@@ -585,12 +585,12 @@
   $ hg uncommit emptydir
   abort: cannot uncommit "emptydir"
   (file was untracked in working directory parent)
-  [255]
+  [10]
 
   $ cd emptydir
   $ hg uncommit .
   abort: cannot uncommit "emptydir"
   (file was untracked in working directory parent)
-  [255]
+  [10]
   $ hg status
   $ cd ..
diff --git a/tests/test-unamend.t b/tests/test-unamend.t
--- a/tests/test-unamend.t
+++ b/tests/test-unamend.t
@@ -39,7 +39,7 @@
 
   $ hg unamend
   abort: changeset must have one predecessor, found 0 predecessors
-  [255]
+  [10]
 
 Unamend on clean wdir and tip
 
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -175,7 +175,7 @@
 old = repo[b'.']
 rewriteutil.precheck(repo, [old.rev()], b'uncommit')
 if len(old.parents()) > 1:
-raise error.Abort(_(b"cannot uncommit merge changeset"))
+raise error.InputError(_(b"cannot uncommit merge changeset"))
 
 match = scmutil.match(old, pats, opts)
 
@@ -202,7 +202,7 @@
 else:
 hint = _(b"file does not exist")
 
-raise error.Abort(
+raise error.InputError(
 _(b'cannot uncommit "%s"') % scmutil.getuipathfn(repo)(f),
 hint=hint,
 )
@@ -280,7 +280,7 @@
 markers = list(predecessormarkers(curctx))
 if len(markers) != 1:
 e = _(b"changeset must have one predecessor, found %i 
predecessors")
-raise error.Abort(e % len(markers))
+raise error.InputError(e % len(markers))
 
 prednode = markers[0].prednode()
 predctx = unfi[prednode]



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9910: errors: use exit code 40 for when a hook fails

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  A hook can be used for checking inputs, state, configuration,
  security, etc., so it's unclear which of the existing exit codes to
  use. Let's instead add one specifically for failed hooks. I picked 40.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9910

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-bookmarks-pushpull.t
  tests/test-bookmarks.t
  tests/test-bundle2-exchange.t
  tests/test-commandserver.t
  tests/test-commit-amend.t
  tests/test-dispatch.t
  tests/test-histedit-edit.t
  tests/test-histedit-fold.t
  tests/test-hook.t
  tests/test-mactext.t
  tests/test-merge-tools.t
  tests/test-mq-qfold.t
  tests/test-mq-qnew.t
  tests/test-mq-qrefresh-replace-log-message.t
  tests/test-narrow-pull.t
  tests/test-narrow-widen.t
  tests/test-phases.t
  tests/test-rebase-interruptions.t
  tests/test-rollback.t
  tests/test-share-bookmarks.t
  tests/test-strip.t
  tests/test-tag.t
  tests/test-transplant.t
  tests/test-win32text.t

CHANGE DETAILS

diff --git a/tests/test-win32text.t b/tests/test-win32text.t
--- a/tests/test-win32text.t
+++ b/tests/test-win32text.t
@@ -38,7 +38,7 @@
   transaction abort!
   rollback completed
   abort: pretxncommit.crlf hook failed
-  [255]
+  [40]
 
   $ mv .hg/hgrc .hg/hgrc.bak
 
@@ -77,7 +77,7 @@
   transaction abort!
   rollback completed
   abort: pretxnchangegroup.crlf hook failed
-  [255]
+  [40]
 
   $ mv .hg/hgrc.bak .hg/hgrc
   $ echo hello > f
@@ -109,7 +109,7 @@
   transaction abort!
   rollback completed
   abort: pretxncommit.crlf hook failed
-  [255]
+  [40]
   $ hg revert -a
   forgetting d/f2
   $ rm d/f2
@@ -286,7 +286,7 @@
   transaction abort!
   rollback completed
   abort: pretxnchangegroup.crlf hook failed
-  [255]
+  [40]
 
   $ hg log -v
   changeset:   5:f0b1c8d75fce
diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -1091,7 +1091,7 @@
   transaction abort!
   rollback completed
   abort: pretxncommit.abort hook exited with status 1
-  [255]
+  [40]
   $ cat >> .hg/hgrc < [hooks]
   > pretxncommit.abort = !
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -290,7 +290,7 @@
   $ rm -f .hg/last-message.txt
   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
   abort: pretag.test-saving-lastmessage hook exited with status 1
-  [255]
+  [40]
   $ test -f .hg/last-message.txt
   [1]
 
@@ -325,7 +325,7 @@
   note: commit message saved in .hg/last-message.txt
   note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
   abort: pretxncommit.unexpectedabort hook exited with status 1
-  [255]
+  [40]
   $ cat .hg/last-message.txt
   custom tag message
   second line
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -427,7 +427,7 @@
   strip failed, unrecovered changes stored in 
'$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
   (fix the problem, then recover the changesets with "hg unbundle 
'$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
   abort: pretxnchangegroup.bad hook exited with status 1
-  [255]
+  [40]
   $ restore
   $ hg log -G
   o  changeset:   4:443431ffac4f
diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t
--- a/tests/test-share-bookmarks.t
+++ b/tests/test-share-bookmarks.t
@@ -102,7 +102,7 @@
   transaction abort!
   rollback completed
   abort: pretxnclose hook exited with status 1
-  [255]
+  [40]
   $ hg book bm1
 
 FYI, in contrast to above test, bmX is invisible in repo1 (= shared
@@ -127,7 +127,7 @@
   transaction abort!
   rollback completed
   abort: pretxnclose hook exited with status 1
-  [255]
+  [40]
   $ hg book bm3
 
 clean up bm2 since it's uninteresting (not shared in the vfs case and
@@ -249,7 +249,7 @@
   no changes found
   adding remote bookmark bm3
   abort: forced failure by extension
-  [255]
+  [40]
   $ hg boo
  bm1   3:b87954705719
  bm4   5:92793bfc8cad
diff --git a/tests/test-rollback.t b/tests/test-rollback.t
--- a/tests/test-rollback.t
+++ b/tests/test-rollback.t
@@ -103,7 +103,7 @@
   transaction abort!
   rollback completed
   abort: pretxncommit hook exited with status * (glob)
-  [255]
+  [40]
   $ cat .hg/last-message.txt ; echo
   precious commit message
 
@@ -118,7 +118,7 @@
   note: commit message saved in .hg/last-message.txt
   note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
   abort: pretxncommit hook exited with status * (glob)
-  [255]
+  [40]
   $ cat .hg/last-message.txt
   another precious commit message
 
@@ -380,7 +380,7 @@
   warn during abort
   rollback completed
   abort: pretxncommit hook exited with status 1
-  [255]
+  [40]
 
 

mercurial-devel | Pipeline #17224 has failed for branch/default | 33bafa81

2021-01-29 Thread Heptapod


Your pipeline has failed.

Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default )

Commit: 33bafa81 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commit/33bafa819b28b1d4fb4ef515184d41ebe4e9ac0f
 )
Commit Message: context: add missing manifest invalidation afte...
Commit Author: Augie Fackler

Pipeline #17224 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17224 ) triggered 
by Administrator ( https://foss.heptapod.net/root )
had 5 failed builds.

Job #159407 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159407/raw )

Stage: tests
Name: test-py2-chg
Job #159405 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159405/raw )

Stage: tests
Name: test-py2-rust
Job #159403 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159403/raw )

Stage: tests
Name: test-py2-pure
Job #159401 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159401/raw )

Stage: tests
Name: test-py2
Job #159408 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159408/raw )

Stage: tests
Name: test-py3-chg

-- 
You're receiving this email because of your account on foss.heptapod.net.



___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9909: relnotes: copy "next" to "5.7" and clear "next"

2021-01-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The same procedure as every year^Wcycle.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D9909

AFFECTED FILES
  relnotes/5.7
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -1,55 +1,8 @@
 == New Features ==
 
- * There is a new config section for templates used by hg commands. It
-   is called `[command-templates]`. Some existing config options have
-   been deprecated in favor of config options in the new
-   section. These are: `ui.logtemplate` to `command-templates.log`,
-   `ui.graphnodetemplate` to `command-templates.graphnode`,
-   `ui.mergemarkertemplate` to `command-templates.mergemarker`,
-   `ui.pre-merge-tool-output-template` to
-   `command-templates.pre-merge-tool-output`.
-
- * There is a new set of config options for the template used for the
-   one-line commit summary displayed by various commands, such as `hg
-   rebase`. The main one is `command-templates.oneline-summary`. That
-   can be overridden per command with
-   `command-templates.oneline-summary.`, where ``
-   can be e.g. `rebase`. As part of this effort, the default format
-   from `hg rebase` was reorganized a bit.
-
- * `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.
-
- * The memory footprint per changeset during pull/unbundle
-   operations has been further reduced.
-
- * There is a new internal merge tool called `internal:mergediff` (can
-   be set as the value for the `merge` config in the `[ui]`
-   section). It resolves merges the same was as `internal:merge` and
-   `internal:merge3`, but it shows conflicts differently. Instead of
-   showing 2 or 3 snapshots of the conflicting pieces of code, it
-   shows one snapshot and a diff. This may be useful when at least one
-   side of the conflict is similar to the base. The new marker style
-   is also supported by "premerge" as
-   `merge-tools..premerge=keep-mergediff`.
-
- * External hooks are now called with `HGPLAIN=1` preset.
-
- * The `branchmap` cache is updated more intelligently and can be
-   significantly faster for repositories with many branches and changesets.
-
 
 == New Experimental Features ==
 
-* `experimental.single-head-per-branch:public-changes-only` can be used
-  restrict the single head check to public revision. This is useful for
-  overlay repository that have both a publishing and non-publishing view
-  of the same storage.
-
 
 == Bug Fixes ==
 
@@ -57,9 +10,6 @@
 
 == Backwards Compatibility Changes ==
 
- * `--force-lock` and `--force-wlock` options on `hg debuglock` command are
-   renamed to `--force-free-lock` and `--force-free-wlock` respectively.
-
 
 == Internal API Changes ==
 
diff --git a/relnotes/next b/relnotes/5.7
copy from relnotes/next
copy to relnotes/5.7



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9908: context: add missing manifest invalidation after write in overlayworkingctx

2021-01-29 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was breaking my merge-diff logic that will be in the next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9908

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2597,6 +2597,7 @@
 b'flags': flags,
 b'copied': copied,
 }
+util.clearcachedproperty(self, b'_manifest')
 
 def filectx(self, path, filelog=None):
 return overlayworkingfilectx(



To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@46414: 32 new changesets (3 on stable)

2021-01-29 Thread Mercurial Commits
32 new changesets (3 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/374d7fff7cb5
changeset:   46383:374d7fff7cb5
user:Pierre-Yves David 
date:Mon Jan 25 16:34:43 2021 +0100
summary: store: use `endswith` to detect revlog extension

https://www.mercurial-scm.org/repo/hg/rev/7bb31c367847
changeset:   46384:7bb31c367847
user:Pierre-Yves David 
date:Tue Jan 26 00:45:40 2021 +0100
summary: run-test: avoid byte issue when replacing output file of python 
test

https://www.mercurial-scm.org/repo/hg/rev/aaff3bc75306
changeset:   46385:aaff3bc75306
user:Pierre-Yves David 
date:Mon Jan 25 23:07:56 2021 +0100
summary: minirst: respect escaping in definition list key

https://www.mercurial-scm.org/repo/hg/rev/d481f30ea8e3
changeset:   46386:d481f30ea8e3
user:Pierre-Yves David 
date:Mon Jan 25 23:08:33 2021 +0100
summary: help: escape ':' (as '\:') when generating command names

https://www.mercurial-scm.org/repo/hg/rev/c41ac8985fe4
changeset:   46387:c41ac8985fe4
user:Pierre-Yves David 
date:Mon Jan 25 23:13:01 2021 +0100
summary: perf: test the formatting of a command help

https://www.mercurial-scm.org/repo/hg/rev/d8ad391e10f5
changeset:   46388:d8ad391e10f5
user:Pierre-Yves David 
date:Mon Jan 25 16:46:51 2021 +0100
summary: command-namespace: use `::` are the command separator

https://www.mercurial-scm.org/repo/hg/rev/38b9a63d3a13
changeset:   46389:38b9a63d3a13
user:Matt Harbison 
date:Mon Jan 25 19:03:27 2021 -0500
summary: cext: restore the ability to build on Windows with py2

https://www.mercurial-scm.org/repo/hg/rev/0800aa42bb4c
changeset:   46390:0800aa42bb4c
user:Simon Sapin 
date:Fri Jan 15 16:11:54 2021 +0100
summary: rust: use the bytes-cast crate to parse persistent nodemaps

https://www.mercurial-scm.org/repo/hg/rev/cfb6c10c08c2
changeset:   46391:cfb6c10c08c2
user:Simon Sapin 
date:Mon Jan 25 11:34:23 2021 +0100
summary: rust: replace an unsafe use of transmute with a safe use of 
bytes-cast

https://www.mercurial-scm.org/repo/hg/rev/f25c770c217b
changeset:   46392:f25c770c217b
user:Joerg Sonnenberger 
date:Tue Jan 26 00:19:36 2021 +0100
summary: debugshell: add a simple command for starting an interactive shell

https://www.mercurial-scm.org/repo/hg/rev/66e8e279133b
changeset:   46393:66e8e279133b
user:Matt Harbison 
date:Tue Jan 26 17:25:30 2021 -0500
summary: hghave: list the module needed for the `vcr` check

https://www.mercurial-scm.org/repo/hg/rev/8477c91b5e8e
changeset:   46394:8477c91b5e8e
user:Augie Fackler 
date:Fri Jan 22 15:29:12 2021 -0500
summary: histedit: don't assign to _ for unused values

https://www.mercurial-scm.org/repo/hg/rev/a936e570288d
changeset:   46395:a936e570288d
user:Augie Fackler 
date:Fri Jan 22 15:32:00 2021 -0500
summary: histedit: notice when the main window underflows height and abort

https://www.mercurial-scm.org/repo/hg/rev/11ce2977572f
changeset:   46396:11ce2977572f
user:Augie Fackler 
date:Fri Jan 22 15:43:06 2021 -0500
summary: histedit: rip out mysterious catch-all ignore curses.error handler

https://www.mercurial-scm.org/repo/hg/rev/f213b250fed0
changeset:   46397:f213b250fed0
user:Pierre-Yves David 
date:Sat Jan 16 02:18:55 2021 +0100
summary: copies: explicitly filter out existing file in graftcopies

https://www.mercurial-scm.org/repo/hg/rev/154ded9104f1
changeset:   46398:154ded9104f1
user:Pierre-Yves David 
date:Fri Jan 15 23:49:51 2021 +0100
summary: copies: clarify which case some conditional are handling

https://www.mercurial-scm.org/repo/hg/rev/1d6d1a15a963
changeset:   46399:1d6d1a15a963
user:Pierre-Yves David 
date:Fri Jan 15 23:58:41 2021 +0100
summary: copies: simplify the conditional for _filter's case 3

https://www.mercurial-scm.org/repo/hg/rev/7525e77b5eac
changeset:   46400:7525e77b5eac
user:Nikita Slyusarev 
date:Tue Jan 12 00:11:16 2021 +0300
summary: convert: option to set date and time for svn commits

https://www.mercurial-scm.org/repo/hg/rev/2aef69e8efbb
changeset:   46401:2aef69e8efbb
user:Pierre-Yves David 
date:Wed Jan 27 15:53:32 2021 +0100
summary: heptapod-ci: add a default value for HG_CI_IMAGE_TAG

https://www.mercurial-scm.org/repo/hg/rev/6b0dac9f650a
changeset:   46402:6b0dac9f650a
user:Pierre-Yves David 
date:Wed Jan 27 14:57:20 2021 +0100
summary: heptapod-ci: indicate which version of black is used for the run

https://www.mercurial-scm.org/repo/hg/rev/959d581bb625
changeset:   46403:959d581bb625
user:Pierre-Yves David 
date:Wed Jan 27 14:58:24 2021 +0100
summary: black: show required version in skip message

https://www.mercurial-scm.org/repo/hg/rev/a390c7fcd286
changeset:   

mercurial-devel | Pipeline #17203 has failed for branch/default | b8885ce5

2021-01-29 Thread Heptapod


Your pipeline has failed.

Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default )

Commit: b8885ce5 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commit/b8885ce54f929a0d6358910d40c9e2301d541cfc
 )
Commit Message: merge with stable

Commit Author: Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal )

Pipeline #17203 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17203 ) triggered 
by Administrator ( https://foss.heptapod.net/root )
had 5 failed builds.

Job #159183 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159183/raw )

Stage: tests
Name: test-py3-chg
Job #159182 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159182/raw )

Stage: tests
Name: test-py2-chg
Job #159176 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159176/raw )

Stage: tests
Name: test-py2
Job #159180 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159180/raw )

Stage: tests
Name: test-py2-rust
Job #159178 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/159178/raw )

Stage: tests
Name: test-py2-pure

-- 
You're receiving this email because of your account on foss.heptapod.net.



___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9907: rhg: Build in release mode on CI

2021-01-29 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This follows e73b40c790ec 
 
which made tests use the release executable.
  With e73b40c790ec 
 
but not this, tests are skipped on CI
  because the executable is missing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9907

AFFECTED FILES
  contrib/heptapod-ci.yml

CHANGE DETAILS

diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml
+++ b/contrib/heptapod-ci.yml
@@ -32,7 +32,7 @@
   - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
   - ls -1 tests/test-check-*.* > /tmp/check-tests.txt
   - cd /tmp/mercurial-ci/rust/rhg
-  - cargo build
+  - cargo build --release
   - cd /tmp/mercurial-ci/
 
 



To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel