D8815: dirstate: isolate node len dependency for the pure version

2020-07-24 Thread joerg.sonnenberger (Joerg Sonnenberger)
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When switching to a 256bit hash function, this still needs adjustment,
  but concentrates the change in one place.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1425,6 +1425,7 @@
 self._opener = opener
 self._root = root
 self._filename = b'dirstate'
+self._nodelen = 20
 
 self._parents = None
 self._dirtyparents = False
@@ -1609,7 +1610,7 @@
 if not self._parents:
 try:
 fp = self._opendirstatefile()
-st = fp.read(40)
+st = fp.read(2 * self._nodelen)
 fp.close()
 except IOError as err:
 if err.errno != errno.ENOENT:
@@ -1618,8 +1619,11 @@
 st = b''
 
 l = len(st)
-if l == 40:
-self._parents = (st[:20], st[20:40])
+if l == self._nodelen * 2:
+self._parents = (
+st[: self._nodelen],
+st[self._nodelen : 2 * self._nodelen],
+)
 elif l == 0:
 self._parents = (nullid, nullid)
 else:
@@ -1655,15 +1659,17 @@
 if util.safehasattr(parsers, b'dict_new_presized'):
 # Make an estimate of the number of files in the dirstate based on
 # its size. From a linear regression on a set of real-world repos,
-# all over 10,000 files, the size of a dirstate entry is 85
-# bytes. The cost of resizing is significantly higher than the cost
+# all over 10,000 files, the size of a dirstate entry is 2 nodes
+# plus 45 bytes. The cost of resizing is significantly higher than 
the cost
 # of filling in a larger presized dict, so subtract 20% from the
 # size.
 #
 # This heuristic is imperfect in many ways, so in a future dirstate
 # format update it makes sense to just record the number of entries
 # on write.
-self._map = parsers.dict_new_presized(len(st) // 71)
+self._map = parsers.dict_new_presized(
+len(st) // ((2 * self._nodelen + 45) * 4 // 5)
+)
 
 # Python's garbage collector triggers a GC each time a certain number
 # of container objects (the number being defined by
@@ -1829,7 +1835,7 @@
 if not self._parents:
 try:
 fp = self._opendirstatefile()
-st = fp.read(40)
+st = fp.read(2 * self._nodelen)
 fp.close()
 except IOError as err:
 if err.errno != errno.ENOENT:



To: joerg.sonnenberger, #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


D8814: tests: make check-py3-compat.py actually load the specified files correctly

2020-07-24 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  For most uses, this change is essentially a no-op, as this script is generally
  only run by test-check-py3-compat.t, which will already put `$TESTDIR/..` in
  `$PYTHONPATH`.
  
  When running outside of tests, however, `$PYTHONPATH` is likely not set, 
causing
  check-py3-compat.py to parse the file from the repo, but then import the
  installed version, and raise any errors about the installed version, not the 
one
  currently in the repo.
  
  Additionally, this helps users (like me) who have a strange set up where their
  home directory (and thus their hg repos) happen to be in a subdirectory of
  sys.prefix (which is /usr on my system). Since the '.' entry added to sys.path
  takes precedence over the absolute path of `$TESTDIR/..` in `$PYTHONPATH`, the
  path to the modules that it imports (and that show up in any stack trace) are
  *relative*, meaning that we don't detect them as starting with `sys.prefix`.
  
  Sample non-test invocation, and the difference this change makes (the path for
  'error at :' is correct now)::
  
  Before:
  
$ python3 contrib/check-py3-compat.py mercurial/win*.py
mercurial/win32.py: error importing:  _type_ 'v' not supported 
(error at check-py3-compat.py:65)
mercurial/windows.py: error importing:  No module 
named 'msvcrt' (error at check-py3-compat.py:65)
  
  After:
  
$ python3 contrib/check-py3-compat.py mercurial/win*.py
mercurial/win32.py: error importing:  _type_ 'v' not supported 
(error at win32.py:11)
mercurial/windows.py: error importing:  No module 
named 'msvcrt' (error at windows.py:12)

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/check-py3-compat.py

CHANGE DETAILS

diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py
--- a/contrib/check-py3-compat.py
+++ b/contrib/check-py3-compat.py
@@ -97,6 +97,15 @@
 if sys.version_info[0] == 2:
 fn = check_compat_py2
 else:
+# check_compat_py3 will import every filename we specify as long as it
+# starts with one of a few prefixes. It does this by converting
+# specified filenames like 'mercurial/foo.py' to 'mercurial.foo' and
+# importing that. When running standalone (not as part of a test), this
+# means we actually import the installed versions, not the files we 
just
+# specified. When running as test-check-py3-compat.t, we technically
+# would import the correct paths, but it's cleaner to have both cases
+# use the same import logic.
+sys.path.insert(0, '.')
 fn = check_compat_py3
 
 for f in sys.argv[1:]:



To: spectral, #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


D8813: tests: make test-install.t work on debian systems

2020-07-24 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Debian systems, at least as of their version of python3.8 on my machine, have
  rewritten some logic in ensurepip to make it not use the wheels in 
pip._bundled,
  but instead to use wheels installed in /usr/share/python-wheels. It copies 
these
  wheels into the virtual environment when it's created, and installenv/bin/pip 
is
  able to see them and use them, so it thinks that 'wheel' is installed, and 
that
  it can build the mercurial wheel instead of just installing it. For some 
reason,
  when it subprocesses to run `python3 setup.py bdist_wheel`, it setup.py does
  *not* have the 'wheel' wheel available, and we get an error message.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-install.t

CHANGE DETAILS

diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -187,6 +187,14 @@
 #if py3 ensurepip
   $ "$PYTHON" -m venv installenv >> pip.log
 
+Hack: Debian does something a bit different in ensurepip.bootstrap. This makes
+it so that pip thinks the 'wheel' wheel is installed so it can build wheels;
+when it goes to try, however, it shells out to run `python3 -u `,
+that *doesn't* get the 'wheel' wheel, and it fails with an invalid command
+'bdist_wheel'. To fix this, we just delete the wheel from where Debian put it 
in
+our virtual env. Then pip doesn't think it's installed and doesn't try to 
build.
+  $ rm installenv/share/python-wheels/wheel-*.whl >/dev/null 2>&1 || true
+
 Note: we use this weird path to run pip and hg to avoid platform differences,
 since it's bin on most platforms but Scripts on Windows.
   $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log



To: spectral, #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


D8812: tests: virtualenv is only used on py2, rename and conditionalize

2020-07-24 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If I have I have the Debian `python3-virtualenv` package installed on my
  machine, the import succeeds but then I receive an AttributeError because the
  package is essentially completely different between py2 and py3, and
  test-hghave fails.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py
  tests/test-install.t

CHANGE DETAILS

diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -214,7 +214,7 @@
   no problems detected
 #endif
 
-#if no-py3 virtualenv
+#if py2virtualenv
 
 Note: --no-site-packages is deprecated, but some places have an
 ancient virtualenv from their linux distro or similar and it's not yet
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -886,8 +886,11 @@
 return False
 
 
-@check("virtualenv", "Python virtualenv support")
-def has_virtualenv():
+@check("py2virtualenv", "Python2 virtualenv support")
+def has_py2virtualenv():
+if sys.version_info[0] != 2:
+return False
+
 try:
 import virtualenv
 



To: spectral, #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


D8811: morestatus: mention --stop even if not using --verbose

2020-07-24 Thread spectral (Kyle Lippincott)
spectral 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/D8811

AFFECTED FILES
  mercurial/state.py
  tests/test-absorb-unfinished.t
  tests/test-fix.t
  tests/test-rebase-abort.t
  tests/test-rebase-inmemory.t
  tests/test-rebase-obsolete.t

CHANGE DETAILS

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
@@ -2055,7 +2055,7 @@
 
   $ hg rebase -s 3 -d 5
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
   $ hg rebase --stop --continue
   abort: cannot specify both --stop and --continue
diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -901,7 +901,7 @@
   [1]
   $ hg rebase -r 3 -d 1 -t:merge3
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
   $ hg resolve --list
   U foo
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -327,7 +327,7 @@
   $ echo new > a
   $ hg up 1   # user gets an error saying to run hg rebase --abort
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
 
   $ cat a
@@ -397,20 +397,20 @@
 
   $ hg rebase -s 3 -d tip
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
   $ hg up .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
   $ hg up -C .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
 
   $ hg graft 3
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
 
   $ hg abort
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -878,7 +878,7 @@
 
   $ hg --config extensions.rebase= fix -r .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
 
   $ cd ..
diff --git a/tests/test-absorb-unfinished.t b/tests/test-absorb-unfinished.t
--- a/tests/test-absorb-unfinished.t
+++ b/tests/test-absorb-unfinished.t
@@ -25,6 +25,6 @@
 
   $ hg --config extensions.rebase= absorb
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
   [255]
 
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -164,10 +164,19 @@
 operation
 """
 if not self._cmdhint:
-return _(b"use 'hg %s --continue' or 'hg %s --abort'") % (
-self._opname,
-self._opname,
-)
+if not self._stopflag:
+return _(b"use 'hg %s --continue' or 'hg %s --abort'") % (
+self._opname,
+self._opname,
+)
+else:
+return _(b"use 'hg %s --continue', 'hg %s --abort', "
+ b"or 'hg %s --stop'") % (
+self._opname,
+self._opname,
+self._opname,
+)
+
 return self._cmdhint
 
 def msg(self):



To: spectral, #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


D8810: templater: handle None returned from templatedir()

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  My recent 91aa9bba3dc9 
 
(templater: make templatepaths() return a
  single path, or None, 2020-07-21) didn't account for the fact that
  `templatedir()` returns `None` in frozen binaries. That is ironic,
  since the reason I'm working on this is to add support for built-in
  mapfiles in frozen binaries. This patch updates the callers to handle
  the `None` case. It's somewhat ugly, but I will have to revisit this
  soon anyway, since my goal is to make all callers handle that case by
  trying to read the map file using the resources API instead.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/hgweb/hgwebdir_mod.py
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -828,6 +828,8 @@
 def include(rel, abs, remap, sections):
 templatedirs = [base, templatedir()]
 for dir in templatedirs:
+if dir is None:
+continue
 abs = os.path.normpath(os.path.join(dir, rel))
 if os.path.isfile(abs):
 data = util.posixfile(abs, b'rb').read()
@@ -850,13 +852,15 @@
 
 # fallback check in template paths
 if not os.path.exists(path):
-p2 = util.normpath(os.path.join(templatedir(), val))
-if os.path.isfile(p2):
-path = p2
-else:
-p3 = util.normpath(os.path.join(p2, b"map"))
-if os.path.isfile(p3):
-path = p3
+dir = templatedir()
+if dir is not None:
+p2 = util.normpath(os.path.join(dir, val))
+if os.path.isfile(p2):
+path = p2
+else:
+p3 = util.normpath(os.path.join(p2, b"map"))
+if os.path.isfile(p3):
+path = p3
 
 cache, tmap, aliases = _readmapfile(path)
 
@@ -1064,6 +1068,9 @@
 
 def templatepath(name):
 '''return location of template file. returns None if not found.'''
+dir = templatedir()
+if dir is None:
+return None
 f = os.path.join(templatedir(), name)
 if f and os.path.exists(f):
 return f
@@ -1085,22 +1092,23 @@
 if isinstance(styles, bytes):
 styles = [styles]
 
-for style in styles:
-# only plain name is allowed to honor template paths
-if (
-not style
-or style in (pycompat.oscurdir, pycompat.ospardir)
-or pycompat.ossep in style
-or pycompat.osaltsep
-and pycompat.osaltsep in style
-):
-continue
-locations = [os.path.join(style, b'map'), b'map-' + style]
-locations.append(b'map')
+if path is not None:
+for style in styles:
+# only plain name is allowed to honor template paths
+if (
+not style
+or style in (pycompat.oscurdir, pycompat.ospardir)
+or pycompat.ossep in style
+or pycompat.osaltsep
+and pycompat.osaltsep in style
+):
+continue
+locations = [os.path.join(style, b'map'), b'map-' + style]
+locations.append(b'map')
 
-for location in locations:
-mapfile = os.path.join(path, location)
-if os.path.isfile(mapfile):
-return style, mapfile
+for location in locations:
+mapfile = os.path.join(path, location)
+if os.path.isfile(mapfile):
+return style, mapfile
 
 raise RuntimeError(b"No hgweb templates found in %r" % path)
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -415,7 +415,8 @@
 static = self.ui.config(b"web", b"static", untrusted=False)
 if not static:
 tp = self.templatepath or templater.templatedir()
-static = [os.path.join(tp, b'static')]
+if tp is not None:
+static = [os.path.join(tp, b'static')]
 
 staticfile(static, fname, res)
 return res.sendresponse()
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1669,7 +1669,7 @@
 
 # templates
 p = templater.templatedir()
-fm.write(b'templatedirs', b'checking templates (%s)...\n', p)
+fm.write(b'templatedirs', b'checking templates (%s)...\n', p or b'')
 

D8809: templater: reuse check for both "map-cmdline." and ""

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We had two callers of `templatepath()` that did the same test for both
  "map-cmdline." and "", so let's move that into
  `templatepath()` so we can reuse it. It should be harmless for the `hg
  debuginstall` (it just means an extra file-system check in the case of
  broken installs).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/formatter.py
  mercurial/logcmdutil.py
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1064,9 +1064,10 @@
 
 def templatepath(name):
 '''return location of template file. returns None if not found.'''
-f = os.path.join(templatedir(), name)
-if f and os.path.isfile(f):
-return f
+for filename in (b'map-cmdline.' + name, name):
+f = os.path.join(templatedir(), filename)
+if f and os.path.isfile(f):
+return f
 return None
 
 
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -628,9 +628,7 @@
 if not tmpl and style:
 mapfile = style
 if not os.path.split(mapfile)[0]:
-mapname = templater.templatepath(
-b'map-cmdline.' + mapfile
-) or templater.templatepath(mapfile)
+mapname = templater.templatepath(mapfile)
 if mapname:
 mapfile = mapname
 return templatespec(None, mapfile)
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -581,9 +581,7 @@
 
 # perhaps a stock style?
 if not os.path.split(tmpl)[0]:
-mapname = templater.templatepath(
-b'map-cmdline.' + tmpl
-) or templater.templatepath(tmpl)
+mapname = templater.templatepath(tmpl)
 if mapname:
 return templatespec(topic, None, mapname)
 
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1672,7 +1672,7 @@
 fm.write(b'templatedirs', b'checking templates (%s)...\n', p)
 fm.condwrite(not p, b'', _(b" no template directories found\n"))
 if p:
-m = templater.templatepath(b"map-cmdline.default")
+m = templater.templatepath(b"default")
 if m:
 # template found, check if it is working
 err = None



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


D8808: fix: update documentation to reflect preference for --source over --rev

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I should have updated the documentation in 5205b46bd887 
 
(fix: add a -s
  option to format a revision and its descendants, 2020-03-13) and/or
  a6ef1e8e2f6d 
 
(fix: mark -r as advanced, 2020-03-13)...

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -241,15 +241,15 @@
 of files, unless the --whole flag is used. Some tools may always affect the
 whole file regardless of --whole.
 
-If revisions are specified with --rev, those revisions will be checked, and
-they may be replaced with new revisions that have fixed file content.  It 
is
-desirable to specify all descendants of each specified revision, so that 
the
-fixes propagate to the descendants. If all descendants are fixed at the 
same
-time, no merging, rebasing, or evolution will be required.
+If --working-dir is used, files with uncommitted changes in the working 
copy
+will be fixed. Note that no backup are made.
 
-If --working-dir is used, files with uncommitted changes in the working 
copy
-will be fixed. If the checked-out revision is also fixed, the working
-directory will update to the replacement revision.
+If revisions are specified with --source, those revisions and their
+descendants will be checked, and they may be replaced with new revisions
+that have fixed file content. By automatically including the descendants,
+no merging, rebasing, or evolution will be required. If an ancestor of the
+working copy is included, then the working copy itself will also be fixed,
+and the working copy will be updated to the fixed parent.
 
 When determining what lines of each file to fix at each revision, the whole
 set of revisions being fixed is considered, so that fixes to earlier



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


[PATCH 10 of 11] commitctx: gather more preparation code within the lock context

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595541503 -7200
#  Thu Jul 23 23:58:23 2020 +0200
# Node ID 8c926a9ea89ea18ba068fd59314b73d7f6f7db27
# Parent  8bd4fa80f2550e94ab3592ae6543649bf8af5449
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
8c926a9ea89e
commitctx: gather more preparation code within the lock context

This is a small change that exist mostly for clarification. I am about to move a
large amount of code in its own function. having all that code next to each
other will make the next changeset clearer.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -63,14 +63,14 @@ def commitctx(repo, ctx, error=False, or
 p1, p2 = ctx.p1(), ctx.p2()
 user = ctx.user()
 
-writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+with repo.lock(), repo.transaction(b"commit") as tr:
+writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
 
-p1copies, p2copies = None, None
-if writechangesetcopy:
-p1copies = ctx.p1copies()
-p2copies = ctx.p2copies()
-filesadded, filesremoved = None, None
-with repo.lock(), repo.transaction(b"commit") as tr:
+p1copies, p2copies = None, None
+if writechangesetcopy:
+p1copies = ctx.p1copies()
+p2copies = ctx.p2copies()
+filesadded, filesremoved = None, None
 if ctx.manifestnode():
 # reuse an existing manifest revision
 repo.ui.debug(b'reusing known manifest\n')

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


[PATCH 07 of 11] commitctx: treat `filesadded` more like `filesremoved`

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595538480 -7200
#  Thu Jul 23 23:08:00 2020 +0200
# Node ID aa121e67dfaa9d793dcd375c16f91d21060f22fb
# Parent  4eeff7ebf46eb591767ca79fbceb447b2d3ca17d
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
aa121e67dfaa
commitctx: treat `filesadded` more like `filesremoved`

Accumulating the filename in a list will have a negligible cost and deal with
the list of added files like the other ones will make is code cleaning simpler.
The two variable with very close name is not great, but my plan is to split most
of the code in a separated function which will make the "problem" go away by
itself.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -94,7 +94,7 @@ def commitctx(repo, ctx, error=False, or
 
 # check in files
 added = []
-filesadded = []
+files_added = []
 removed = list(ctx.removed())
 touched = []
 linkrev = len(repo)
@@ -113,8 +113,8 @@ def commitctx(repo, ctx, error=False, or
 )
 if is_touched:
 touched.append(f)
-if writechangesetcopy and is_touched == 'added':
-filesadded.append(f)
+if is_touched == 'added':
+files_added.append(f)
 m.setflag(f, fctx.flags())
 except OSError:
 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
@@ -143,6 +143,7 @@ def commitctx(repo, ctx, error=False, or
 
 if writechangesetcopy:
 filesremoved = removed
+filesadded = files_added
 
 if not writefilecopymeta:
 # If writing only to changeset extras, use None to indicate that

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


[PATCH 08 of 11] commitctx: extract all the manual logic to process the files

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595521545 -7200
#  Thu Jul 23 18:25:45 2020 +0200
# Node ID 59f2136c091bc68c96fb56e7618128b77b62194e
# Parent  aa121e67dfaa9d793dcd375c16f91d21060f22fb
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
59f2136c091b
commitctx: extract all the manual logic to  process the files

that branch of the if is significantly more complicated than the other two.
Moving it to its own function make it simple to keep the scope limited and to
read to the higher level function.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -84,66 +84,10 @@ def commitctx(repo, ctx, error=False, or
 mn = p1.manifestnode()
 files = []
 else:
-m1ctx = p1.manifestctx()
-m2ctx = p2.manifestctx()
-mctx = m1ctx.copy()
-
-m = mctx.read()
-m1 = m1ctx.read()
-m2 = m2ctx.read()
-
-# check in files
-added = []
-files_added = []
-removed = list(ctx.removed())
-touched = []
-linkrev = len(repo)
-repo.ui.note(_(b"committing files:\n"))
-uipathfn = scmutil.getuipathfn(repo)
-for f in sorted(ctx.modified() + ctx.added()):
-repo.ui.note(uipathfn(f) + b"\n")
-try:
-fctx = ctx[f]
-if fctx is None:
-removed.append(f)
-else:
-added.append(f)
-m[f], is_touched = _filecommit(
-repo, fctx, m1, m2, linkrev, tr, writefilecopymeta,
-)
-if is_touched:
-touched.append(f)
-if is_touched == 'added':
-files_added.append(f)
-m.setflag(f, fctx.flags())
-except OSError:
-repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
-raise
-except IOError as inst:
-errcode = getattr(inst, 'errno', errno.ENOENT)
-if error or errcode and errcode != errno.ENOENT:
-repo.ui.warn(
-_(b"trouble committing %s!\n") % uipathfn(f)
-)
-raise
-
-# update manifest
-removed = [f for f in removed if f in m1 or f in m2]
-drop = sorted([f for f in removed if f in m])
-for f in drop:
-del m[f]
-if p2.rev() != nullrev:
-rf = metadata.get_removal_filter(ctx, (p1, p2, m1, m2))
-removed = [f for f in removed if not rf(f)]
-
-touched.extend(removed)
-
-files = touched
-mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
-
+mn, files, added, removed = _process_files(tr, ctx, error=error)
 if writechangesetcopy:
 filesremoved = removed
-filesadded = files_added
+filesadded = added
 
 if not writefilecopymeta:
 # If writing only to changeset extras, use None to indicate that
@@ -192,6 +136,71 @@ def commitctx(repo, ctx, error=False, or
 return n
 
 
+def _process_files(tr, ctx, error=False):
+repo = ctx.repo()
+p1 = ctx.p1()
+p2 = ctx.p2()
+
+writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+
+m1ctx = p1.manifestctx()
+m2ctx = p2.manifestctx()
+mctx = m1ctx.copy()
+
+m = mctx.read()
+m1 = m1ctx.read()
+m2 = m2ctx.read()
+
+# check in files
+added = []
+filesadded = []
+removed = list(ctx.removed())
+touched = []
+linkrev = len(repo)
+repo.ui.note(_(b"committing files:\n"))
+uipathfn = scmutil.getuipathfn(repo)
+for f in sorted(ctx.modified() + ctx.added()):
+repo.ui.note(uipathfn(f) + b"\n")
+try:
+fctx = ctx[f]
+if fctx is None:
+removed.append(f)
+else:
+added.append(f)
+m[f], is_touched = _filecommit(
+repo, fctx, m1, m2, linkrev, tr, writefilecopymeta,
+)
+if is_touched:
+touched.append(f)
+if is_touched == 'added':
+filesadded.append(f)
+m.setflag(f, fctx.flags())
+except OSError:
+repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
+raise
+except IOError as inst:
+errcode = getattr(inst, 'errno', errno.ENOENT)
+if error or errcode and errcode != 

[PATCH 09 of 11] commitctx: move a special case about files earlier

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595540459 -7200
#  Thu Jul 23 23:40:59 2020 +0200
# Node ID 8bd4fa80f2550e94ab3592ae6543649bf8af5449
# Parent  59f2136c091bc68c96fb56e7618128b77b62194e
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
8bd4fa80f255
commitctx: move a special case about files earlier

Same logic as a changeset a bit earlier, the `writefilecopymeta` section is more
a post processing details so we move the conditional about `files` value closer
to the rest of the code computing `files` value.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -89,6 +89,9 @@ def commitctx(repo, ctx, error=False, or
 filesremoved = removed
 filesadded = added
 
+if origctx and origctx.manifestnode() == mn:
+files = origctx.files()
+
 if not writefilecopymeta:
 # If writing only to changeset extras, use None to indicate that
 # no entry should be written. If writing to both, write an empty
@@ -99,9 +102,6 @@ def commitctx(repo, ctx, error=False, or
 filesadded = filesadded or None
 filesremoved = filesremoved or None
 
-if origctx and origctx.manifestnode() == mn:
-files = origctx.files()
-
 # update changelog
 repo.ui.note(_(b"committing changelog\n"))
 repo.changelog.delayupdate(tr)

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


[PATCH 06 of 11] commitctx: move `writechangesetcopy` business at the end a code section

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595537909 -7200
#  Thu Jul 23 22:58:29 2020 +0200
# Node ID 4eeff7ebf46eb591767ca79fbceb447b2d3ca17d
# Parent  87553bac39d2fec8dd7b23b44152ec89bcb2f74d
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
4eeff7ebf46e
commitctx: move `writechangesetcopy` business at the end a code section

This code is to handle a specific subcase so we move it a the end. This allow 
to gather the rest of the "core" code closer to the related logic.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -138,12 +138,12 @@ def commitctx(repo, ctx, error=False, or
 
 touched.extend(removed)
 
+files = touched
+mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
+
 if writechangesetcopy:
 filesremoved = removed
 
-files = touched
-mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
-
 if not writefilecopymeta:
 # If writing only to changeset extras, use None to indicate that
 # no entry should be written. If writing to both, write an empty

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


[PATCH 11 of 11] commitctx: extract all the file preparation logic in a new function

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595541151 -7200
#  Thu Jul 23 23:52:31 2020 +0200
# Node ID 68263067cc8120b2f6434ed282147966b67e7214
# Parent  8c926a9ea89ea18ba068fd59314b73d7f6f7db27
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
68263067cc81
commitctx: extract all the file preparation logic in a new function

Before we actually start to create a new commit we have a large block of logic
that do the necessary file and manifest commit and that determine which files
are been affected by the commit (and how).

This is a complex process on its own. It return a "simple" output that can be
fed to the next step. The output itself is not that simple as we return a lot of
individual items (files, added, removed, ...). My next step (and actual goal for
this cleanup) will be to simplify the return by returning a richer object that
will be more suited for the variation of data we want to store.

After this changeset the `commitctx` is a collection of smaller function with
limited scope. The largest one is still `_filecommit` without about 100 lines of
code.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -64,43 +64,8 @@ def commitctx(repo, ctx, error=False, or
 user = ctx.user()
 
 with repo.lock(), repo.transaction(b"commit") as tr:
-writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
-
-p1copies, p2copies = None, None
-if writechangesetcopy:
-p1copies = ctx.p1copies()
-p2copies = ctx.p2copies()
-filesadded, filesremoved = None, None
-if ctx.manifestnode():
-# reuse an existing manifest revision
-repo.ui.debug(b'reusing known manifest\n')
-mn = ctx.manifestnode()
-files = ctx.files()
-if writechangesetcopy:
-filesadded = ctx.filesadded()
-filesremoved = ctx.filesremoved()
-elif not ctx.files():
-repo.ui.debug(b'reusing manifest from p1 (no file change)\n')
-mn = p1.manifestnode()
-files = []
-else:
-mn, files, added, removed = _process_files(tr, ctx, error=error)
-if writechangesetcopy:
-filesremoved = removed
-filesadded = added
-
-if origctx and origctx.manifestnode() == mn:
-files = origctx.files()
-
-if not writefilecopymeta:
-# If writing only to changeset extras, use None to indicate that
-# no entry should be written. If writing to both, write an empty
-# entry to prevent the reader from falling back to reading
-# filelogs.
-p1copies = p1copies or None
-p2copies = p2copies or None
-filesadded = filesadded or None
-filesremoved = filesremoved or None
+r = _prepare_files(tr, ctx, error=error, origctx=origctx)
+mn, files, p1copies, p2copies, filesadded, filesremoved = r
 
 # update changelog
 repo.ui.note(_(b"committing changelog\n"))
@@ -136,6 +101,51 @@ def commitctx(repo, ctx, error=False, or
 return n
 
 
+def _prepare_files(tr, ctx, error=False, origctx=None):
+repo = ctx.repo()
+p1 = ctx.p1()
+
+writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+
+p1copies, p2copies = None, None
+if writechangesetcopy:
+p1copies = ctx.p1copies()
+p2copies = ctx.p2copies()
+filesadded, filesremoved = None, None
+if ctx.manifestnode():
+# reuse an existing manifest revision
+repo.ui.debug(b'reusing known manifest\n')
+mn = ctx.manifestnode()
+files = ctx.files()
+if writechangesetcopy:
+filesadded = ctx.filesadded()
+filesremoved = ctx.filesremoved()
+elif not ctx.files():
+repo.ui.debug(b'reusing manifest from p1 (no file change)\n')
+mn = p1.manifestnode()
+files = []
+else:
+mn, files, added, removed = _process_files(tr, ctx, error=error)
+if writechangesetcopy:
+filesremoved = removed
+filesadded = added
+
+if origctx and origctx.manifestnode() == mn:
+files = origctx.files()
+
+if not writefilecopymeta:
+# If writing only to changeset extras, use None to indicate that
+# no entry should be written. If writing to both, write an empty
+# entry to prevent the reader from falling back to reading
+# filelogs.
+p1copies = p1copies or None
+p2copies = p2copies or None
+filesadded = filesadded or None
+filesremoved = filesremoved or None
+
+return mn, files, p1copies, p2copies, filesadded, filesremoved
+
+
 def _process_files(tr, ctx, error=False):
 repo = ctx.repo()
 p1 = ctx.p1()


[PATCH 04 of 11] commitctx: no longer use the `writecopiesto` variable in the function

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595531010 -7200
#  Thu Jul 23 21:03:30 2020 +0200
# Node ID 93c606831026b6c9644ad84a89204a2338a8aa03
# Parent  113fcffb030358b64b4cf7331bbde2e85758ab27
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
93c606831026
commitctx: no longer use the `writecopiesto` variable in the function

The `writefilecopymeta` variable already carry the same information, so we can
use `writefilecopymeta` in the one conditional where `writecopiesto` was used.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -47,7 +47,6 @@ def commitctx(repo, ctx, error=False, or
 if repo.filecopiesmode == b'changeset-sidedata':
 writechangesetcopy = True
 writefilecopymeta = True
-writecopiesto = None
 else:
 writecopiesto = repo.ui.config(b'experimental', b'copies.write-to')
 writefilecopymeta = writecopiesto != b'changeset-only'
@@ -134,7 +133,7 @@ def commitctx(repo, ctx, error=False, or
 files = touched
 mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
 
-if writecopiesto == b'changeset-only':
+if not writefilecopymeta:
 # If writing only to changeset extras, use None to indicate that
 # no entry should be written. If writing to both, write an empty
 # entry to prevent the reader from falling back to reading

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


[PATCH 05 of 11] commitctx: move copy meta config reading in a dedicated function

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595531382 -7200
#  Thu Jul 23 21:09:42 2020 +0200
# Node ID 87553bac39d2fec8dd7b23b44152ec89bcb2f74d
# Parent  93c606831026b6c9644ad84a89204a2338a8aa03
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
87553bac39d2
commitctx: move copy meta config reading in a dedicated function

The logic is non trivial, make it contained in a function is clearer. I also
unlock easy re-use of tha logic without having the pass the value around.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -24,6 +24,25 @@ from . import (
 )
 
 
+def _write_copy_meta(repo):
+"""return a (changelog, filelog) boolean tuple
+
+changelog: copy related information should be stored in the changeset
+filelof:   copy related information should be written in the file revision
+"""
+if repo.filecopiesmode == b'changeset-sidedata':
+writechangesetcopy = True
+writefilecopymeta = True
+else:
+writecopiesto = repo.ui.config(b'experimental', b'copies.write-to')
+writefilecopymeta = writecopiesto != b'changeset-only'
+writechangesetcopy = writecopiesto in (
+b'changeset-only',
+b'compatibility',
+)
+return writechangesetcopy, writefilecopymeta
+
+
 def commitctx(repo, ctx, error=False, origctx=None):
 """Add a new revision to the target repository.
 Revision information is passed via the context argument.
@@ -44,16 +63,8 @@ def commitctx(repo, ctx, error=False, or
 p1, p2 = ctx.p1(), ctx.p2()
 user = ctx.user()
 
-if repo.filecopiesmode == b'changeset-sidedata':
-writechangesetcopy = True
-writefilecopymeta = True
-else:
-writecopiesto = repo.ui.config(b'experimental', b'copies.write-to')
-writefilecopymeta = writecopiesto != b'changeset-only'
-writechangesetcopy = writecopiesto in (
-b'changeset-only',
-b'compatibility',
-)
+writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+
 p1copies, p2copies = None, None
 if writechangesetcopy:
 p1copies = ctx.p1copies()

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


[PATCH 02 of 11] commitctx: stop using weakref proxy for transaction

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595587952 -7200
#  Fri Jul 24 12:52:32 2020 +0200
# Node ID 76a585b26acdaf884e1c40252e351b1d45cbbcf1
# Parent  2727e91ffa6e9063bd9c29671b5008cfef22dd97
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
76a585b26acd
commitctx: stop using weakref proxy for transaction

This weakref proxy was introduced in 2007 by 30d4d8985dd8.

If I understand it correctly, the logic at that time was relying on the
transaction destructor, triggered at garbage collection time to rollback failed
transaction. passing the object to sub function directly mean it would live in
the function scope and be trapped in the traceback on exception, leading to the
transaction rollback too late in some case.

Modern transaction usage use explicit opening and closing of transaction and no
longer rely on some internal reference counting details. So this weakref proxy
is no longer necessary. Absolutely no test are affected when we drop it.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -6,7 +6,6 @@
 from __future__ import absolute_import
 
 import errno
-import weakref
 
 from .i18n import _
 from .node import (
@@ -62,8 +61,6 @@ def commitctx(repo, ctx, error=False, or
 p2copies = ctx.p2copies()
 filesadded, filesremoved = None, None
 with repo.lock(), repo.transaction(b"commit") as tr:
-trp = weakref.proxy(tr)
-
 if ctx.manifestnode():
 # reuse an existing manifest revision
 repo.ui.debug(b'reusing known manifest\n')
@@ -102,7 +99,7 @@ def commitctx(repo, ctx, error=False, or
 else:
 added.append(f)
 m[f], is_touched = _filecommit(
-repo, fctx, m1, m2, linkrev, trp, 
writefilecopymeta,
+repo, fctx, m1, m2, linkrev, tr, writefilecopymeta,
 )
 if is_touched:
 touched.append(f)
@@ -156,7 +153,7 @@ def commitctx(repo, ctx, error=False, or
 # case where the merge has files outside of the narrowspec,
 # so this is safe.
 mn = mctx.write(
-trp,
+tr,
 linkrev,
 p1.manifestnode(),
 p2.manifestnode(),
@@ -191,7 +188,7 @@ def commitctx(repo, ctx, error=False, or
 mn,
 files,
 ctx.description(),
-trp,
+tr,
 p1.node(),
 p2.node(),
 user,

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


[PATCH 03 of 11] commitctx: extract the function that commit a new manifest

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595509101 -7200
#  Thu Jul 23 14:58:21 2020 +0200
# Node ID 113fcffb030358b64b4cf7331bbde2e85758ab27
# Parent  76a585b26acdaf884e1c40252e351b1d45cbbcf1
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
113fcffb0303
commitctx: extract the function that commit a new manifest

The logic is large enough and isolated enough to be extracted, this reduce the
size of the main function, making it simpler to follow.

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -132,41 +132,7 @@ def commitctx(repo, ctx, error=False, or
 filesremoved = removed
 
 files = touched
-md = None
-if not files:
-# if no "files" actually changed in terms of the changelog,
-# try hard to detect unmodified manifest entry so that the
-# exact same commit can be reproduced later on convert.
-md = m1.diff(m, scmutil.matchfiles(repo, ctx.files()))
-if not files and md:
-repo.ui.debug(
-b'not reusing manifest (no file change in '
-b'changelog, but manifest differs)\n'
-)
-if files or md:
-repo.ui.note(_(b"committing manifest\n"))
-# we're using narrowmatch here since it's already applied at
-# other stages (such as dirstate.walk), so we're already
-# ignoring things outside of narrowspec in most cases. The
-# one case where we might have files outside the narrowspec
-# at this point is merges, and we already error out in the
-# case where the merge has files outside of the narrowspec,
-# so this is safe.
-mn = mctx.write(
-tr,
-linkrev,
-p1.manifestnode(),
-p2.manifestnode(),
-added,
-drop,
-match=repo.narrowmatch(),
-)
-else:
-repo.ui.debug(
-b'reusing manifest from p1 (listed files '
-b'actually unchanged)\n'
-)
-mn = p1.manifestnode()
+mn = _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop)
 
 if writecopiesto == b'changeset-only':
 # If writing only to changeset extras, use None to indicate that
@@ -349,3 +315,65 @@ def _filecommit(
 else:
 fnode = fparent1
 return fnode, touched
+
+
+def _commit_manifest(tr, linkrev, ctx, mctx, files, added, drop):
+"""make a new manifest entry (or reuse a new one)
+
+given an initialised manifest context and precomputed list of
+- files: files affected by the commit
+- added: new entries in the manifest
+- drop:  entries present in parents but absent of this one
+
+Create a new manifest revision, reuse existing ones if possible.
+
+Return the nodeid of the manifest revision.
+"""
+repo = ctx.repo()
+
+md = None
+
+# all this is cached, so it is find to get them all from the ctx.
+p1 = ctx.p1()
+p2 = ctx.p2()
+m1ctx = p1.manifestctx()
+
+m1 = m1ctx.read()
+
+manifest = mctx.read()
+
+if not files:
+# if no "files" actually changed in terms of the changelog,
+# try hard to detect unmodified manifest entry so that the
+# exact same commit can be reproduced later on convert.
+md = m1.diff(manifest, scmutil.matchfiles(repo, ctx.files()))
+if not files and md:
+repo.ui.debug(
+b'not reusing manifest (no file change in '
+b'changelog, but manifest differs)\n'
+)
+if files or md:
+repo.ui.note(_(b"committing manifest\n"))
+# we're using narrowmatch here since it's already applied at
+# other stages (such as dirstate.walk), so we're already
+# ignoring things outside of narrowspec in most cases. The
+# one case where we might have files outside the narrowspec
+# at this point is merges, and we already error out in the
+# case where the merge has files outside of the narrowspec,
+# so this is safe.
+mn = mctx.write(
+tr,
+linkrev,
+p1.manifestnode(),
+p2.manifestnode(),
+added,
+drop,
+match=repo.narrowmatch(),
+)
+else:
+repo.ui.debug(
+b'reusing manifest from p1 (listed files ' b'actually unchanged)\n'
+)
+mn = p1.manifestnode()
+
+return mn

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

[PATCH 01 of 11] commitctx: document the None return for "touched" value

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595427033 -7200
#  Wed Jul 22 16:10:33 2020 +0200
# Node ID 2727e91ffa6e9063bd9c29671b5008cfef22dd97
# Parent  4ccd5ec565c2baaa1d598b20a7ea14d3c4fd39dc
# EXP-Topic commitctx-cleanup-2
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
2727e91ffa6e
commitctx: document the None return for "touched" value

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -238,7 +238,7 @@ def _filecommit(
 output: (filenode, touched)
 
 filenode: the filenode that should be used by this changeset
-touched:  one of: None, 'added' or 'modified'
+touched:  one of: None (mean untouched), 'added' or 'modified'
 """
 
 fname = fctx.path()

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


[PATCH 5 of 5 STABLE REGRESSION V2] push: test for checks preventing publishing obsolete changeset

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595514630 -7200
#  Thu Jul 23 16:30:30 2020 +0200
# Branch stable
# Node ID e741ef8d1b76060f6c49fbef0082efe19246cde7
# Parent  099d3b7cfef487b42c408c54345cdccb5cf9be98
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
e741ef8d1b76
push: test for checks preventing publishing obsolete changeset

The main difference from the previous test is how the changeset was obsoleted.
In this case it is an amend so publishing the orphan would also create phase
divergence. This must not go unnoticed.

diff --git a/tests/test-obsolete-check-push.t b/tests/test-obsolete-check-push.t
--- a/tests/test-obsolete-check-push.t
+++ b/tests/test-obsolete-check-push.t
@@ -207,3 +207,30 @@ Check something prevents a silent public
   [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 ../..

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


[PATCH 3 of 5 STABLE REGRESSION V2] push: another test for checks preventing pushing orphaness to a server

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595514389 -7200
#  Thu Jul 23 16:26:29 2020 +0200
# Branch stable
# Node ID 89ef8e19853e11c106653add49bd33dda246be3c
# Parent  ac128543063466eae7d6c9c8859154360580879a
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
89ef8e19853e
push: another test for checks preventing pushing orphaness to a server

In this one, orphan was create with and amend instead of a prune.

diff --git a/tests/test-obsolete-check-push.t b/tests/test-obsolete-check-push.t
--- a/tests/test-obsolete-check-push.t
+++ b/tests/test-obsolete-check-push.t
@@ -121,3 +121,61 @@ Pushing the result is prevented with a m
   [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 +
+  |  summary: commit_A1_
+  |
+  | o  changeset:   3:16affbe0f986
+  |/   branch:  unrelated
+  |parent:  0:1e4be0697311
+  |user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: unrelated
+  |
+  | *  changeset:   2:c09d8ab29fda
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  instability: orphan
+  | |  summary: commit_B0_
+  | |
+  | x  changeset:   1:37624bf21024
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:rewritten using amend as 4:df9b82a99e21
+  |summary: commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ 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 ../..

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


[PATCH 4 of 5 STABLE REGRESSION V2] push: test for checks preventing publishing obsolete changeset

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595514555 -7200
#  Thu Jul 23 16:29:15 2020 +0200
# Branch stable
# Node ID 099d3b7cfef487b42c408c54345cdccb5cf9be98
# Parent  89ef8e19853e11c106653add49bd33dda246be3c
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
099d3b7cfef4
push: test for checks preventing publishing obsolete changeset

This introduce a simple example, more are coming. See inline documentation
for details.

diff --git a/tests/test-obsolete-check-push.t b/tests/test-obsolete-check-push.t
--- a/tests/test-obsolete-check-push.t
+++ b/tests/test-obsolete-check-push.t
@@ -179,3 +179,31 @@ Pushing the result is prevented with a m
   [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 ../..

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


[PATCH 2 of 5 STABLE REGRESSION V2] push: test the checks preventing pushing orphaness to a server

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595514223 -7200
#  Thu Jul 23 16:23:43 2020 +0200
# Branch stable
# Node ID ac128543063466eae7d6c9c8859154360580879a
# Parent  69b4a3b9262e822047bb143b864687b27cfbd00e
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
ac1285430634
push: test the checks preventing pushing orphaness to a server

This is introduce a simple example, more are coming. See inline documentation
for details.

diff --git a/tests/test-obsolete-check-push.t b/tests/test-obsolete-check-push.t
new file mode 100644
--- /dev/null
+++ b/tests/test-obsolete-check-push.t
@@ -0,0 +1,123 @@
+===
+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 +
+  |  summary: unrelated
+  |
+  | o  changeset:   2:c09d8ab29fda
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: commit_B0_
+  | |
+  | o  changeset:   1:37624bf21024
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ 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 +
+  |  summary: unrelated
+  |
+  | *  changeset:   2:c09d8ab29fda
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  instability: orphan
+  | |  summary: commit_B0_
+  | |
+  | x  changeset:   1:37624bf21024
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:pruned
+  |summary: commit_A0_
+  |
+  o  changeset:   0:1e4be0697311
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ 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 ../..

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


[PATCH 1 of 5 STABLE REGRESSION V2] exchange: backout changeset c26335fa4225

2020-07-24 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1595516276 -7200
#  Thu Jul 23 16:57:56 2020 +0200
# Branch stable
# Node ID 69b4a3b9262e822047bb143b864687b27cfbd00e
# Parent  fc54f52779dd6c9523e9cc4de8a6e61e62e75bd8
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 
69b4a3b9262e
exchange: backout changeset c26335fa4225

Changeset c26335fa4225 has good intends but introduce significant behavior
regressions for multiple important cases. In short there are many case where
push would have caught instability creation/propagation that are no longer
covered.  These behavior have been covered for many years and even if some
related case are not currently caught, the covered one should not be regressed.

The next four changesets introduce tests for some of these cases. However we
could produce many more tests cases since the area is wide and they are many
possible combination. (And we should cover them when getting back to this issue)

Since 5.5 is one week away, the most reasonable approach seems to back this out
while we devise a new way to move forward that preserve the current behavior,
catch more issues and also improves the situation that c26335fa4225 target.


In addition to the behavior change, c26335fa4225 also introduced output
changes. These output changes does not requires a backout per-se, but are part 
of
the same changeset. However they come with a couple of issues that also requires
attention:

1) the bulk of the error message have been shoehorned into a multiple line abort
message. This seems quite different from what we usually do. The abort message
should be a compact and efficient message, with extra details being issued as
normal error output beforehand. (with --verbose/--quiet) support.

2) the current output is unbounded, so if there is many (tens, hundreds,
thousands, …) of unstable/obsolete changeset involved in the push, the output
can quickly become a scary and un-usuable wall of text. So we need some
limitation here (same as we have with the remote head list that says A, B , C
and # others).

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -905,32 +905,27 @@ def _pushcheckoutgoing(pushop):
 # 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
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -118,9 +118,7 @@ check that mercurial refuse to push
   $ hg push ../other
   pushing to ../other
   searching for changes
-  abort: push includes unstable changesets:
-82623d38b9ba (content-divergent)
-392fd25390da (content-divergent)
+  abort: push includes 

Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Manuel Jacob

On 2020-07-24 14:31, Pierre-Yves David wrote:

On 7/24/20 2:25 PM, Manuel Jacob wrote:

On 2020-07-24 14:07, Pierre-Yves David wrote:

On 7/24/20 8:19 AM, Manuel Jacob wrote:
Overall, I’m fine to backout this for now and solve the problem 
during the Mercurial 5.6 development cycle.


Thanks, let do that.

I still think that this check is not the right place for preventing 
the cases you were raising. The message refers to changesets 
included in the push, which I read as "transferred to the server", 
and including non-missing changesets in the check causes e.g. 
issue6372. For situations where the changesets are already on the 
server, the old check missed many cases (the new doesn’t attempt to 
catch them). If you find it important to retain the shotgun that 
misses part of the target and hits the wall behind it (to use a 
different metaphor than the holey safety net ;)), backing this out 
and taking a bit more time to fix it during the 5.6 development 
cycle seems reasonable.


Yeah the existing code was very ra, it is some very old code setup
quickly when there was more pressing matters. The assumption was 
"with
a simple but wide net, we can probably catch most of the problems, 
but

the problem space was not really fully mapped and tested at that time
(because other focus) hence the various flaw. Lets fix it in 5.6, 
even

if we dont handle every corner case having a good map of the problem
space would be very helpful.


A good start would be to define what are the limits of what we can 
detect. If two clients are involved, there are situations where we 
can’t really detect anything without server support. Example (I hope 
my email client doesn’t mangle it, otherwise see 
https://dpaste.com/E8J72RMLT):


   $ cat >> $HGRCPATH << EOF
   > [phases]
   > publish = False
   > [experimental]
   > evolution = all
   > EOF

   $ hg init server
   $ cd server
   $ echo root > root; hg add root; hg ci -m root
   $ hg phase --public
   $ echo a > a; hg add a; hg ci -m a
   $ cd ..
   $ hg clone server client1
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files 
unresolved

   $ hg clone server client2
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files 
unresolved

   $ cd client1
   $ hg branch foo -r 1
   changed branch on 1 changesets
   $ hg push --new-branch
   pushing to $TESTTMP/server
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 0 changes to 1 files (+1 heads)
   1 new obsolescence markers
   obsoleted 1 changesets
   $ cd ../client2
   $ echo b > b; hg add b; hg ci -m b
   $ hg push
   pushing to $TESTTMP/server
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
   1 new orphan changesets

Client 1 amends A and client 2 adds B on top of A. At each client, it 
looks good, but when both push, we have an orphan on the server. 
Should the server reject this if the client doesn’t explicitly force 
it?


The second push will create the orphan, we should detect the situation
at this time. (and point it to the user instead of letting him push
silently).


At client side, we can’t detect this unless we pull first. Should the 
server detect and abort?


Backing out will reintroduce the bug that non-head outgoing 
content-divergent and phase-divergent changesets are not detected. I 
can send another patch that checks them.


That seems like a good idea.

About the tests in the following patches: I’ve put some small 
modifications on top in 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications. 
If you like them, you can absorb them in your patches, or prune them 
otherwise.


All three are great, got ahead in folding them at the appropriate 
location.


If you want them to be committed like this, you’ll probably need to 
send a V2. ;)


Let me know once they are folded. I'll email the V2


I thought you folded it already. I just pushed your changesets with my 
changes included. 
(https://foss.heptapod.net/octobus/mercurial-devel/-/commit/286cfe4ac350a4d003743390b0c1cf13caa2e2e0 
and ancestors)






The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases 
later:


* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing


I considered each approach. I think the "publishing" check will be a
different layer of check eventually with different sub case so it 
make

sense to group them. (but I don't have a super strong opinion on
that).


Yes, leaving the structure as-is might be a good idea. We can 
relatively easily add a separate check for "do we publish obsolete 
changesets?", as we know both the published changesets and the 
obsolete changesets. If 

Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Pierre-Yves David



On 7/24/20 2:25 PM, Manuel Jacob wrote:

On 2020-07-24 14:07, Pierre-Yves David wrote:

On 7/24/20 8:19 AM, Manuel Jacob wrote:
Overall, I’m fine to backout this for now and solve the problem 
during the Mercurial 5.6 development cycle.


Thanks, let do that.

I still think that this check is not the right place for preventing 
the cases you were raising. The message refers to changesets included 
in the push, which I read as "transferred to the server", and 
including non-missing changesets in the check causes e.g. issue6372. 
For situations where the changesets are already on the server, the 
old check missed many cases (the new doesn’t attempt to catch them). 
If you find it important to retain the shotgun that misses part of 
the target and hits the wall behind it (to use a different metaphor 
than the holey safety net ;)), backing this out and taking a bit more 
time to fix it during the 5.6 development cycle seems reasonable.


Yeah the existing code was very ra, it is some very old code setup
quickly when there was more pressing matters. The assumption was "with
a simple but wide net, we can probably catch most of the problems, but
the problem space was not really fully mapped and tested at that time
(because other focus) hence the various flaw. Lets fix it in 5.6, even
if we dont handle every corner case having a good map of the problem
space would be very helpful.


A good start would be to define what are the limits of what we can 
detect. If two clients are involved, there are situations where we can’t 
really detect anything without server support. Example (I hope my email 
client doesn’t mangle it, otherwise see https://dpaste.com/E8J72RMLT):


   $ cat >> $HGRCPATH << EOF
   > [phases]
   > publish = False
   > [experimental]
   > evolution = all
   > EOF

   $ hg init server
   $ cd server
   $ echo root > root; hg add root; hg ci -m root
   $ hg phase --public
   $ echo a > a; hg add a; hg ci -m a
   $ cd ..
   $ hg clone server client1
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg clone server client2
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd client1
   $ hg branch foo -r 1
   changed branch on 1 changesets
   $ hg push --new-branch
   pushing to $TESTTMP/server
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 0 changes to 1 files (+1 heads)
   1 new obsolescence markers
   obsoleted 1 changesets
   $ cd ../client2
   $ echo b > b; hg add b; hg ci -m b
   $ hg push
   pushing to $TESTTMP/server
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
   1 new orphan changesets

Client 1 amends A and client 2 adds B on top of A. At each client, it 
looks good, but when both push, we have an orphan on the server. Should 
the server reject this if the client doesn’t explicitly force it?


The second push will create the orphan, we should detect the situation 
at this time. (and point it to the user instead of letting him push 
silently).


Backing out will reintroduce the bug that non-head outgoing 
content-divergent and phase-divergent changesets are not detected. I 
can send another patch that checks them.


That seems like a good idea.

About the tests in the following patches: I’ve put some small 
modifications on top in 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications. 
If you like them, you can absorb them in your patches, or prune them 
otherwise.


All three are great, got ahead in folding them at the appropriate 
location.


If you want them to be committed like this, you’ll probably need to send 
a V2. ;)


Let me know once they are folded. I'll email the V2





The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing


I considered each approach. I think the "publishing" check will be a
different layer of check eventually with different sub case so it make
sense to group them. (but I don't have a super strong opinion on
that).


Yes, leaving the structure as-is might be a good idea. We can relatively 
easily add a separate check for "do we publish obsolete changesets?", as 
we know both the published changesets and the obsolete changesets. If 
it’s a simple effective check, we don’t have to test it for every case 
where we test the obsolete / unstable check.


Maybe it would make sense to factor out the setup more so that each run 
is more independant (but that comes with extra runtime cost)


--
Pierre-Yves David
___
Mercurial-devel mailing list

Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Manuel Jacob

On 2020-07-24 14:07, Pierre-Yves David wrote:

On 7/24/20 8:19 AM, Manuel Jacob wrote:
Overall, I’m fine to backout this for now and solve the problem during 
the Mercurial 5.6 development cycle.


Thanks, let do that.

I still think that this check is not the right place for preventing 
the cases you were raising. The message refers to changesets included 
in the push, which I read as "transferred to the server", and 
including non-missing changesets in the check causes e.g. issue6372. 
For situations where the changesets are already on the server, the old 
check missed many cases (the new doesn’t attempt to catch them). If 
you find it important to retain the shotgun that misses part of the 
target and hits the wall behind it (to use a different metaphor than 
the holey safety net ;)), backing this out and taking a bit more time 
to fix it during the 5.6 development cycle seems reasonable.


Yeah the existing code was very ra, it is some very old code setup
quickly when there was more pressing matters. The assumption was "with
a simple but wide net, we can probably catch most of the problems, but
the problem space was not really fully mapped and tested at that time
(because other focus) hence the various flaw. Lets fix it in 5.6, even
if we dont handle every corner case having a good map of the problem
space would be very helpful.


A good start would be to define what are the limits of what we can 
detect. If two clients are involved, there are situations where we can’t 
really detect anything without server support. Example (I hope my email 
client doesn’t mangle it, otherwise see https://dpaste.com/E8J72RMLT):


  $ cat >> $HGRCPATH << EOF
  > [phases]
  > publish = False
  > [experimental]
  > evolution = all
  > EOF

  $ hg init server
  $ cd server
  $ echo root > root; hg add root; hg ci -m root
  $ hg phase --public
  $ echo a > a; hg add a; hg ci -m a
  $ cd ..
  $ hg clone server client1
  updating to branch default
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg clone server client2
  updating to branch default
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ cd client1
  $ hg branch foo -r 1
  changed branch on 1 changesets
  $ hg push --new-branch
  pushing to $TESTTMP/server
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 0 changes to 1 files (+1 heads)
  1 new obsolescence markers
  obsoleted 1 changesets
  $ cd ../client2
  $ echo b > b; hg add b; hg ci -m b
  $ hg push
  pushing to $TESTTMP/server
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  1 new orphan changesets

Client 1 amends A and client 2 adds B on top of A. At each client, it 
looks good, but when both push, we have an orphan on the server. Should 
the server reject this if the client doesn’t explicitly force it?


Backing out will reintroduce the bug that non-head outgoing 
content-divergent and phase-divergent changesets are not detected. I 
can send another patch that checks them.


That seems like a good idea.

About the tests in the following patches: I’ve put some small 
modifications on top in 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications. 
If you like them, you can absorb them in your patches, or prune them 
otherwise.


All three are great, got ahead in folding them at the appropriate 
location.


If you want them to be committed like this, you’ll probably need to send 
a V2. ;)




The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing


I considered each approach. I think the "publishing" check will be a
different layer of check eventually with different sub case so it make
sense to group them. (but I don't have a super strong opinion on
that).


Yes, leaving the structure as-is might be a good idea. We can relatively 
easily add a separate check for "do we publish obsolete changesets?", as 
we know both the published changesets and the obsolete changesets. If 
it’s a simple effective check, we don’t have to test it for every case 
where we test the obsolete / unstable check.

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


Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Pierre-Yves David



On 7/24/20 8:19 AM, Manuel Jacob wrote:
Overall, I’m fine to backout this for now and solve the problem during 
the Mercurial 5.6 development cycle.


Thanks, let do that.

I still think that this check is not the right place for preventing the 
cases you were raising. The message refers to changesets included in the 
push, which I read as "transferred to the server", and including 
non-missing changesets in the check causes e.g. issue6372. For 
situations where the changesets are already on the server, the old check 
missed many cases (the new doesn’t attempt to catch them). If you find 
it important to retain the shotgun that misses part of the target and 
hits the wall behind it (to use a different metaphor than the holey 
safety net ;)), backing this out and taking a bit more time to fix it 
during the 5.6 development cycle seems reasonable.


Yeah the existing code was very ra, it is some very old code setup 
quickly when there was more pressing matters. The assumption was "with a 
simple but wide net, we can probably catch most of the problems, but the 
problem space was not really fully mapped and tested at that time 
(because other focus) hence the various flaw. Lets fix it in 5.6, even 
if we dont handle every corner case having a good map of the problem 
space would be very helpful.


Backing out will reintroduce the bug that non-head outgoing 
content-divergent and phase-divergent changesets are not detected. I can 
send another patch that checks them.


That seems like a good idea.

About the tests in the following patches: I’ve put some small 
modifications on top in 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications. 
If you like them, you can absorb them in your patches, or prune them 
otherwise.


All three are great, got ahead in folding them at the appropriate location.



The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing


I considered each approach. I think the "publishing" check will be a 
different layer of check eventually with different sub case so it make 
sense to group them. (but I don't have a super strong opinion on that).


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


Re: [PATCH] [RFC] tests: sleep for a second to let ui get flushed

2020-07-24 Thread Pierre-Yves David
Solving race condition with sleep usually just make test slower while 
pushing the race further down the road. Can you think of a way to fix 
this with some explicit synchronisation?


On 7/23/20 11:01 PM, Pulkit Goyal wrote:

# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1595538045 -19800
#  Fri Jul 24 02:30:45 2020 +0530
# Node ID ebb1da08c3163efac7bcfe0947c98b1ac01fc603
# Parent  aada79ccce4c3e424e48cc76598e0849be43de56
# EXP-Topic chg-test
[RFC] tests: sleep for a second to let ui get flushed

I was getting following failure on Python 3+chg:

```
--- /tmp/mercurial-ci/tests/test-blackbox.t
+++ /tmp/mercurial-ci/tests/test-blackbox.t.err
@@ -354,13 +354,13 @@
> EOF
$ hg log --debug
removing $TESTTMP/gone/.hg
-  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !)
warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: 
$ENOTDIR$ (windows !)
$ cd ..

  blackbox should disable itself if track is empty

$ hg --config blackbox.track= init nothing_tracked
+  warning: cannot write to blackbox.log: $ENOENT$
$ cd nothing_tracked
$ cat >> .hg/hgrc << EOF
> [blackbox]
ERROR: test-blackbox.t output changed
```

I added a sleep and debugged some more, it turns out that the command running is
finished even before the ui was completely flushed.

I have marked this as an RFC as I think adding code to wait for ui to flush
before chg exiting will be better.
However, will be nice to have a chg experienced person to look.

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -354,8 +354,12 @@ Test missing log directory, which should
> EOF
$ hg log --debug
removing $TESTTMP/gone/.hg
-  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !)
warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: 
$ENOTDIR$ (windows !)
+  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) (?)
+
+  $ sleep 1
+  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) (?)
+
$ cd ..
  
  blackbox should disable itself if track is empty


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



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


Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Manuel Jacob

On 2020-07-24 10:17, Pulkit Goyal wrote:

I see that tests are added later in series which are related to this
change. Can you put them before this backout patch to demonstrate what
was broken and this patch fixing them. Will be much easier to review
and have a discussion.


Without the backout, all pushes in the test get through because only 
changesets missing on the server are checked and all but the "unrelated" 
changeset are on the server. With the backout, the non-force pushes fail 
with "push includes orphan changeset: c09d8ab29fda!" because all heads 
are checked and c09d8ab29fda is orphan at the time of the pushes.


In all four cases the push succeeds or fails for the same reason, so it 
should be understandable without reordering the patches.


On Fri, Jul 24, 2020 at 11:49 AM Manuel Jacob  
wrote:


Overall, I’m fine to backout this for now and solve the problem during
the Mercurial 5.6 development cycle.

I still think that this check is not the right place for preventing 
the
cases you were raising. The message refers to changesets included in 
the

push, which I read as "transferred to the server", and including
non-missing changesets in the check causes e.g. issue6372. For
situations where the changesets are already on the server, the old 
check

missed many cases (the new doesn’t attempt to catch them). If you find
it important to retain the shotgun that misses part of the target and
hits the wall behind it (to use a different metaphor than the holey
safety net ;)), backing this out and taking a bit more time to fix it
during the 5.6 development cycle seems reasonable.

Backing out will reintroduce the bug that non-head outgoing
content-divergent and phase-divergent changesets are not detected. I 
can

send another patch that checks them.

About the tests in the following patches: I’ve put some small
modifications on top in
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications.
If you like them, you can absorb them in your patches, or prune them
otherwise.

The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing

On 2020-07-23 17:40, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1595516276 -7200
> #  Thu Jul 23 16:57:56 2020 +0200
> # Branch stable
> # Node ID 69b4a3b9262e822047bb143b864687b27cfbd00e
> # Parent  fc54f52779dd6c9523e9cc4de8a6e61e62e75bd8
> # EXP-Topic push-obscheck
> # Available At https://foss.heptapod.net/octobus/mercurial-devel/
> #  hg pull
> https://foss.heptapod.net/octobus/mercurial-devel/ -r 69b4a3b9262e
> exchange: backout changeset c26335fa4225
>
> Changeset c26335fa4225 has good intends but introduce significant
> behavior
> regressions for multiple important cases. In short there are many case
> where
> push would have caught instability creation/propagation that are no
> longer
> covered.  These behavior have been covered for many years and even if
> some
> related case are not currently caught, the covered one should not be
> regressed.
>
> The next four changesets introduce tests for some of these cases.
> However we
> could produce many more tests cases since the area is wide and they are
> many
> possible combination. (And we should cover them when getting back to
> this issue)
>
> Since 5.5 is one week away, the most reasonable approach seems to back
> this out
> while we devise a new way to move forward that preserve the current
> behavior,
> catch more issues and also improves the situation that c26335fa4225
> target.
>
>
> In addition to the behavior change, c26335fa4225 also introduced output
> changes. These output changes does not requires a backout per-se, but
> are part of
> the same changeset. However they come with a couple of issues that also
> requires
> attention:
>
> 1) the bulk of the error message have been shoehorned into a multiple
> line abort
> message. This seems quite different from what we usually do. The abort
> message
> should be a compact and efficient message, with extra details being
> issued as
> normal error output beforehand. (with --verbose/--quiet) support.
>
> 2) the current output is unbounded, so if there is many (tens,
> hundreds,
> thousands, …) of unstable/obsolete changeset involved in the push, the
> output
> can quickly become a scary and un-usuable wall of text. So we need some
> limitation here (same as we have with the remote head list that says A,
> B , C
> and # others).
>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -905,32 +905,27 @@ def _pushcheckoutgoing(pushop):
>  # if repo.obsstore == False --> no obsolete
>  # then, save the iteration
>  if 

Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Pierre-Yves David
I cannot really put them earlier, because early failure is ruining the 
rest of the test. However I can post meaningful diff of the change if 
that helps you. (You can also pull the change, reverse the backout and 
look at them if you want).


On 7/24/20 10:17 AM, Pulkit Goyal wrote:

I see that tests are added later in series which are related to this
change. Can you put them before this backout patch to demonstrate what
was broken and this patch fixing them. Will be much easier to review
and have a discussion.

On Fri, Jul 24, 2020 at 11:49 AM Manuel Jacob  wrote:


Overall, I’m fine to backout this for now and solve the problem during
the Mercurial 5.6 development cycle.

I still think that this check is not the right place for preventing the
cases you were raising. The message refers to changesets included in the
push, which I read as "transferred to the server", and including
non-missing changesets in the check causes e.g. issue6372. For
situations where the changesets are already on the server, the old check
missed many cases (the new doesn’t attempt to catch them). If you find
it important to retain the shotgun that misses part of the target and
hits the wall behind it (to use a different metaphor than the holey
safety net ;)), backing this out and taking a bit more time to fix it
during the 5.6 development cycle seems reasonable.

Backing out will reintroduce the bug that non-head outgoing
content-divergent and phase-divergent changesets are not detected. I can
send another patch that checks them.

About the tests in the following patches: I’ve put some small
modifications on top in
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications.
If you like them, you can absorb them in your patches, or prune them
otherwise.

The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing

On 2020-07-23 17:40, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1595516276 -7200
#  Thu Jul 23 16:57:56 2020 +0200
# Branch stable
# Node ID 69b4a3b9262e822047bb143b864687b27cfbd00e
# Parent  fc54f52779dd6c9523e9cc4de8a6e61e62e75bd8
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull
https://foss.heptapod.net/octobus/mercurial-devel/ -r 69b4a3b9262e
exchange: backout changeset c26335fa4225

Changeset c26335fa4225 has good intends but introduce significant
behavior
regressions for multiple important cases. In short there are many case
where
push would have caught instability creation/propagation that are no
longer
covered.  These behavior have been covered for many years and even if
some
related case are not currently caught, the covered one should not be
regressed.

The next four changesets introduce tests for some of these cases.
However we
could produce many more tests cases since the area is wide and they are
many
possible combination. (And we should cover them when getting back to
this issue)

Since 5.5 is one week away, the most reasonable approach seems to back
this out
while we devise a new way to move forward that preserve the current
behavior,
catch more issues and also improves the situation that c26335fa4225
target.


In addition to the behavior change, c26335fa4225 also introduced output
changes. These output changes does not requires a backout per-se, but
are part of
the same changeset. However they come with a couple of issues that also
requires
attention:

1) the bulk of the error message have been shoehorned into a multiple
line abort
message. This seems quite different from what we usually do. The abort
message
should be a compact and efficient message, with extra details being
issued as
normal error output beforehand. (with --verbose/--quiet) support.

2) the current output is unbounded, so if there is many (tens,
hundreds,
thousands, …) of unstable/obsolete changeset involved in the push, the
output
can quickly become a scary and un-usuable wall of text. So we need some
limitation here (same as we have with the remote head list that says A,
B , C
and # others).

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -905,32 +905,27 @@ def _pushcheckoutgoing(pushop):
  # 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!")
+  

Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Pulkit Goyal
I see that tests are added later in series which are related to this
change. Can you put them before this backout patch to demonstrate what
was broken and this patch fixing them. Will be much easier to review
and have a discussion.

On Fri, Jul 24, 2020 at 11:49 AM Manuel Jacob  wrote:
>
> Overall, I’m fine to backout this for now and solve the problem during
> the Mercurial 5.6 development cycle.
>
> I still think that this check is not the right place for preventing the
> cases you were raising. The message refers to changesets included in the
> push, which I read as "transferred to the server", and including
> non-missing changesets in the check causes e.g. issue6372. For
> situations where the changesets are already on the server, the old check
> missed many cases (the new doesn’t attempt to catch them). If you find
> it important to retain the shotgun that misses part of the target and
> hits the wall behind it (to use a different metaphor than the holey
> safety net ;)), backing this out and taking a bit more time to fix it
> during the 5.6 development cycle seems reasonable.
>
> Backing out will reintroduce the bug that non-head outgoing
> content-divergent and phase-divergent changesets are not detected. I can
> send another patch that checks them.
>
> About the tests in the following patches: I’ve put some small
> modifications on top in
> https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications.
> If you like them, you can absorb them in your patches, or prune them
> otherwise.
>
> The current test structure is:
>
> * case 1: test pushing
> * case 2: test pushing
> * case 1: test publishing
> * case 2: test publishing
>
> An alternative structure would make it easier to add more cases later:
>
> * case 1: test pushing
> * case 1: test publishing
> * case 2: test pushing
> * case 2: test publishing
>
> On 2020-07-23 17:40, Pierre-Yves David wrote:
> > # HG changeset patch
> > # User Pierre-Yves David 
> > # Date 1595516276 -7200
> > #  Thu Jul 23 16:57:56 2020 +0200
> > # Branch stable
> > # Node ID 69b4a3b9262e822047bb143b864687b27cfbd00e
> > # Parent  fc54f52779dd6c9523e9cc4de8a6e61e62e75bd8
> > # EXP-Topic push-obscheck
> > # Available At https://foss.heptapod.net/octobus/mercurial-devel/
> > #  hg pull
> > https://foss.heptapod.net/octobus/mercurial-devel/ -r 69b4a3b9262e
> > exchange: backout changeset c26335fa4225
> >
> > Changeset c26335fa4225 has good intends but introduce significant
> > behavior
> > regressions for multiple important cases. In short there are many case
> > where
> > push would have caught instability creation/propagation that are no
> > longer
> > covered.  These behavior have been covered for many years and even if
> > some
> > related case are not currently caught, the covered one should not be
> > regressed.
> >
> > The next four changesets introduce tests for some of these cases.
> > However we
> > could produce many more tests cases since the area is wide and they are
> > many
> > possible combination. (And we should cover them when getting back to
> > this issue)
> >
> > Since 5.5 is one week away, the most reasonable approach seems to back
> > this out
> > while we devise a new way to move forward that preserve the current
> > behavior,
> > catch more issues and also improves the situation that c26335fa4225
> > target.
> >
> >
> > In addition to the behavior change, c26335fa4225 also introduced output
> > changes. These output changes does not requires a backout per-se, but
> > are part of
> > the same changeset. However they come with a couple of issues that also
> > requires
> > attention:
> >
> > 1) the bulk of the error message have been shoehorned into a multiple
> > line abort
> > message. This seems quite different from what we usually do. The abort
> > message
> > should be a compact and efficient message, with extra details being
> > issued as
> > normal error output beforehand. (with --verbose/--quiet) support.
> >
> > 2) the current output is unbounded, so if there is many (tens,
> > hundreds,
> > thousands, …) of unstable/obsolete changeset involved in the push, the
> > output
> > can quickly become a scary and un-usuable wall of text. So we need some
> > limitation here (same as we have with the remote head list that says A,
> > B , C
> > and # others).
> >
> > diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> > --- a/mercurial/exchange.py
> > +++ b/mercurial/exchange.py
> > @@ -905,32 +905,27 @@ def _pushcheckoutgoing(pushop):
> >  # 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!")
> > +   

[Bug 6386] New: metaedit should trigger evolve --all

2020-07-24 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6386

Bug ID: 6386
   Summary: metaedit should trigger evolve --all
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: evolution
  Assignee: bugzi...@mercurial-scm.org
  Reporter: friedric...@gmx.de
CC: mercurial-devel@mercurial-scm.org,
pierre-yves.da...@ens-lyon.org
Python Version: ---

Metaedit is really convenient to refactor the recent commit messages of a topic
stack like

hg metaedit s2

But after that I need to run

hg evolve

manually which I dont like because metaedit did not introduce any potential
conflicts. Thats why I think it should be save to (from the user perspective)
to run `evolve --all` after metaedit automatically.

The only objection against this feature request is the potential marker
explosion explained by Pierre-Yves David last year:

https://www.mercurial-scm.org/pipermail/evolve-testers/2019-May/000389.html

Is there any progress about this marker-explosion issue? From my understanding
it could be very easy if the topic extension is used: just delete all markers
(on client and server) when the topic is published. What do you think?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] [RFC] tests: sleep for a second to let ui get flushed

2020-07-24 Thread Pulkit Goyal
On Fri, Jul 24, 2020 at 9:08 AM Yuya Nishihara  wrote:
>
> On Fri, 24 Jul 2020 02:31:14 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pul...@gmail.com>
> > # Date 1595538045 -19800
> > #  Fri Jul 24 02:30:45 2020 +0530
> > # Node ID ebb1da08c3163efac7bcfe0947c98b1ac01fc603
> > # Parent  aada79ccce4c3e424e48cc76598e0849be43de56
> > # EXP-Topic chg-test
> > [RFC] tests: sleep for a second to let ui get flushed
>
> > I added a sleep and debugged some more, it turns out that the command 
> > running is
> > finished even before the ui was completely flushed.
> >
> > I have marked this as an RFC as I think adding code to wait for ui to flush
> > before chg exiting will be better.
> > However, will be nice to have a chg experienced person to look.
> >
> > diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
> > --- a/tests/test-blackbox.t
> > +++ b/tests/test-blackbox.t
> > @@ -354,8 +354,12 @@ Test missing log directory, which should
> >> EOF
> >$ hg log --debug
> >removing $TESTTMP/gone/.hg
> > -  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !)
> >warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: 
> > $ENOTDIR$ (windows !)
> > +  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) (?)
> > +
> > +  $ sleep 1
> > +  warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) (?)
>
> I can't reproduce the issue, but maybe the server process would try to
> log something and detect that the log directory was gone. Inserting explicit
> ui.log() after vfs.rmtree() might help.

I was also unable to reproduce until I ran many of them together with
`--runs-per-test 20`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6385] New: commit with a default topic name

2020-07-24 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6385

Bug ID: 6385
   Summary: commit with a default topic name
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: evolution
  Assignee: bugzi...@mercurial-scm.org
  Reporter: friedric...@gmx.de
CC: mercurial-devel@mercurial-scm.org,
pierre-yves.da...@ens-lyon.org
Python Version: ---

It is possible to add the following configuration for the topic extension:

[experimental]
# behavior when commit is made without an active topic  
topic-mode = "mytopicname"  # default topic name instead of random

Maybe the syntax should be changed.

The reason behind this proposal is that on daily work I hesitate to
create a topic because it is too much concentration to think of an
appropriate topic name. But I really like the topic features. For that
reason I would like to choose a default topic name. It is the same like

[experimental]
# behavior when commit is made without an active topic  
topic-mode = random # use a randomized generated topic

but a little bit more predicable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6384] New: largefiles breaks topics over ssh transport

2020-07-24 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6384

Bug ID: 6384
   Summary: largefiles breaks topics over ssh transport
   Product: Mercurial
   Version: 5.4.2
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: largefiles
  Assignee: bugzi...@mercurial-scm.org
  Reporter: blazej.cegie...@gmail.com
CC: mercurial-devel@mercurial-scm.org, nato...@gmail.com
Python Version: ---

Originally discovered on heptapod instance with additional largefiles extension
enabled.
I was successfully using largefiles and topics over ssh when ssh was introduced
in heptapod-0.8. However after upgrading heptapod to newer version 0.12 which
also brought updated versions of mercurial and hg-evolve I lost that ability.
Same stayed for most recent heptapod-0.14.2 which is using Mercurial 5.4.2 /
Python 3.8.4 / hg-evolve 10.0.0.

Had a bit of look around and found that if I apply same old hack, applied
earlier just to http proto, largefiles + topics overs ssh works.

Old hack for http transport only:
```
changeset:   19917:cff331cbb5ee
user:Mads Kiilerich 
date:Thu Oct 10 04:28:39 2013 +0200
summary: largefiles: make the protocol hack for replacing heads with lheads
more precise

diff -r fb583a1efef0 -r cff331cbb5ee hgext/largefiles/proto.py
--- a/hgext/largefiles/proto.py Mon Apr 01 20:01:16 2013 -0700
+++ b/hgext/largefiles/proto.py Thu Oct 10 04:28:39 2013 +0200
@@ -5,6 +5,7 @@

 import os
 import urllib2
+import re

 from mercurial import error, httppeer, util, wireproto
 from mercurial.wireproto import batchable, future
@@ -166,9 +167,11 @@
 args['cmds'] = args['cmds'].replace('heads ', 'lheads ')
 return ssholdcallstream(self, cmd, **args)

+headsre = re.compile(r'(^|;)heads\b')
+
 def httprepocallstream(self, cmd, **args):
 if cmd == 'heads' and self.capable('largefiles'):
 cmd = 'lheads'
 if cmd == 'batch' and self.capable('largefiles'):
-args['cmds'] = args['cmds'].replace('heads ', 'lheads ')
+args['cmds'] = headsre.sub('lheads', args['cmds'])
 return httpoldcallstream(self, cmd, **args)
```

Don't know why it was working earlier and why it got broken now. Were there
changes in hg ssh transport protocol?

As the change (if correct) is trivial, I'm happy to exercise contribution
process, prob via phab.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] tests: glob 'mercurial.error' in test-phases.t

2020-07-24 Thread Manuel Jacob

On 2020-07-24 05:17, Yuya Nishihara wrote:

On Fri, 24 Jul 2020 00:51:22 +0530, Pulkit Goyal wrote:

# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1595532057 -19800
#  Fri Jul 24 00:50:57 2020 +0530
# Node ID f5621c1f45bb0f27793406917ac677cb6cacbe42
# Parent  4ccd5ec565c2baaa1d598b20a7ea14d3c4fd39dc
# EXP-Topic chg-test
tests: glob 'mercurial.error' in test-phases.t


Queued, thanks.

On python 2 with chg, `mercurial.error` is omitted while printing 
error. On

other cases it's there in error message.


Maybe the output would be different between the interpreter's traceback 
printer

and traceback.format_exc().


Yes, that’s the reason. Python 3 removed that inconsistency.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 5 STABLE REGRESSION] exchange: backout changeset c26335fa4225

2020-07-24 Thread Manuel Jacob
Overall, I’m fine to backout this for now and solve the problem during 
the Mercurial 5.6 development cycle.


I still think that this check is not the right place for preventing the 
cases you were raising. The message refers to changesets included in the 
push, which I read as "transferred to the server", and including 
non-missing changesets in the check causes e.g. issue6372. For 
situations where the changesets are already on the server, the old check 
missed many cases (the new doesn’t attempt to catch them). If you find 
it important to retain the shotgun that misses part of the target and 
hits the wall behind it (to use a different metaphor than the holey 
safety net ;)), backing this out and taking a bit more time to fix it 
during the 5.6 development cycle seems reasonable.


Backing out will reintroduce the bug that non-head outgoing 
content-divergent and phase-divergent changesets are not detected. I can 
send another patch that checks them.


About the tests in the following patches: I’ve put some small 
modifications on top in 
https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/stable/push-obscheck--small-modifications. 
If you like them, you can absorb them in your patches, or prune them 
otherwise.


The current test structure is:

* case 1: test pushing
* case 2: test pushing
* case 1: test publishing
* case 2: test publishing

An alternative structure would make it easier to add more cases later:

* case 1: test pushing
* case 1: test publishing
* case 2: test pushing
* case 2: test publishing

On 2020-07-23 17:40, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1595516276 -7200
#  Thu Jul 23 16:57:56 2020 +0200
# Branch stable
# Node ID 69b4a3b9262e822047bb143b864687b27cfbd00e
# Parent  fc54f52779dd6c9523e9cc4de8a6e61e62e75bd8
# EXP-Topic push-obscheck
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#  hg pull
https://foss.heptapod.net/octobus/mercurial-devel/ -r 69b4a3b9262e
exchange: backout changeset c26335fa4225

Changeset c26335fa4225 has good intends but introduce significant 
behavior
regressions for multiple important cases. In short there are many case 
where
push would have caught instability creation/propagation that are no 
longer
covered.  These behavior have been covered for many years and even if 
some
related case are not currently caught, the covered one should not be 
regressed.


The next four changesets introduce tests for some of these cases. 
However we
could produce many more tests cases since the area is wide and they are 
many
possible combination. (And we should cover them when getting back to 
this issue)


Since 5.5 is one week away, the most reasonable approach seems to back 
this out
while we devise a new way to move forward that preserve the current 
behavior,
catch more issues and also improves the situation that c26335fa4225 
target.



In addition to the behavior change, c26335fa4225 also introduced output
changes. These output changes does not requires a backout per-se, but
are part of
the same changeset. However they come with a couple of issues that also 
requires

attention:

1) the bulk of the error message have been shoehorned into a multiple 
line abort
message. This seems quite different from what we usually do. The abort 
message
should be a compact and efficient message, with extra details being 
issued as

normal error output beforehand. (with --verbose/--quiet) support.

2) the current output is unbounded, so if there is many (tens, 
hundreds,
thousands, …) of unstable/obsolete changeset involved in the push, the 
output

can quickly become a scary and un-usuable wall of text. So we need some
limitation here (same as we have with the remote head list that says A, 
B , C

and # others).

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -905,32 +905,27 @@ def _pushcheckoutgoing(pushop):
 # 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 

mercurial@45212: 2 new changesets (2 on stable)

2020-07-24 Thread Mercurial Commits
2 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/bfc6e75c0114
changeset:   45211:bfc6e75c0114
branch:  stable
parent:  45191:fc54f52779dd
user:Pierre-Yves David 
date:Thu Jul 23 17:32:09 2020 +0200
summary: infinitepush: remove unused import to tempfile

https://www.mercurial-scm.org/repo/hg/rev/41021660baa1
changeset:   45212:41021660baa1
branch:  stable
tag: tip
user:Pulkit Goyal <7895pul...@gmail.com>
date:Fri Jul 24 00:50:57 2020 +0530
summary: tests: glob 'mercurial.error' in test-phases.t

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


D8807: formatter: inline a variable assigned from `templater.templater.frommapfile`

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The variable doesn't get reused and it doesn't help formatting, so I
  don't see any reason for it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/formatter.py

CHANGE DETAILS

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -626,8 +626,7 @@
 a map file"""
 assert not (spec.tmpl and spec.mapfile)
 if spec.mapfile:
-frommapfile = templater.templater.frommapfile
-return frommapfile(
+return templater.templater.frommapfile(
 spec.mapfile, defaults=defaults, resources=resources, cache=cache
 )
 return maketemplater(



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


D8806: templater: don't normalize path separators to '/' when interacting with OS

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `_readmapfile()` is about reading a map file from the file system, so
  we shouldn't use our `util.normpath()`, which also normalizes `os.sep`
  to '/'.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -846,15 +846,15 @@
 val = conf.get(b'templates', b'__base__')
 if val and val[0] not in b"'\"":
 # treat as a pointer to a base class for this style
-path = util.normpath(os.path.join(base, val))
+path = os.path.normpath(os.path.join(base, val))
 
 # fallback check in template paths
 if not os.path.exists(path):
-p2 = util.normpath(os.path.join(templatedir(), val))
+p2 = os.path.normpath(os.path.join(templatedir(), val))
 if os.path.isfile(p2):
 path = p2
 else:
-p3 = util.normpath(os.path.join(p2, b"map"))
+p3 = os.path.normpath(os.path.join(p2, b"map"))
 if os.path.isfile(p3):
 path = p3
 



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


D8804: templater: make templatepath() not return directory paths

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The previous patch added a test showing an unusal error message. This
  make it more like other error messages.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/templater.py
  tests/test-template-map.t

CHANGE DETAILS

diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -1284,7 +1284,8 @@
 Error if style is a directory whose name is a built-in style:
 
   $ hg log --style coal
-  abort: Is a directory: '*/mercurial/templates/coal' (glob)
+  abort: style 'coal' not found
+  (available styles: bisect, changelog, compact, default, phases, show, 
status, xml)
   [255]
 
 Error if style missing key:
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1065,7 +1065,7 @@
 def templatepath(name):
 '''return location of template file. returns None if not found.'''
 f = os.path.join(templatedir(), name)
-if f and os.path.exists(f):
+if f and os.path.isfile(f):
 return f
 return None
 



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


D8805: formatter: remove now-unnecessary check for file-ness

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `templater.templatepath()` now returns non-`None` only for files, so
  the caller doesn't have to check.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/formatter.py

CHANGE DETAILS

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -584,7 +584,7 @@
 mapname = templater.templatepath(
 b'map-cmdline.' + tmpl
 ) or templater.templatepath(tmpl)
-if mapname and os.path.isfile(mapname):
+if mapname:
 return templatespec(topic, None, mapname)
 
 # perhaps it's a reference to [templates]



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


D8803: tests: show unusual error message for `hg log --style coal`

2020-07-24 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It turns out that we show the full path when the given style name
  matches a subdirectory of `mercurial/templates/`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-template-map.t

CHANGE DETAILS

diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -1281,6 +1281,12 @@
   abort: Is a directory: 'somedir'
   [255]
 
+Error if style is a directory whose name is a built-in style:
+
+  $ hg log --style coal
+  abort: Is a directory: '*/mercurial/templates/coal' (glob)
+  [255]
+
 Error if style missing key:
 
   $ echo 'q = q' > t



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