D7992: clean: delete obsolete unlinking of .hg/graftstate

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 19735.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7992?vs=19580=19735

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7992/new/

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

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1041,7 +1041,6 @@
 """forcibly switch the working directory to node, clobbering changes"""
 stats = updaterepo(repo, node, True)
 assert stats.unresolvedcount == 0
-repo.vfs.unlinkpath(b'graftstate', ignoremissing=True)
 if show_stats:
 _showstats(repo, stats, quietempty)
 



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


D6846: packaging: script the building of a MacOS installer using a custom python

2020-01-30 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In D6846#118733 , @marmoute 
wrote:
  
  > What's the latest with this diff ? It seems to still be a work in progress. 
Should it be in the "need-review" state?
  
  The hangup here is that the installed code seems to want to look in the path 
where it was built to load libraries.  I have no idea why.  It would be good if 
somebody figured out why, because I have a similar problem with the thg build 
on Mac.  (But unlike here, that's not fatal because it falls back to a library 
inside the bundle.)
  
  My thought with this was to be able to build an official py2 installer that 
worked on more than the very latest platform.  But I also thought that we would 
hang on to py2 for awhile.  If we're not, then this probably isn't worth 
pursuing, assuming PyOxidizer works out on OS X (so far, so good).  I'm not so 
excited about dropping py2 because of the amount of work still needed on hg on 
Windows, thg on Windows and Mac, and the packaging on both.  But 10.16 will 
remove all builtin python, so something will probably need to be done one way 
or the other by September or so.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6846/new/

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

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


D7295: pytype: add a (very slow) test that executes pytype

2020-01-30 Thread quark (Jun Wu)
quark added a comment.


  Have `pyre` been considered? It seems `pyre` only takes 10 seconds to check 
all the `.py` files.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7295/new/

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

To: durin42, #hg-reviewers, indygreg
Cc: quark, marmoute, mharbison72, dlax, indygreg, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8054: resourceutil: correct the root path for file based lookup under py2exe

2020-01-30 Thread mharbison72 (Matt Harbison)
Closed by commit rHGccb719dd1fe3: resourceutil: correct the root path for file 
based lookup under py2exe (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8054?vs=19732=19733

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8054/new/

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

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -33,7 +33,7 @@
 if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
 # executable version (py2exe) doesn't support __file__
 datapath = os.path.dirname(pycompat.sysexecutable)
-_rootpath = os.path.dirname(datapath)
+_rootpath = datapath
 else:
 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
 _rootpath = os.path.dirname(datapath)



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


D8054: resourceutil: correct the root path for file based lookup under py2exe

2020-01-30 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This silly copy/paste error caused "Mercurial" to be truncated from
  "C:\Program Files".  The fact that "helptext" and "defaultrc" are now in a
  subpackage of "mercurial" added it back on, and everything seemed to work.  
But
  that broke if not installed to the default directory, and also caused 
TortoiseHg
  to look at Mercurial's config files instead of its own.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -33,7 +33,7 @@
 if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
 # executable version (py2exe) doesn't support __file__
 datapath = os.path.dirname(pycompat.sysexecutable)
-_rootpath = os.path.dirname(datapath)
+_rootpath = datapath
 else:
 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
 _rootpath = os.path.dirname(datapath)



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


D8053: pyoxidizer: use `legacy_windows_stdio` on Windows

2020-01-30 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The C executable sets this too, otherwise no output shows up (when paging?).
  There is also `legacy_windows_fs_encoding`, but I'm not setting that for now
  because the C executable doesn't either.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/contrib/packaging/pyoxidizer.bzl b/contrib/packaging/pyoxidizer.bzl
--- a/contrib/packaging/pyoxidizer.bzl
+++ b/contrib/packaging/pyoxidizer.bzl
@@ -23,6 +23,7 @@
 run_eval = code,
 # We need this to make resourceutil happy, since it looks for 
sys.frozen.
 sys_frozen = True,
+legacy_windows_stdio = True,
 )
 
 exe = dist.to_python_executable(



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


D8052: wix: restore COPYING.rtf

2020-01-30 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This got truncated to 0 bytes in 0ab651b5f77c 
 
when the Phabricator extension
  crashed because it's a binary file.  That caused the license page in the WIX
  installer to be empty.  I don't remember if I needed to resubmit after the bug
  was fixed, so let's try this again with the current stable.  If this fails, 
I'll
  retry with 5.1 to see if this is a regression in the API changeover last 
cycle.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  contrib/packaging/wix/COPYING.rtf

CHANGE DETAILS

diff --git a/contrib/packaging/wix/COPYING.rtf 
b/contrib/packaging/wix/COPYING.rtf
index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..fc98ff56d9794ed561e92196cf4ec116b680532f
GIT binary patch
literal 1792
zc$|$@O>g5i5bZfY{=;A|-7Qi_R+6HvivsQ<*%+HRhT~unfESvgtm#suLQ*yi!~eZA
zl-#@O3&%p<)MK9)lvZNPL<&1#rm<)YAKnF;G!RIYAhHLMlEgxAW!y-wN3eA*C~1L=zz{ty+o%B}gPxQ0+7(!C
z`9W(7?SW`O)V>bj%5?K-`UIbnQwC=3(x8GnRN4j#m0+|QPZ7RQE^v50@ZX9)$
z5uF`@MwSR`l1cZF9{~DpXFzP;%gBU1xP}*fAeLJ@GbmlB*VdLG(OJd4Mui^?o
zn;KWHAuScPq`NI_kgQ&6XoD_Wa|TokUnYy=RMr_b
ztQ&*Wm^685bT^*E>}fuG
zc)aepPb^rMnzQLfhd{%5Y0-Bs%7(y{TpCTvH{4fpehY|>m2Esmw5v`I+oN2w^|-1c
z2{tssWF)^xkphAw!kfxLEw_hp_rw23CgPE$XKa+gM1o*BLnYN0vX(1NZ_z5#7EFVI
zx{XAZhDIyoAM_pz(np!0Wy;ZfUs}57i1tlrY8bc!JKaZtM#J@J#qPx=2iGjGaTqg%n*%orFZ0zL%P-z2=0cd`Lz6g<{1Oyn^V2HbjZGn*j@Uycy6J
z$w8zFwiQZ=rlq{~jQ?gu&=j}SljCzdfWG9zSr;fQ2}@P|w7Bc>peou_OFFGU7HbT|
z<^V)2v3JGw9eOAGSUqa}UmLbe8=iNICavbM@|n~IO1voueyzzUrEyKzGKK5^oCL`bp6BmyZwI0YkV+q_pL(FnoOuN+tcT89>edw&~Fpy+t!D}bP%-B7S(|Mli&^f
PHw)jw@4)F_=exfE(z1DC

literal 0
Hc$@https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8051: worker: Use buffered input from the pickle stream

2020-01-30 Thread heftig (Jan Alexander Steffens)
heftig created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  On Python 3, "pickle.load" will raise an exception ("_pickle.UnpicklingError:
  pickle data was truncated") when it gets a short read, i.e. it receives fewer
  bytes than it requested.
  
  On our build machine, Mercurial seems to frequently hit this problem while
  updating a mozilla-central clone iff it gets scheduled in batch mode. It is 
easy
  to trigger with:
  
  1. wipe the workdir rm -rf * hg update null
  
chrt -b 0 hg update default
  
  I've also written the following program, which demonstrates the core problem:
  
from __future__ import print_function

import io
import os
import pickle
import time

obj = {"a": 1, "b": 2}
obj_data = pickle.dumps(obj)
assert len(obj_data) > 10

rfd, wfd = os.pipe()

pid = os.fork()
if pid == 0:
os.close(rfd)

for _ in range(4):
time.sleep(0.5)
print("First write")
os.write(wfd, obj_data[:10])

time.sleep(0.5)
print("Second write")
os.write(wfd, obj_data[10:])

os._exit(0)

try:
os.close(wfd)

rfile = os.fdopen(rfd, "rb", 0)

print("Reading")
while True:
try:
obj_copy = pickle.load(rfile)
assert obj == obj_copy
except EOFError:
break
print("Success")
finally:
os.kill(pid, 15)
  
  The program reliably fails with Python 3.8 and succeeds with Python 2.7.
  
  Providing the unpickler with a buffered reader fixes the issue, so let
  "os.fdopen" create one.
  
  https://bugzilla.mozilla.org/show_bug.cgi?id=1604486

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -226,7 +226,7 @@
 selector = selectors.DefaultSelector()
 for rfd, wfd in pipes:
 os.close(wfd)
-selector.register(os.fdopen(rfd, 'rb', 0), selectors.EVENT_READ)
+selector.register(os.fdopen(rfd, 'rb'), selectors.EVENT_READ)
 
 def cleanup():
 signal.signal(signal.SIGINT, oldhandler)



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


D7450: packaging: add support for PyOxidizer

2020-01-30 Thread indygreg (Gregory Szorc)
Closed by commit rHG0dd8b752f287: packaging: add support for PyOxidizer 
(authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7450?vs=19628=19728

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7450/new/

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

AFFECTED FILES
  contrib/packaging/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/contrib/packaging/pyoxidizer.bzl b/contrib/packaging/pyoxidizer.bzl
new file mode 100644
--- /dev/null
+++ b/contrib/packaging/pyoxidizer.bzl
@@ -0,0 +1,57 @@
+# Instructions:
+#
+# 1. cargo install --version 0.5.0 pyoxidizer
+# 2. cd /path/to/hg
+# 3. pyoxidizer build --path contrib/packaging [--release]
+# 4. Run build/pyoxidizer///app/hg
+#
+# If you need to build again, you need to remove the build/lib.* and
+# build/temp.* directories, otherwise PyOxidizer fails to pick up C
+# extensions. This is a bug in PyOxidizer.
+
+ROOT = CWD + "/../.."
+
+set_build_path(ROOT + "/build/pyoxidizer")
+
+def make_exe():
+dist = default_python_distribution()
+
+code = "import hgdemandimport; hgdemandimport.enable(); from mercurial 
import dispatch; dispatch.run()"
+
+config = PythonInterpreterConfig(
+raw_allocator = "system",
+run_eval = code,
+# We need this to make resourceutil happy, since it looks for 
sys.frozen.
+sys_frozen = True,
+)
+
+exe = dist.to_python_executable(
+name = "hg",
+config = config,
+)
+
+# Use setup.py install to build Mercurial and collect Python resources to
+# embed in the executable.
+resources = dist.setup_py_install(ROOT)
+exe.add_python_resources(resources)
+
+return exe
+
+def make_install(exe):
+m = FileManifest()
+
+# `hg` goes in root directory.
+m.add_python_resource(".", exe)
+
+templates = glob(
+include=[ROOT + "/mercurial/templates/**/*"],
+strip_prefix = ROOT + "/mercurial/",
+)
+m.add_manifest(templates)
+
+return m
+
+register_target("exe", make_exe)
+register_target("app", make_install, depends = ["exe"], default = True)
+
+resolve_targets()



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


D7450: packaging: add support for PyOxidizer

2020-01-30 Thread mharbison72 (Matt Harbison)
This revision now requires review to proceed.
mharbison72 added a comment.
mharbison72 accepted this revision.


  In D7450#118725 , @martinvonz 
wrote:
  
  > I think @indygreg doesn't have much time for Mercurial these days. 
@mharbison72, what do you think about taking this patch as is and then you can 
send fixes for Windows on top?
  
  Sounds good to me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7450/new/

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

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


D7384: commands: necessary annotations and suppresssions to pass pytype

2020-01-30 Thread dlax (Denis Laxalde)
dlax added a comment.


  In D7384#118739 , @marmoute 
wrote:
  
  > What's up on this ? It seemed on a good track, but I don't think it landed. 
@dlax I think you offer to use a context manager got a warm welcome, I would 
says, go ahead with it.
  
  The context manager got in through D7430 
.

INLINE COMMENTS

> commands.py:4741
> +# pytype isn't convinced, so we have to suppress the
> +# warning about list not having a max() method.
>  endrev = revs.max() + 1

I think this comment should be removed since the `# pytype: disable` got 
removed in the last version of the diff.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7384/new/

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

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


D7295: pytype: add a (very slow) test that executes pytype

2020-01-30 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  This seems useful, and the stabilisation seems to take a long while. Maybe we 
could take it in its current state (with "expected" broken output) and iterate 
from there. With the test in the repo.
  
  What do you all think ?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7295/new/

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

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


D7119: rust-dirstatemap: remove additional lookup in dirstate.matches

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7119#118735 , @marmoute 
wrote:
  
  > What's up on this? It appears to have been
  >
  >   x  29641ceacf8c
  >   |pruned using prune by Martin von Zweigbergk  
(Wed Dec 11 10:48:08 2019 -0800)
  
  That's probably because I queued some version of it and then decided to not 
queue it (I had comments on the parent).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7119/new/

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

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


D7384: commands: necessary annotations and suppresssions to pass pytype

2020-01-30 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  What's up on this ? It seemed on a good track, but I don't think it landed. 
@dlax I think you offer to use a context manager got a warm welcome, I would 
says, go ahead with it.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7384/new/

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

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


D7296: pycompat: kludge around pytype being confused by __new__

2020-01-30 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  The status of this is unclear ? Are we waiting on:
  
  1. a the right way to do it in our codebase?
  2. a fix in pytype?
  3. a fix in python?
  4. something else?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7296/new/

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

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


D7119: rust-dirstatemap: remove additional lookup in dirstate.matches

2020-01-30 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  What's up on this? It appears to have been
  
x  29641ceacf8c
|pruned using prune by Martin von Zweigbergk  
(Wed Dec 11 10:48:08 2019 -0800)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7119/new/

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

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


D6846: packaging: script the building of a MacOS installer using a custom python

2020-01-30 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  What's the latest with this diff ? It seems to still be a work in progress. 
Should it be in the "need-review" state?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6846/new/

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

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


Re: [PATCH STABLE] contrib: a small script to nudge lingering diff

2020-01-30 Thread Pierre-Yves David
Gentle ping on that. Since this is actually put to use, I would rather 
have to in the soruce tree ASAP.


In addition there is a question of "where do we get it to run everyday". 
Right now I am running it by hand. I could set a recurrent job on an 
octobus server, however, I don't feel like it would be the right place 
for this.


On 1/24/20 1:25 PM, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1579866627 -3600
#  Fri Jan 24 12:50:27 2020 +0100
# Branch stable
# Node ID 34b78bfc1afde8d034538e23906ed2ce55ca169a
# Parent  ae596fac8ba072823ca9548b5360caa32a5d4840
# EXP-Topic phab-bot
# Available At https://dev.heptapod.net/octobus/mercurial-devel/
#  hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 
34b78bfc1afd
contrib: a small script to nudge lingering diff

After a discussion on IRC with various reviewers. It seems like a good idea to
have some automatic cleanup of old, inactive diffs.

Here is a small script able to do so. I am preparing to unleash it on our
phabricator instance.

diff --git a/contrib/phab-clean.py b/contrib/phab-clean.py
new file mode 100755
--- /dev/null
+++ b/contrib/phab-clean.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+#
+# A small script to automatically reject idle Diffs
+#
+# you need to set the PHABBOT_USER and PHABBOT_TOKEN environment variable for 
authentication
+from __future__ import absolute_import, print_function
+
+import datetime
+import os
+import sys
+
+import phabricator
+
+MESSAGE = """There seems to have been no activities on this Diff for the past 
3 Months.
+
+By policy, we are automatically moving it out of the `need-review` state.
+
+Please, move it back to `need-review` without hesitation if this diff should 
still be discussed.
+
+:baymax:need-review-idle:
+"""
+
+
+PHAB_URL = "https://phab.mercurial-scm.org/api/;
+USER = os.environ.get("PHABBOT_USER", "baymax")
+TOKEN = os.environ.get("PHABBOT_TOKEN")
+
+
+NOW = datetime.datetime.now()
+
+# 3 months in seconds
+DELAY = 60 * 60 * 24 * 30 * 3
+
+
+def get_all_diff(phab):
+"""Fetch all the diff that the need review"""
+return phab.differential.query(
+status="status-needs-review",
+order="order-modified",
+paths=[('HG', None)],
+)
+
+
+def filter_diffs(diffs, older_than):
+"""filter diffs to only keep the one unmodified sin  seconds"""
+olds = []
+for d in diffs:
+modified = int(d['dateModified'])
+modified = datetime.datetime.fromtimestamp(modified)
+d["idleFor"] = idle_for = NOW - modified
+if idle_for.total_seconds() > older_than:
+olds.append(d)
+return olds
+
+
+def nudge_diff(phab, diff):
+"""Comment on the idle diff and reject it"""
+diff_id = int(d['id'])
+phab.differential.createcomment(
+revision_id=diff_id, message=MESSAGE, action="reject"
+)
+
+
+if not USER:
+print(
+"not user specified please set PHABBOT_USER and PHABBOT_TOKEN",
+file=sys.stderr,
+)
+elif not TOKEN:
+print(
+"not api-token specified please set PHABBOT_USER and PHABBOT_TOKEN",
+file=sys.stderr,
+)
+sys.exit(1)
+
+phab = phabricator.Phabricator(USER, host=PHAB_URL, token=TOKEN)
+phab.connect()
+phab.update_interfaces()
+print('Hello "%s".' % phab.user.whoami()['realName'])
+
+diffs = get_all_diff(phab)
+print("Found %d Diffs" % len(diffs))
+olds = filter_diffs(diffs, DELAY)
+print("Found %d old Diffs" % len(olds))
+for d in olds:
+diff_id = d['id']
+status = d['statusName']
+modified = int(d['dateModified'])
+idle_for = d["idleFor"]
+msg = 'nudging D%s in "%s" state for %s'
+print(msg % (diff_id, status, idle_for))
+# uncomment to actually affect phab
+nudge_diff(phab, d)
diff --git a/tests/test-check-module-imports.t 
b/tests/test-check-module-imports.t
--- a/tests/test-check-module-imports.t
+++ b/tests/test-check-module-imports.t
@@ -24,6 +24,7 @@ outputs, which should be fixed later.
> -X contrib/packaging/hg-docker \
> -X contrib/packaging/hgpackaging/ \
> -X contrib/packaging/inno/ \
+  > -X contrib/phab-clean.py \
> -X contrib/python-zstandard/ \
> -X contrib/win32/hgwebdir_wsgi.py \
> -X contrib/perf-utils/perf-revlog-write-plot.py \
___
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


D7176: rebase: allow rebasing obsolete commit without successor

2020-01-30 Thread baymax (Baymax, Your Personal Patch-care Companion)
This revision now requires changes to proceed.
baymax added a comment.
baymax requested changes to this revision.


  There seems to have been no activities on this Diff for the past 3 Months.
  
  By policy, we are automatically moving it out of the `need-review` state.
  
  Please, move it back to `need-review` without hesitation if this diff should 
still be discussed.
  
  :baymax:need-review-idle:

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7176/new/

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

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


D7188: git: force using bytes in command name

2020-01-30 Thread baymax (Baymax, Your Personal Patch-care Companion)
This revision now requires changes to proceed.
baymax added a comment.
baymax requested changes to this revision.


  There seems to have been no activities on this Diff for the past 3 Months.
  
  By policy, we are automatically moving it out of the `need-review` state.
  
  Please, move it back to `need-review` without hesitation if this diff should 
still be discussed.
  
  :baymax:need-review-idle:

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7188/new/

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

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


D7450: packaging: add support for PyOxidizer

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7450#118285 , @mharbison72 
wrote:
  
  > In D7450#118284 , @martinvonz 
wrote:
  >
  >> I'd be very happy to queue this as soon as @mharbison72's request for 
Windows has been addressed (I think that was all, right?).
  >
  > Yes.
  > I'm still curious about the *.py-as-resources issue[1], but don't want this 
held up.
  > [1] https://phab.mercurial-scm.org/D7450#118094
  
  I think @indygreg doesn't have much time for Mercurial these days. 
@mharbison72, what do you think about taking this patch as is and then you can 
send fixes for Windows on top?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7450/new/

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

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


D8029: uncopy: add new `hg uncopy` command

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 19725.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8029?vs=19692=19725

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8029/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  relnotes/next
  tests/test-completion.t
  tests/test-copy.t
  tests/test-globalopts.t
  tests/test-help-hide.t
  tests/test-help.t
  tests/test-hgweb-json.t

CHANGE DETAILS

diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t
--- a/tests/test-hgweb-json.t
+++ b/tests/test-hgweb-json.t
@@ -2226,6 +2226,10 @@
 "topic": "unbundle"
   },
   {
+"summary": "unmark files as copied",
+"topic": "uncopy"
+  },
+  {
 "summary": "restore a shelved change to the working directory",
 "topic": "unshelve"
   },
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -93,6 +93,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
@@ -221,6 +222,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
@@ -2754,6 +2756,13 @@
   apply one or more bundle files
   
   
+  
+  uncopy
+  
+  
+  unmark files as copied
+  
+  
   
   unshelve
   
diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t
--- a/tests/test-help-hide.t
+++ b/tests/test-help-hide.t
@@ -41,6 +41,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
@@ -177,6 +178,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t
--- a/tests/test-globalopts.t
+++ b/tests/test-globalopts.t
@@ -337,6 +337,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
@@ -469,6 +470,7 @@
copy  mark files as copied for the next commit
diff  diff repository (or selected files)
grep  search for a pattern in specified files
+   uncopyunmark files as copied
   
   Change navigation:
   
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -262,5 +262,62 @@
   xyzzy: not overwriting - file exists
   ('hg copy --after' to record the copy)
   [1]
+  $ hg co -qC .
+  $ rm baz xyzzy
+
+
+Test uncopy of a single file
+
+# Set up by creating a copy
+  $ hg cp bar baz
+# Test uncopying a non-existent file
+  $ hg uncopy non-existent
+  non-existent: $ENOENT$
+# Test uncopying an tracked but unrelated file
+  $ hg uncopy foo
+  foo: not uncopying - file is not marked as copied
+# Test uncopying a copy source
+  $ hg uncopy bar
+  bar: not uncopying - file is not marked as copied
+# baz should still be marked as a copy
+  $ hg st -C
+  A baz
+bar
+# Test the normal case
+  $ hg uncopy baz
+  $ hg st -C
+  A baz
+# Test uncopy with matching an non-matching patterns
+  $ hg cp bar baz --after
+  $ hg uncopy bar baz
+  bar: not uncopying - file is not marked as copied
+  $ hg st -C
+  A baz
+# Test uncopy with no exact matches
+  $ hg cp bar baz --after
+  $ hg uncopy .
+  $ hg st -C
+  A baz
+  $ hg forget baz
+  $ rm baz
+
+Test uncopy of a directory
+
+  $ mkdir dir
+  $ echo foo > dir/foo
+  $ echo bar > dir/bar
+  $ hg add dir
+  adding dir/bar
+  adding dir/foo
+  $ hg ci -m 'add dir/'
+  $ hg cp dir dir2
+  copying dir/bar to dir2/bar
+  copying dir/foo to dir2/foo
+  $ touch dir2/untracked
+  $ hg uncopy dir2
+  $ hg st -C
+  A dir2/bar
+  A dir2/foo
+  ? dir2/untracked
 
   $ cd ..
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -54,6 +54,7 @@
   tags
   tip
   unbundle
+  uncopy
   unshelve
   update
   verify
@@ -356,6 +357,7 @@
   tags: template
   tip: patch, git, style, template
   unbundle: update
+  uncopy: include, exclude
   unshelve: abort, continue, interactive, keep, name, tool, date
   update: clean, check, merge, date, rev, tool
   verify: full
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ 

D8030: uncopy: add support for unmarking committed copies

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 19726.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8030?vs=19693=19726

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8030/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  relnotes/next
  tests/test-completion.t
  tests/test-copy.t
  tests/test-rename-after-merge.t

CHANGE DETAILS

diff --git a/tests/test-rename-after-merge.t b/tests/test-rename-after-merge.t
--- a/tests/test-rename-after-merge.t
+++ b/tests/test-rename-after-merge.t
@@ -120,4 +120,10 @@
   $ hg log -r tip -C -v | grep copies
   copies:  b2 (b1)
 
+Test unmarking copies in merge commit
+
+  $ hg uncopy -r . b2
+  abort: cannot unmark copy in merge commit
+  [255]
+
   $ cd ..
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -319,5 +319,56 @@
   A dir2/bar
   A dir2/foo
   ? dir2/untracked
+# Clean up for next test
+  $ hg forget dir2
+  removing dir2/bar
+  removing dir2/foo
+  $ rm -r dir2
+
+Test uncopy on committed copies
+
+# Commit some copies
+  $ hg cp bar baz
+  $ hg cp bar qux
+  $ hg ci -m copies
+  $ hg st -C --change .
+  A baz
+bar
+  A qux
+bar
+  $ base=$(hg log -r '.^' -T '{rev}')
+  $ hg log -G -T '{rev}:{node|short} {desc}\n' -r $base:
+  @  5:a612dc2edfda copies
+  |
+  o  4:4800b1f1f38e add dir/
+  |
+  ~
+# Add a dirty change on top to show that it's unaffected
+  $ echo dirty >> baz
+  $ hg st
+  M baz
+  $ cat baz
+  bleah
+  dirty
+  $ hg uncopy -r . baz
+  saved backup bundle to 
$TESTTMP/part2/.hg/strip-backup/a612dc2edfda-e36b4448-uncopy.hg
+# The unwanted copy is no longer recorded, but the unrelated one is
+  $ hg st -C --change .
+  A baz
+  A qux
+bar
+# The old commit is gone and we have updated to the new commit
+  $ hg log -G -T '{rev}:{node|short} {desc}\n' -r $base:
+  @  5:c45090e5effe copies
+  |
+  o  4:4800b1f1f38e add dir/
+  |
+  ~
+# Working copy still has the uncommitted change
+  $ hg st
+  M baz
+  $ cat baz
+  bleah
+  dirty
 
   $ cd ..
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -357,7 +357,7 @@
   tags: template
   tip: patch, git, style, template
   unbundle: update
-  uncopy: include, exclude
+  uncopy: rev, include, exclude
   unshelve: abort, continue, interactive, keep, name, tool, date
   update: clean, check, merge, date, rev, tool
   verify: full
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -1,6 +1,7 @@
 == New Features ==
 
- * `hg uncopy` can be used to unmark a file as copied.
+ * `hg uncopy` can be used to unmark a file as copied. Use `hg uncopy -r REV`
+   to unmark already committed copies.
 
 
 == New Experimental Features ==
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2488,6 +2488,17 @@
 editor=editor,
 )
 
+def tomemctx_for_amend(self, precursor):
+extra = precursor.extra().copy()
+extra[b'amend_source'] = precursor.hex()
+return self.tomemctx(
+text=precursor.description(),
+branch=precursor.branch(),
+extra=extra,
+date=precursor.date(),
+user=precursor.user(),
+)
+
 def isdirty(self, path):
 return path in self._cache
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7495,7 +7495,8 @@
 
 @command(
 b'uncopy',
-walkopts,
+[(b'r', b'rev', b'', _(b'unmark copies in the given revision'), _(b'REV'))]
++ walkopts,
 _(b'[OPTION]... DEST...'),
 helpcategory=command.CATEGORY_FILE_CONTENTS,
 )
@@ -7504,7 +7505,8 @@
 
 Unmark DEST as having copies of source files.
 
-This command takes effect with the next commit.
+This command takes effect with the next commit by default. Use
+``-r`` to unmark copies in an existing commit.
 
 Returns 0 on success, 1 if errors are encountered.
 """
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1695,7 +1695,23 @@
 
 
 def uncopy(ui, repo, pats, opts):
-ctx = repo[None]
+rev = opts[b'rev']
+if rev:
+ctx = scmutil.revsingle(repo, rev)
+else:
+ctx = repo[None]
+if ctx.rev() is None:
+new_ctx = ctx
+else:
+if len(ctx.parents()) > 1:
+raise error.Abort(_(b'cannot unmark copy in merge commit'))
+# avoid cycle context -> subrepo -> cmdutil
+from . import context
+
+rewriteutil.precheck(repo, [ctx.rev()], b'uncopy')
+new_ctx = context.overlayworkingctx(repo)
+new_ctx.setbase(ctx.p1())
+mergemod.graft(repo, ctx, wctx=new_ctx)
 
 match = scmutil.match(ctx, 

D8035: copy: add support for marking committed copies

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 19727.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8035?vs=19697=19727

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8035/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  relnotes/next
  tests/test-completion.t
  tests/test-rename-after-merge.t
  tests/test-rename-rev.t
  tests/test-rename.t

CHANGE DETAILS

diff --git a/tests/test-rename.t b/tests/test-rename-rev.t
copy from tests/test-rename.t
copy to tests/test-rename-rev.t
--- a/tests/test-rename.t
+++ b/tests/test-rename-rev.t
@@ -6,693 +6,51 @@
   $ echo d1/b > d1/b
   $ echo d2/b > d2/b
   $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
-  $ hg commit -m "1"
-
-rename a single file
-
-  $ hg rename d1/d11/a1 d2/c
-  $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
-  abort: filename contains 'con', which is reserved on Windows: d1/con.xml
-  [255]
-  $ hg sum
-  parent: 0:9b4b6e7b2c26 tip
-   1
-  branch: default
-  commit: 1 renamed
-  update: (current)
-  phases: 1 draft
-  $ hg status -C
-  A d2/c
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/c
-
-rename a single file using absolute paths
-
-  $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
-  $ hg status -C
-  A d2/c
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/c
+  $ hg commit -m "intial"
 
-rename --after a single file
 
-  $ mv d1/d11/a1 d2/c
-  $ hg rename --after d1/d11/a1 d2/c
-  $ hg status -C
-  A d2/c
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/c
-
-rename --after a single file when src and tgt already tracked
-
-  $ mv d1/d11/a1 d2/c
-  $ hg addrem -s 0
-  removing d1/d11/a1
-  adding d2/c
-  $ hg rename --after d1/d11/a1 d2/c
-  $ hg status -C
-  A d2/c
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/c
-
-rename --after a single file to a nonexistent target filename
-
-  $ hg rename --after d1/a dummy
-  d1/a: not recording move - dummy does not exist
-  [1]
-
-move a single file to an existing directory
+Test single file
 
-  $ hg rename d1/d11/a1 d2
-  $ hg status -C
-  A d2/a1
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/a1
-
-move --after a single file to an existing directory
-
-  $ mv d1/d11/a1 d2
-  $ hg rename --after d1/d11/a1 d2
-  $ hg status -C
-  A d2/a1
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d2/a1
-
-rename a file using a relative path
-
-  $ (cd d1/d11; hg rename ../../d2/b e)
-  $ hg status -C
-  A d1/d11/e
-d2/b
-  R d2/b
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d1/d11/e
-
-rename --after a file using a relative path
-
-  $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
-  $ hg status -C
-  A d1/d11/e
-d2/b
-  R d2/b
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm d1/d11/e
-
-rename directory d1 as d3
-
-  $ hg rename d1/ d3
-  moving d1/a to d3/a
-  moving d1/b to d3/b
-  moving d1/ba to d3/ba
-  moving d1/d11/a1 to d3/d11/a1
-  $ hg status -C
-  A d3/a
-d1/a
-  A d3/b
-d1/b
-  A d3/ba
-d1/ba
-  A d3/d11/a1
-d1/d11/a1
-  R d1/a
-  R d1/b
-  R d1/ba
-  R d1/d11/a1
-  $ hg update -C
-  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm -rf d3
-
-rename --after directory d1 as d3
-
-  $ mv d1 d3
-  $ hg rename --after d1 d3
-  moving d1/a to d3/a
-  moving d1/b to d3/b
-  moving d1/ba to d3/ba
-  moving d1/d11/a1 to d3/d11/a1
-  $ hg status -C
-  A d3/a
-d1/a
-  A d3/b
+# One recoded copy, one copy to record after commit
+  $ hg cp d1/b d1/c
+  $ cp d1/b d1/d
+  $ hg add d1/d
+  $ hg ci -m 'copy d1/b to d1/c and d1/d'
+  $ hg st -C --change .
+  A d1/c
 d1/b
-  A d3/ba
-d1/ba
-  A d3/d11/a1
-d1/d11/a1
-  R d1/a
-  R d1/b
-  R d1/ba
-  R d1/d11/a1
-  $ hg update -C
-  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm -rf d3
-
-move a directory using a relative path
-
-  $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1
-  $ hg status -C
-  A d2/d3/d11/a1
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ rm -rf d2/d3
-
-move --after a directory using a relative path
-
-  $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1
-  $ hg status -C
-  A d2/d3/d11/a1
-d1/d11/a1
-  R d1/d11/a1
-  $ hg update -C
-  1 

D8029: uncopy: add new `hg uncopy` command

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> martinvonz wrote in commands.py:7502
> Oops, I just forgot about that, I think. I'll send a follow-up (I assume you 
> know that many of the patches you're reviewing now are already queued).

Sorry, I forgot that this series was just accepted but not queued :) I've added 
documentation now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8029/new/

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

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


D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   What do you think about this approach:
  >   1. The server detects that LC_TYPE is coerced.
  >   2. When handling the "validate" command, the server sends back 
"invalidate this server, and fallback to original hg" response.
  >   This makes chg/non-chg behave consistently with some startup overhead in 
mis-configured environment. The chg client can potentially print a warning to 
remind the user to fix their environment.
  
  That could be, but if we do want to make chg/hg behavior consistent, maybe we
  can adjust the hash computation logic?
  
  1. client sends CHG_ORIG_LC_CTYPE or CHG_UNSET_LC_CTYPE when spawning server
  2. they're kept in environ dict, but override LC_CTYPE while computing hash, 
and excluded from the hash
  3. client does not send these variables over setenv command, but passes the 
validation because `{CHG_ORIG_LC_CTYPE: x, LC_CTYPE: y} == {LC_CTYPE: x}`.
  
  If we had a sha1 logic in C, we could compute the env hash at client side.
  Python 3 can't be trusted.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8039/new/

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

To: spectral, #hg-reviewers
Cc: quark, yuja, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread Yuya Nishihara
>   What do you think about this approach:
>   
>   1. The server detects that LC_TYPE is coerced.
>   2. When handling the "validate" command, the server sends back "invalidate 
> this server, and fallback to original hg" response.
>   
>   This makes chg/non-chg behave consistently with some startup overhead in 
> mis-configured environment. The chg client can potentially print a warning to 
> remind the user to fix their environment.

That could be, but if we do want to make chg/hg behavior consistent, maybe we
can adjust the hash computation logic?

 1. client sends CHG_ORIG_LC_CTYPE or CHG_UNSET_LC_CTYPE when spawning server
 2. they're kept in environ dict, but override LC_CTYPE while computing hash,
and excluded from the hash
 3. client does not send these variables over setenv command, but passes the
validation because `{CHG_ORIG_LC_CTYPE: x, LC_CTYPE: y} == {LC_CTYPE: x}`.

If we had a sha1 logic in C, we could compute the env hash at client side.
Python 3 can't be trusted.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7827: rebase: don't use rebased node as dirstate p2 (BC)

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 19724.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7827?vs=19705=19724

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7827/new/

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

AFFECTED FILES
  hgext/rebase.py
  relnotes/next
  tests/test-rebase-abort.t
  tests/test-rebase-collapse.t
  tests/test-rebase-conflicts.t
  tests/test-rebase-interruptions.t
  tests/test-rebase-obsolete.t
  tests/test-rebase-parameters.t
  tests/test-rebase-transaction.t

CHANGE DETAILS

diff --git a/tests/test-rebase-transaction.t b/tests/test-rebase-transaction.t
--- a/tests/test-rebase-transaction.t
+++ b/tests/test-rebase-transaction.t
@@ -114,7 +114,7 @@
   |
   | @  4: Z
   | |
-  @ |  3: C
+  % |  3: C
   | |
   | o  2: Y
   | |
@@ -123,9 +123,9 @@
   o  0: A
   
   $ hg st
-  M C
   M conflict
   A B
+  A C
   ? conflict.orig
   $ echo resolved > conflict
   $ hg resolve -m
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -473,11 +473,9 @@
   $ hg summary
   parent: 1:56daeba07f4b 
c2
-  parent: 2:e4e3f3546619 tip
-   c2b
   branch: default
-  commit: 1 modified, 1 unresolved (merge)
-  update: (current)
+  commit: 1 unresolved (clean)
+  update: 1 new changesets, 2 branch heads (merge)
   phases: 3 draft
   rebase: 0 rebased, 1 remaining (rebase --continue)
 
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
@@ -1795,19 +1795,15 @@
   $ hg log -G
   @  2:b18e25de2cf5 D
   |
-  | @  1:2ec65233581b B (pruned using prune)
-  |/
   o  0:426bada5c675 A
   
   $ hg summary
   parent: 2:b18e25de2cf5 tip
D
-  parent: 1:2ec65233581b  (obsolete)
-   B
   branch: default
-  commit: 2 modified, 1 unknown, 1 unresolved (merge)
+  commit: 1 modified, 1 added, 1 unknown, 1 unresolved
   update: (current)
-  phases: 3 draft
+  phases: 2 draft
   rebase: 0 rebased, 2 remaining (rebase --continue)
 
   $ hg rebase --abort
diff --git a/tests/test-rebase-interruptions.t 
b/tests/test-rebase-interruptions.t
--- a/tests/test-rebase-interruptions.t
+++ b/tests/test-rebase-interruptions.t
@@ -294,7 +294,7 @@
   $ hg tglogp
   @  7: 401ccec5e39f secret 'C'
   |
-  | @  6: a0b2430ebfb8 secret 'F'
+  | o  6: a0b2430ebfb8 secret 'F'
   | |
   o |  5: 45396c49d53b public 'B'
   | |
@@ -345,7 +345,7 @@
   $ hg tglogp
   @  7: 401ccec5e39f secret 'C'
   |
-  | @  6: a0b2430ebfb8 secret 'F'
+  | o  6: a0b2430ebfb8 secret 'F'
   | |
   o |  5: 45396c49d53b public 'B'
   | |
@@ -395,7 +395,7 @@
   $ hg tglogp
   @  7: 401ccec5e39f secret 'C'
   |
-  | @  6: a0b2430ebfb8 secret 'F'
+  | o  6: a0b2430ebfb8 secret 'F'
   | |
   o |  5: 45396c49d53b public 'B'
   | |
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -456,16 +456,14 @@
   warning: conflicts while merging conflict! (edit, then use 'hg resolve 
--mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
-It's weird that the current parents are not 7 and 8 since that's what we're
-merging
   $ hg tglog
   @  8:draft 'E'
   |
-  | o  7:draft 'D'
+  | @  7:draft 'D'
   |/
   o  6:draft 'C'
   |
-  | @5:draft 'F'
+  | %5:draft 'F'
   | |\
   | | o  4:draft 'E'
   | | |
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -712,7 +712,7 @@
   |
   | @  2: 82b8abf9c185 'D'
   | |
-  @ |  1: f899f3910ce7 'B'
+  % |  1: f899f3910ce7 'B'
   |/
   o  0: 4a2df7238c3b 'A'
   
@@ -736,7 +736,7 @@
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
   $ hg tglog
-  @  3: 63668d570d21 'C'
+  %  3: 63668d570d21 'C'
   |
   | @  2: 82b8abf9c185 'D'
   | |
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
@@ -236,7 +236,7 @@
   [1]
 
   $ hg tglog
-  @  4:draft 'C1'
+  %  4:draft 'C1'
   |
   o  3:draft 'B bis'
   |
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -18,6 +18,11 @@
 
 == Backwards Compatibility Changes ==
 
+ * When `hg rebase` pauses for merge conflict resolution, the working
+   copy will no longer have the rebased node as a second parent. You
+   can use the new `conflictparents()` revset for finding the other
+   parent during a conflict.
+
 
 == Internal API Changes ==
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -617,6 +617,7 @@
 repo,
 rev,
 p1,
+p2,
 base,
 self.collapsef,
 dest,
@@ -641,10 

D8043: graphlog: use '%' for other context in merge conflict

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz edited the summary of this revision.
martinvonz retitled this revision from "graphlog: use '@' also for other 
context in merge conflict" to "graphlog: use '%' for other context in merge 
conflict".
martinvonz updated this revision to Diff 19723.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8043?vs=19703=19723

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8043/new/

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

AFFECTED FILES
  hgext/beautifygraph.py
  mercurial/hgweb/webutil.py
  mercurial/logcmdutil.py
  mercurial/templatekw.py
  relnotes/next
  tests/test-backout.t
  tests/test-graft-interrupted.t
  tests/test-rebase-collapse.t
  tests/test-strip.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -254,7 +254,7 @@
   |
   @  4:d047485b3896 0:60829823a42a  b1
   |
-  | o  3:6efa171f091b 1:0786582aa4b1
+  | %  3:6efa171f091b 1:0786582aa4b1
   | |
   | | o  2:bd10386d478c
   | |/
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -598,7 +598,7 @@
   |  date:Thu Jan 01 00:00:00 1970 +
   |  summary: b
   |
-  o  changeset:   0:9ab35a2d17cb
+  %  changeset:   0:9ab35a2d17cb
  user:test
  date:Thu Jan 01 00:00:00 1970 +
  summary: a
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -762,7 +762,7 @@
   abort: edit failed: false exited with status 1
   [255]
   $ hg tglog
-  o  3: 63668d570d21 'C'
+  %  3: 63668d570d21 'C'
   |
   | @  2: 82b8abf9c185 'D'
   | |
diff --git a/tests/test-graft-interrupted.t b/tests/test-graft-interrupted.t
--- a/tests/test-graft-interrupted.t
+++ b/tests/test-graft-interrupted.t
@@ -431,7 +431,7 @@
   $ hg log -GT "{rev}:{node|short} {desc}"
   @  6:6ec71c037d94 added x
   |
-  | o  5:36b793615f78 added foo to c
+  | %  5:36b793615f78 added foo to c
   | |
   | | o  4:863a25e1a9ea added x
   | |/
@@ -622,7 +622,7 @@
   $ hg log -GT "{rev}:{node|short} {desc}\n"
   @  4:2aa9ad1006ff B in file a
   |
-  | o  3:09e253b87e17 A in file a
+  | %  3:09e253b87e17 A in file a
   | |
   | o  2:d36c0562f908 c
   | |
@@ -669,7 +669,7 @@
   $ hg log -GT "{rev}:{node|short} {desc}\n"
   @  4:2aa9ad1006ff B in file a
   |
-  | o  3:09e253b87e17 A in file a
+  | %  3:09e253b87e17 A in file a
   | |
   | o  2:d36c0562f908 c
   | |
@@ -712,7 +712,7 @@
   $ hg log -GT "{rev}:{node|short} {desc}\n"
   @  4:2aa9ad1006ff B in file a
   |
-  | o  3:09e253b87e17 A in file a
+  | %  3:09e253b87e17 A in file a
   | |
   | o  2:d36c0562f908 c
   | |
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -103,7 +103,7 @@
   |  date:Thu Jan 01 00:00:02 1970 +
   |  summary: grapes
   |
-  o  changeset:   1:22cb4f70d813
+  %  changeset:   1:22cb4f70d813
   |  user:test
   |  date:Thu Jan 01 00:00:01 1970 +
   |  summary: chair
@@ -748,7 +748,7 @@
   |  date:Thu Jan 01 00:00:00 1970 +
   |  summary: capital three
   |
-  o  changeset:   0:a30dd8addae3
+  %  changeset:   0:a30dd8addae3
  user:test
  date:Thu Jan 01 00:00:00 1970 +
  summary: initial
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -1,5 +1,10 @@
 == New Features ==
 
+ * `hg log` now defaults to using an '%' symbol for parents of
+unresolved merge conflicts. That includes unresolved conflicts
+caused by e.g. `hg update --merge` and `hg graft`. '@' still takes
+precedence, so when what used to be marked '@' still is.
+
  * New `conflictparents()` revset returns the commits that are being
merged, when there are conflicts. Also works for conflicts caused
by e.g. `hg graft`.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -396,26 +396,38 @@
 return templateutil.compatfileslist(context, mapping, b'file', ctx.files())
 
 
-@templatekeyword(b'graphnode', requires={b'repo', b'ctx'})
+@templatekeyword(b'graphnode', requires={b'repo', b'ctx', b'cache'})
 def showgraphnode(context, mapping):
 """String. The character representing the changeset node in an ASCII
 revision graph."""
 repo = context.resource(mapping, b'repo')
 ctx = context.resource(mapping, b'ctx')
-return getgraphnode(repo, ctx)
+cache = context.resource(mapping, b'cache')
+return getgraphnode(repo, ctx, cache)
 
 
-def getgraphnode(repo, ctx):
-return getgraphnodecurrent(repo, ctx) or getgraphnodesymbol(ctx)
+def getgraphnode(repo, ctx, cache):
+return getgraphnodecurrent(repo, ctx, cache) or getgraphnodesymbol(ctx)
 
 
-def 

[PATCH 6 of 6] rust-cpython: remove PySharedRefCell and its companion structs

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1579941024 -32400
#  Sat Jan 25 17:30:24 2020 +0900
# Node ID 419d82410496d29e04a67292ff325f8ecea3f989
# Parent  daf8dc5bb62f80794c12ddaede649d73cc4a4f33
rust-cpython: remove PySharedRefCell and its companion structs

Also updates py_shared_iterator!() documentation accordingly.

diff --git a/rust/hg-cpython/src/ref_sharing.rs 
b/rust/hg-cpython/src/ref_sharing.rs
--- a/rust/hg-cpython/src/ref_sharing.rs
+++ b/rust/hg-cpython/src/ref_sharing.rs
@@ -22,416 +22,6 @@
 
 //! Macros for use in the `hg-cpython` bridge library.
 
-use cpython::{exc, PyClone, PyErr, PyObject, PyResult, Python};
-use std::cell::{BorrowMutError, Ref, RefCell, RefMut};
-use std::ops::{Deref, DerefMut};
-use std::result;
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-/// Manages the shared state between Python and Rust
-///
-/// `PySharedState` is owned by `PySharedRefCell`, and is shared across its
-/// derived references. The consistency of these references are guaranteed
-/// as follows:
-///
-/// - The immutability of `py_class!` object fields. Any mutation of
-///   `PySharedRefCell` is allowed only through its `borrow_mut()`.
-/// - The `py: Python<'_>` token, which makes sure that any data access is
-///   synchronized by the GIL.
-/// - The underlying `RefCell`, which prevents `PySharedRefCell` data from
-///   being directly borrowed or leaked while it is mutably borrowed.
-/// - The `borrow_count`, which is the number of references borrowed from
-///   `PyLeaked`. Just like `RefCell`, mutation is prohibited while `PyLeaked`
-///   is borrowed.
-/// - The `generation` counter, which increments on `borrow_mut()`. `PyLeaked`
-///   reference is valid only if the `current_generation()` equals to the
-///   `generation` at the time of `leak_immutable()`.
-#[derive(Debug, Default)]
-struct PySharedState {
-// The counter variable could be Cell since any operation on
-// PySharedState is synchronized by the GIL, but being "atomic" makes
-// PySharedState inherently Sync. The ordering requirement doesn't
-// matter thanks to the GIL.
-borrow_count: AtomicUsize,
-generation: AtomicUsize,
-}
-
-impl PySharedState {
-fn current_borrow_count(, _py: Python) -> usize {
-self.borrow_count.load(Ordering::Relaxed)
-}
-
-fn increase_borrow_count(, _py: Python) {
-// Note that this wraps around if there are more than usize::MAX
-// borrowed references, which shouldn't happen due to memory limit.
-self.borrow_count.fetch_add(1, Ordering::Relaxed);
-}
-
-fn decrease_borrow_count(, _py: Python) {
-let prev_count = self.borrow_count.fetch_sub(1, Ordering::Relaxed);
-assert!(prev_count > 0);
-}
-
-fn current_generation(, _py: Python) -> usize {
-self.generation.load(Ordering::Relaxed)
-}
-
-fn increment_generation(, py: Python) {
-assert_eq!(self.current_borrow_count(py), 0);
-// Note that this wraps around to the same value if mutably
-// borrowed more than usize::MAX times, which wouldn't happen
-// in practice.
-self.generation.fetch_add(1, Ordering::Relaxed);
-}
-}
-
-/// Helper to keep the borrow count updated while the shared object is
-/// immutably borrowed without using the `RefCell` interface.
-struct BorrowPyShared<'a> {
-py: Python<'a>,
-py_shared_state: &'a PySharedState,
-}
-
-impl<'a> BorrowPyShared<'a> {
-fn new(
-py: Python<'a>,
-py_shared_state: &'a PySharedState,
-) -> BorrowPyShared<'a> {
-py_shared_state.increase_borrow_count(py);
-BorrowPyShared {
-py,
-py_shared_state,
-}
-}
-}
-
-impl Drop for BorrowPyShared<'_> {
-fn drop( self) {
-self.py_shared_state.decrease_borrow_count(self.py);
-}
-}
-
-/// `RefCell` wrapper to be safely used in conjunction with `PySharedState`.
-///
-/// This object can be stored in a `py_class!` object as a data field. Any
-/// operation is allowed through the `PySharedRef` interface.
-#[derive(Debug)]
-pub struct PySharedRefCell {
-inner: RefCell,
-py_shared_state: PySharedState,
-}
-
-impl PySharedRefCell {
-pub fn new(value: T) -> PySharedRefCell {
-Self {
-inner: RefCell::new(value),
-py_shared_state: PySharedState::default(),
-}
-}
-
-fn borrow<'a>(&'a self, _py: Python<'a>) -> Ref<'a, T> {
-// py_shared_state isn't involved since
-// - inner.borrow() would fail if self is mutably borrowed,
-// - and inner.try_borrow_mut() would fail while self is borrowed.
-self.inner.borrow()
-}
-
-fn try_borrow_mut<'a>(
-&'a self,
-py: Python<'a>,
-) -> result::Result, BorrowMutError> {
-if self.py_shared_state.current_borrow_count(py) > 0 {
-// propagate borrow-by-leaked state to inner to get BorrowMutError
-let _dummy = self.inner.borrow();
- 

[PATCH 5 of 6] rust-cpython: switch to upstreamed version of PySharedRefCell

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1579940783 -32400
#  Sat Jan 25 17:26:23 2020 +0900
# Node ID daf8dc5bb62f80794c12ddaede649d73cc4a4f33
# Parent  641a0f64ae5a289a476dceac692ecf7d665b6ff3
rust-cpython: switch to upstreamed version of PySharedRefCell

Our PyLeaked is identical to cpython::UnsafePyLeaked. I've renamed it because
it provides mostly unsafe functions.

diff --git a/rust/hg-cpython/src/dirstate/copymap.rs 
b/rust/hg-cpython/src/dirstate/copymap.rs
--- a/rust/hg-cpython/src/dirstate/copymap.rs
+++ b/rust/hg-cpython/src/dirstate/copymap.rs
@@ -8,11 +8,12 @@
 //! Bindings for `hg::dirstate::dirstate_map::CopyMap` provided by the
 //! `hg-core` package.
 
-use cpython::{PyBytes, PyClone, PyDict, PyObject, PyResult, Python};
+use cpython::{
+PyBytes, PyClone, PyDict, PyObject, PyResult, Python, UnsafePyLeaked,
+};
 use std::cell::RefCell;
 
 use crate::dirstate::dirstate_map::DirstateMap;
-use crate::ref_sharing::PyLeaked;
 use hg::{utils::hg_path::HgPathBuf, CopyMapIter};
 
 py_class!(pub class CopyMap |py| {
@@ -104,14 +105,14 @@ impl CopyMap {
 
 py_shared_iterator!(
 CopyMapKeysIterator,
-PyLeaked>,
+UnsafePyLeaked>,
 CopyMap::translate_key,
 Option
 );
 
 py_shared_iterator!(
 CopyMapItemsIterator,
-PyLeaked>,
+UnsafePyLeaked>,
 CopyMap::translate_key_value,
 Option<(PyBytes, PyBytes)>
 );
diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs 
b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
@@ -13,11 +13,10 @@ use std::convert::TryInto;
 
 use cpython::{
 exc, ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyObject, PyResult,
-Python,
+Python, UnsafePyLeaked,
 };
 
 use crate::dirstate::extract_dirstate;
-use crate::ref_sharing::{PyLeaked, PySharedRefCell};
 use hg::{
 utils::hg_path::{HgPath, HgPathBuf},
 DirsMultiset, DirsMultisetIter, DirstateMapError, DirstateParseError,
@@ -25,7 +24,7 @@ use hg::{
 };
 
 py_class!(pub class Dirs |py| {
-data inner_: PySharedRefCell;
+@shared data inner: DirsMultiset;
 
 // `map` is either a `dict` or a flat iterator (usually a `set`, sometimes
 // a `list`)
@@ -65,10 +64,7 @@ py_class!(pub class Dirs |py| {
 })?
 };
 
-Self::create_instance(
-py,
-PySharedRefCell::new(inner),
-)
+Self::create_instance(py, inner)
 }
 
 def addpath(, path: PyObject) -> PyResult {
@@ -123,11 +119,9 @@ py_class!(pub class Dirs |py| {
 }
 });
 
-py_shared_ref!(Dirs, DirsMultiset, inner_, inner);
-
 impl Dirs {
 pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult {
-Self::create_instance(py, PySharedRefCell::new(d))
+Self::create_instance(py, d)
 }
 
 fn translate_key(
@@ -140,7 +134,7 @@ impl Dirs {
 
 py_shared_iterator!(
 DirsMultisetKeysIterator,
-PyLeaked>,
+UnsafePyLeaked>,
 Dirs::translate_key,
 Option
 );
diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -14,13 +14,12 @@ use std::time::Duration;
 
 use cpython::{
 exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyObject,
-PyResult, PyTuple, Python, PythonObject, ToPyObject,
+PyResult, PyTuple, Python, PythonObject, ToPyObject, UnsafePyLeaked,
 };
 
 use crate::{
 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
 dirstate::{dirs_multiset::Dirs, make_dirstate_tuple},
-ref_sharing::{PyLeaked, PySharedRefCell},
 };
 use hg::{
 utils::hg_path::{HgPath, HgPathBuf},
@@ -42,14 +41,11 @@ use hg::{
 // All attributes also have to have a separate refcount data attribute for
 // leaks, with all methods that go along for reference sharing.
 py_class!(pub class DirstateMap |py| {
-data inner_: PySharedRefCell;
+@shared data inner: RustDirstateMap;
 
 def __new__(_cls, _root: PyObject) -> PyResult {
 let inner = RustDirstateMap::default();
-Self::create_instance(
-py,
-PySharedRefCell::new(inner),
-)
+Self::create_instance(py, inner)
 }
 
 def clear() -> PyResult {
@@ -497,18 +493,16 @@ impl DirstateMap {
 }
 }
 
-py_shared_ref!(DirstateMap, RustDirstateMap, inner_, inner);
-
 py_shared_iterator!(
 DirstateMapKeysIterator,
-PyLeaked>,
+UnsafePyLeaked>,
 DirstateMap::translate_key,
 Option
 );
 
 py_shared_iterator!(
 DirstateMapItemsIterator,
-PyLeaked>,
+UnsafePyLeaked>,
 DirstateMap::translate_key_value,
 Option<(PyBytes, PyObject)>
 );
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 6] rust-cpython: rename inner_shared() to inner()

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1579940466 -32400
#  Sat Jan 25 17:21:06 2020 +0900
# Node ID 641a0f64ae5a289a476dceac692ecf7d665b6ff3
# Parent  44c3b090dea5b6f5f048796c997c0d7176e8bc0a
rust-cpython: rename inner_shared() to inner()

The "shared" accessor will be automatically generated, and will have the
same name as the data itself.

diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs 
b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
@@ -25,7 +25,7 @@ use hg::{
 };
 
 py_class!(pub class Dirs |py| {
-data inner: PySharedRefCell;
+data inner_: PySharedRefCell;
 
 // `map` is either a `dict` or a flat iterator (usually a `set`, sometimes
 // a `list`)
@@ -72,7 +72,7 @@ py_class!(pub class Dirs |py| {
 }
 
 def addpath(, path: PyObject) -> PyResult {
-self.inner_shared(py).borrow_mut().add_path(
+self.inner(py).borrow_mut().add_path(
 HgPath::new(path.extract::(py)?.data(py)),
 ).and(Ok(py.None())).or_else(|e| {
 match e {
@@ -90,7 +90,7 @@ py_class!(pub class Dirs |py| {
 }
 
 def delpath(, path: PyObject) -> PyResult {
-self.inner_shared(py).borrow_mut().delete_path(
+self.inner(py).borrow_mut().delete_path(
 HgPath::new(path.extract::(py)?.data(py)),
 )
 .and(Ok(py.None()))
@@ -109,7 +109,7 @@ py_class!(pub class Dirs |py| {
 })
 }
 def __iter__() -> PyResult {
-let leaked_ref = self.inner_shared(py).leak_immutable();
+let leaked_ref = self.inner(py).leak_immutable();
 DirsMultisetKeysIterator::from_inner(
 py,
 unsafe { leaked_ref.map(py, |o| o.iter()) },
@@ -117,13 +117,13 @@ py_class!(pub class Dirs |py| {
 }
 
 def __contains__(, item: PyObject) -> PyResult {
-Ok(self.inner_shared(py).borrow().contains(HgPath::new(
+Ok(self.inner(py).borrow().contains(HgPath::new(
 item.extract::(py)?.data(py).as_ref(),
 )))
 }
 });
 
-py_shared_ref!(Dirs, DirsMultiset, inner, inner_shared);
+py_shared_ref!(Dirs, DirsMultiset, inner_, inner);
 
 impl Dirs {
 pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult {
diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -42,7 +42,7 @@ use hg::{
 // All attributes also have to have a separate refcount data attribute for
 // leaks, with all methods that go along for reference sharing.
 py_class!(pub class DirstateMap |py| {
-data inner: PySharedRefCell;
+data inner_: PySharedRefCell;
 
 def __new__(_cls, _root: PyObject) -> PyResult {
 let inner = RustDirstateMap::default();
@@ -53,7 +53,7 @@ py_class!(pub class DirstateMap |py| {
 }
 
 def clear() -> PyResult {
-self.inner_shared(py).borrow_mut().clear();
+self.inner(py).borrow_mut().clear();
 Ok(py.None())
 }
 
@@ -63,7 +63,7 @@ py_class!(pub class DirstateMap |py| {
 default: Option = None
 ) -> PyResult> {
 let key = key.extract::(py)?;
-match self.inner_shared(py).borrow().get(HgPath::new(key.data(py))) {
+match self.inner(py).borrow().get(HgPath::new(key.data(py))) {
 Some(entry) => {
 Ok(Some(make_dirstate_tuple(py, entry)?))
 },
@@ -80,7 +80,7 @@ py_class!(pub class DirstateMap |py| {
 size: PyObject,
 mtime: PyObject
 ) -> PyResult {
-self.inner_shared(py).borrow_mut().add_file(
+self.inner(py).borrow_mut().add_file(
 HgPath::new(f.extract::(py)?.data(py)),
 oldstate.extract::(py)?.data(py)[0]
 .try_into()
@@ -108,7 +108,7 @@ py_class!(pub class DirstateMap |py| {
 oldstate: PyObject,
 size: PyObject
 ) -> PyResult {
-self.inner_shared(py).borrow_mut()
+self.inner(py).borrow_mut()
 .remove_file(
 HgPath::new(f.extract::(py)?.data(py)),
 oldstate.extract::(py)?.data(py)[0]
@@ -132,7 +132,7 @@ py_class!(pub class DirstateMap |py| {
 f: PyObject,
 oldstate: PyObject
 ) -> PyResult {
-self.inner_shared(py).borrow_mut()
+self.inner(py).borrow_mut()
 .drop_file(
 HgPath::new(f.extract::(py)?.data(py)),
 oldstate.extract::(py)?.data(py)[0]
@@ -163,7 +163,7 @@ py_class!(pub class DirstateMap |py| {
 ))
 })
 .collect();
-self.inner_shared(py).borrow_mut()
+self.inner(py).borrow_mut()
 .clear_ambiguous_times(files?, now.extract(py)?);
 Ok(py.None())
 }
@@ -171,7 +171,7 @@ py_class!(pub class DirstateMap |py| {
 // TODO share the reference
 

[PATCH 3 of 6] rust-cpython: use PyList.insert() instead of .insert_item()

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1580396910 -32400
#  Fri Jan 31 00:08:30 2020 +0900
# Node ID 44c3b090dea5b6f5f048796c997c0d7176e8bc0a
# Parent  50dcc8baffa106c54a4e40bbb563e6ee0c8d40a9
rust-cpython: use PyList.insert() instead of .insert_item()

Silences the deprecated warning.

https://github.com/dgrunwald/rust-cpython/commit/e8cbe864841714cdb8c90e057bd11e360c7f

diff --git a/rust/hg-cpython/src/dirstate/status.rs 
b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -33,7 +33,7 @@ fn collect_pybytes_list
 let list = PyList::new(py, &[]);
 
 for (i, path) in collection.iter().enumerate() {
-list.insert_item(
+list.insert(
 py,
 i,
 PyBytes::new(py, path.as_ref().as_bytes()).into_object(),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 6] rust-cpython: bump cpython to 0.4 to switch to upstreamed PySharedRef

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1580396489 -32400
#  Fri Jan 31 00:01:29 2020 +0900
# Node ID 50dcc8baffa106c54a4e40bbb563e6ee0c8d40a9
# Parent  60729184896c34715b637ba12759b0518204bdbe
rust-cpython: bump cpython to 0.4 to switch to upstreamed PySharedRef

diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -51,13 +51,13 @@ dependencies = [
 
 [[package]]
 name = "cpython"
-version = "0.3.0"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "python27-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "python3-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "python27-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "python3-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -153,7 +153,7 @@ dependencies = [
 name = "hg-cpython"
 version = "0.1.0"
 dependencies = [
- "cpython 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cpython 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "hg-core 0.1.0",
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -213,7 +213,7 @@ source = "registry+https://github.com/ru
 
 [[package]]
 name = "python27-sys"
-version = "0.3.0"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -222,7 +222,7 @@ dependencies = [
 
 [[package]]
 name = "python3-sys"
-version = "0.3.0"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -483,7 +483,7 @@ source = "registry+https://github.com/ru
 "checksum c2-chacha 0.2.3 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
 "checksum cfg-if 0.1.10 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 "checksum cloudabi 0.0.3 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-"checksum cpython 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"85532c648315aeb0829ad216a6a29aa3212cf9319bc7f6daf1404aa0bdd1485f"
+"checksum cpython 0.4.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"86eab84f48335293c53d06565bcffe4024f7294edaf223e499fda536532e4b55"
 "checksum crossbeam-deque 0.7.2 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca"
 "checksum crossbeam-epoch 0.8.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac"
 "checksum crossbeam-queue 0.2.1 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
@@ -500,8 +500,8 @@ source = "registry+https://github.com/ru
 "checksum num-traits 0.2.11 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
 "checksum num_cpus 1.12.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
 "checksum ppv-lite86 0.2.6 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
-"checksum python27-sys 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"372555e88a6bc8109eb641380240dc8d25a128fc48363ec9075664daadffdd5b"
-"checksum python3-sys 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"f3a8ebed3f1201fda179f3960609dbbc10cd8c75e9f2afcb03788278f367d8ea"
+"checksum python27-sys 0.4.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"ecc2dbf296df07aaa029b6f6e03bdd058fe9827cf2f075261839a9dff49ef419"
+"checksum python3-sys 0.4.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"d296550fff0db9d77bae50fe3ecd5997e4929aadcae57b22a4bc3bf24fd3"
 "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" 
= "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
 "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" 
= "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
 "checksum rand_chacha 0.1.1 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml
--- a/rust/hg-cpython/Cargo.toml
+++ 

[PATCH 1 of 6] rust: update dependencies

2020-01-30 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1580396239 -32400
#  Thu Jan 30 23:57:19 2020 +0900
# Node ID 60729184896c34715b637ba12759b0518204bdbe
# Parent  71457ff69c2f0bd54794606eba8d7da3110f8e3d
rust: update dependencies

For no particular reason, but just because I'll bump the rust-cpython version.

diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -2,10 +2,10 @@
 # It is not intended for manual editing.
 [[package]]
 name = "aho-corasick"
-version = "0.7.6"
+version = "0.7.7"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
- "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -14,6 +14,11 @@ version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 
 [[package]]
+name = "autocfg"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index;
+
+[[package]]
 name = "bitflags"
 version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index;
@@ -24,6 +29,14 @@ version = "1.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 
 [[package]]
+name = "c2-chacha"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index;
+dependencies = [
+ "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
 name = "cfg-if"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index;
@@ -41,8 +54,8 @@ name = "cpython"
 version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
- "libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "python27-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "python3-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -65,7 +78,7 @@ dependencies = [
  "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-utils 0.7.0 
(registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -99,6 +112,24 @@ version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 
 [[package]]
+name = "getrandom"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index;
+dependencies = [
+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasi 0.9.0+wasi-snapshot-preview1 
(registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index;
+dependencies = [
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
 name = "hex"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
@@ -110,7 +141,7 @@ dependencies = [
  "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -124,7 +155,7 @@ version = "0.1.0"
 dependencies = [
  "cpython 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "hg-core 0.1.0",
- "libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -132,7 +163,7 @@ name = "hgdirectffi"
 version = "0.1.0"
 dependencies = [
  "hg-core 0.1.0",
- "libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -142,17 +173,17 @@ source = "registry+https://github.com/ru
 
 [[package]]
 name = "libc"
-version = "0.2.64"
+version = "0.2.66"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 
 [[package]]
 name = "memchr"
-version = "2.2.1"
+version = "2.3.0"
 source = 

D8041: revset: add a revset for parents in merge state

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz marked an inline comment as done.
martinvonz updated this revision to Diff 19722.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8041?vs=19701=19722

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8041/new/

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

AFFECTED FILES
  mercurial/revset.py
  relnotes/next
  tests/test-merge4.t

CHANGE DETAILS

diff --git a/tests/test-merge4.t b/tests/test-merge4.t
--- a/tests/test-merge4.t
+++ b/tests/test-merge4.t
@@ -23,3 +23,33 @@
   abort: cannot commit merge with missing files
   [255]
 
+
+Test conflictparents() revset
+
+# Bad usage
+  $ hg log -r 'conflictparents(foo)'
+  hg: parse error: conflictparents takes no arguments
+  [255]
+  $ hg co -C .
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+# No merge parents when not merging
+  $ hg log -r 'conflictparents()'
+# No merge parents when there is no conflict
+  $ hg merge 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg log -r 'conflictparents()'
+  $ hg co -C .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo conflict > b
+  $ hg ci -Aqm 'conflicting change to b'
+  $ hg merge 1
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to 
abandon
+  [1]
+# Shows merge parents when there is a conflict
+  $ hg log -r 'conflictparents()' -T '{rev} {desc}\n'
+  1 commit #1
+  3 conflicting change to b
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -1,5 +1,9 @@
 == New Features ==
 
+ * New `conflictparents()` revset returns the commits that are being
+   merged, when there are conflicts. Also works for conflicts caused
+   by e.g. `hg graft`.
+
 
 == New Experimental Features ==
 
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -769,6 +769,25 @@
 return subset
 
 
+@predicate(b'conflictparents()', safe=True)
+def conflictparents(repo, subset, x):
+"""The two parents of the merge, if currently in an unresolved merge.
+
+"merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.
+"""
+getargs(x, 0, 0, _(b"conflictparents takes no arguments"))
+from . import merge
+
+mergestate = merge.mergestate.read(repo)
+revs = set()
+if mergestate.active():
+for n in (mergestate.local, mergestate.other):
+if repo.changelog.hasnode(n):
+revs.add(repo.changelog.rev(n))
+
+return subset & revs
+
+
 @predicate(b'contains(pattern)', weight=100)
 def contains(repo, subset, x):
 """The revision's manifest contains a file matching pattern (but might not



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


mercurial@44194: 4 new changesets

2020-01-30 Thread Mercurial Commits
4 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/732098027b34
changeset:   44191:732098027b34
user:Martin von Zweigbergk 
date:Tue Jan 28 10:40:19 2020 -0800
summary: rust: re-format with nightly rustfmt

https://www.mercurial-scm.org/repo/hg/rev/d6d4170882cd
changeset:   44192:d6d4170882cd
user:Kyle Lippincott 
date:Mon Jan 27 18:16:05 2020 -0800
summary: profiling: flush stdout before writing profile to stderr

https://www.mercurial-scm.org/repo/hg/rev/3c265cef6edc
changeset:   44193:3c265cef6edc
user:Martin von Zweigbergk 
date:Mon Jan 27 12:38:59 2020 -0800
summary: rust: remove an unnecessary set of parentheses

https://www.mercurial-scm.org/repo/hg/rev/d4c1501225c4
changeset:   44194:d4c1501225c4
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Mon Jan 27 09:14:19 2020 -0800
summary: cmdutil: change check_incompatible_arguments() *arg to single 
iterable

-- 
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


D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread quark (Jun Wu)
quark added a comment.


  What do you think about this approach:
  
  1. The server detects that LC_TYPE is coerced.
  2. When handling the "validate" command, the server sends back "invalidate 
this server, and fallback to original hg" response.
  
  This makes chg/non-chg behave consistently with some startup overhead in 
mis-configured environment. The chg client can potentially print a warning to 
remind the user to fix their environment.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8039/new/

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

To: spectral, #hg-reviewers
Cc: quark, yuja, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8027: graft: default `base` argument to common case of `ctx.p1()`

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG4b774ce8e778: graft: default `base` argument to common case 
of `ctx.p1()` (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8027?vs=19691=19718

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8027/new/

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/merge.py
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -996,7 +996,6 @@
 stats = merge.graft(
 repo,
 shelvectx,
-shelvectx.p1(),
 labels=[b'shelve', b'working-copy'],
 keepconflictparent=True,
 )
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2592,7 +2592,7 @@
 def graft(
 repo,
 ctx,
-base,
+base=None,
 labels=None,
 keepparent=False,
 keepconflictparent=False,
@@ -2607,7 +2607,7 @@
 renames/copies appropriately.
 
 ctx - changeset to rebase
-base - merge base, usually ctx.p1()
+base - merge base, or ctx.p1() if not specified
 labels - merge labels eg ['local', 'graft']
 keepparent - keep second parent if any
 keepconflictparent - if unresolved, keep parent used for the merge
@@ -2621,6 +2621,7 @@
 # which local deleted".
 wctx = wctx or repo[None]
 pctx = wctx.p1()
+base = base or ctx.p1()
 mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node())
 
 stats = update(
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -649,7 +649,7 @@
 repo.ui.setconfig(
 b'ui', b'forcemerge', opts.get(b'tool', b''), b'histedit'
 )
-stats = mergemod.graft(repo, ctx, ctx.p1(), [b'local', 
b'histedit'])
+stats = mergemod.graft(repo, ctx, labels=[b'local', b'histedit'])
 finally:
 repo.ui.setconfig(b'ui', b'forcemerge', b'', b'histedit')
 return stats



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


D8040: mergestate: add accessors for local and other nodeid, not just contexts

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGb8b4d9ad4613: mergestate: add accessors for local and other 
nodeid, not just contexts (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8040?vs=19700=19721

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8040/new/

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -386,18 +386,26 @@
 return configmergedriver
 
 @util.propertycache
-def localctx(self):
+def local(self):
 if self._local is None:
-msg = b"localctx accessed but self._local isn't set"
+msg = b"local accessed but self._local isn't set"
 raise error.ProgrammingError(msg)
-return self._repo[self._local]
+return self._local
+
+@util.propertycache
+def localctx(self):
+return self._repo[self.local]
+
+@util.propertycache
+def other(self):
+if self._other is None:
+msg = b"other accessed but self._other isn't set"
+raise error.ProgrammingError(msg)
+return self._other
 
 @util.propertycache
 def otherctx(self):
-if self._other is None:
-msg = b"otherctx accessed but self._other isn't set"
-raise error.ProgrammingError(msg)
-return self._repo[self._other]
+return self._repo[self.other]
 
 def active(self):
 """Whether mergestate is active.



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


D7906: rebase: define base in only place in defineparents()

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG0712c5e86b9c: rebase: define base in only place in 
defineparents() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7906?vs=19698=19720

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7906/new/

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1739,12 +1739,6 @@
 if any(p != nullrev and isancestor(rev, p) for p in newps):
 raise error.Abort(_(b'source is ancestor of destination'))
 
-# "rebasenode" updates to new p1, use the corresponding merge base.
-if bases[0] != nullrev:
-base = bases[0]
-else:
-base = None
-
 # Check if the merge will contain unwanted changes. That may happen if
 # there are multiple special (non-changelog ancestor) merge bases, which
 # cannot be handled well by the 3-way merge algorithm. For example:
@@ -1809,14 +1803,20 @@
 % (rev, repo[rev], unwanteddesc)
 )
 
-base = bases[i]
-
 # newps[0] should match merge base if possible. Currently, if newps[i]
 # is nullrev, the only case is newps[i] and newps[j] (j < i), one is
 # the other's ancestor. In that case, it's fine to not swap newps here.
 # (see CASE-1 and CASE-2 above)
-if i != 0 and newps[i] != nullrev:
-newps[0], newps[i] = newps[i], newps[0]
+if i != 0:
+if newps[i] != nullrev:
+newps[0], newps[i] = newps[i], newps[0]
+bases[0], bases[i] = bases[i], bases[0]
+
+# "rebasenode" updates to new p1, use the corresponding merge base.
+if bases[0] != nullrev:
+base = bases[0]
+else:
+base = None
 
 repo.ui.debug(b" future parents are %d and %d\n" % tuple(newps))
 



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


D8026: graft: let caller pass in overlayworkingctx to merge.graft()

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG916e3ed05195: graft: let caller pass in overlayworkingctx 
to merge.graft() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8026?vs=19690=19717

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8026/new/

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2590,7 +2590,13 @@
 
 
 def graft(
-repo, ctx, base, labels=None, keepparent=False, keepconflictparent=False
+repo,
+ctx,
+base,
+labels=None,
+keepparent=False,
+keepconflictparent=False,
+wctx=None,
 ):
 """Do a graft-like merge.
 
@@ -2613,7 +2619,7 @@
 # to copy commits), and 2) informs update that the incoming changes are
 # newer than the destination so it doesn't prompt about "remote changed foo
 # which local deleted".
-wctx = repo[None]
+wctx = wctx or repo[None]
 pctx = wctx.p1()
 mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node())
 
@@ -2625,6 +2631,7 @@
 base.node(),
 mergeancestor=mergeancestor,
 labels=labels,
+wc=wctx,
 )
 
 if keepconflictparent and stats.unresolvedcount:
@@ -2639,11 +2646,16 @@
 if pother == pctx.node():
 pother = nullid
 
-with repo.dirstate.parentchange():
-repo.setparents(pctx.node(), pother)
-repo.dirstate.write(repo.currenttransaction())
+if wctx.isinmemory():
+wctx.setparents(pctx.node(), pother)
 # fix up dirstate for copies and renames
 copies.graftcopies(wctx, ctx, base)
+else:
+with repo.dirstate.parentchange():
+repo.setparents(pctx.node(), pother)
+repo.dirstate.write(repo.currenttransaction())
+# fix up dirstate for copies and renames
+copies.graftcopies(wctx, ctx, base)
 return stats
 
 



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


D8028: tests: use full `uncommit` command name in tests

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG4f4382291204: tests: use full `uncommit` command name in 
tests (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8028?vs=19661=19719

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8028/new/

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

AFFECTED FILES
  tests/test-uncommit.t

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -489,7 +489,7 @@
   $ hg add b
   $ hg status
   A b
-  $ hg unc a
+  $ hg uncommit a
   note: keeping empty commit
   $ cat a
   super critical info!
@@ -503,11 +503,11 @@
   
   $ hg ci -Am 'add b'
   $ echo 'foo bar' > b
-  $ hg unc b
+  $ hg uncommit b
   abort: uncommitted changes
   (requires --allow-dirty-working-copy to uncommit)
   [255]
-  $ hg unc --allow-dirty-working-copy b
+  $ hg uncommit --allow-dirty-working-copy b
   $ hg log
   changeset:   3:30fa958635b2
   tag: tip



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


D8046: copies: fix crash when copy source is not in graft base

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGa0f34033adf6: copies: fix crash when copy source is not in 
graft base (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8046?vs=19710=19716

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8046/new/

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -186,14 +186,9 @@
 
 the common case - no options or filenames
 
-  $ hg shelve 2>&1 | grep KeyError
-  KeyError: 'No such manifest entry.' (no-pure !)
-  raise KeyError (pure !)
-  KeyError (pure !)
-# Get out of the broken state so later tests work
-  $ hg forget b.rename/b c.copy ghost
-  $ hg revert a/a b/b d
-  $ rm a/a.orig b.rename/b c.copy
+  $ hg shelve
+  shelved as default-01
+  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg status -C
 
 ensure that our shelved changes exist
@@ -396,10 +391,10 @@
 #if phasebased
   $ hg heads -q --template '{rev}\n'
   8
-  6
+  5
   $ hg parents -q --template '{rev}\n'
   8
-  6
+  5
 #endif
 
 #if stripbased
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -527,6 +527,11 @@
 if src not in m1:
 # renamed on side 1, deleted on side 2
 renamedelete[src] = dsts1
+elif src not in mb:
+# Work around the "short-circuit to avoid issues with merge states"
+# thing in pathcopies(): pathcopies(x, y) can return a copy where the
+# destination doesn't exist in y.
+pass
 elif m2[src] != mb[src]:
 if not _related(c2[src], base[src]):
 return



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


D8045: tests: add test showing crash when shelving ghosted rename target

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGb3c08e1b2cd8: tests: add test showing crash when shelving 
ghosted rename target (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8045?vs=19709=19715

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8045/new/

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

AFFECTED FILES
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -171,6 +171,8 @@
   $ hg mv b b.rename
   moving b/b to b.rename/b
   $ hg cp c c.copy
+  $ hg mv d ghost
+  $ rm ghost
   $ hg status -C
   M a/a
   A b.rename/b
@@ -178,12 +180,20 @@
   A c.copy
 c
   R b/b
+  R d
+  ! ghost
+d
 
 the common case - no options or filenames
 
-  $ hg shelve
-  shelved as default-01
-  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg shelve 2>&1 | grep KeyError
+  KeyError: 'No such manifest entry.' (no-pure !)
+  raise KeyError (pure !)
+  KeyError (pure !)
+# Get out of the broken state so later tests work
+  $ hg forget b.rename/b c.copy ghost
+  $ hg revert a/a b/b d
+  $ rm a/a.orig b.rename/b c.copy
   $ hg status -C
 
 ensure that our shelved changes exist
@@ -254,6 +264,7 @@
   A c.copy
 c
   R b/b
+  R d
   $ hg shelve -l
 
 (both of default.hg and default-1.hg should be still kept, because it
@@ -287,6 +298,7 @@
   A c.copy
 c
   R b/b
+  R d
   $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
   wat
   
@@ -306,6 +318,7 @@
   A c.copy
 c
   R b/b
+  R d
   $ hg shelve -l --stat
   wibble  (*)wat (glob)
a/a |  1 +
@@ -323,6 +336,7 @@
   A c.copy
 c
   R b/b
+  R d
 
 ensure old shelve backups are being deleted automatically
 
@@ -363,6 +377,7 @@
   M b.rename/b
   M c.copy
   R b/b
+  R d
   ? a/a.orig
   # The repository is in an unfinished *unshelve* state.
   
@@ -381,10 +396,10 @@
 #if phasebased
   $ hg heads -q --template '{rev}\n'
   8
-  5
+  6
   $ hg parents -q --template '{rev}\n'
   8
-  5
+  6
 #endif
 
 #if stripbased
@@ -401,6 +416,7 @@
   M b.rename/b
   M c.copy
   R b/b
+  R d
   ? a/a.orig
   $ hg diff
   diff --git a/a/a b/a/a
@@ -412,13 +428,19 @@
c
   +===
   +a
-  +>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
+  +>>> working-copy: 203c9f771d2b - shelve: changes to: [mq]: second.patch
   diff --git a/b/b b/b.rename/b
   rename from b/b
   rename to b.rename/b
   diff --git a/c b/c.copy
   copy from c
   copy to c.copy
+  diff --git a/d b/d
+  deleted file mode 100644
+  --- a/d
+  +++ /dev/null
+  @@ -1,1 +0,0 @@
+  -d
   $ hg resolve -l
   U a/a
 
@@ -434,6 +456,7 @@
   M b.rename/b
   M c.copy
   R b/b
+  R d
   ? a/a.orig
   $ hg unshelve -a
   unshelve of 'default' aborted
@@ -512,6 +535,7 @@
 c
   A foo/foo
   R b/b
+  R d
   ? a/a.orig
 
 there should be no shelves left



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


D7974: merge: when rename was made on both sides, use ancestor as merge base

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7974#118685 , @martinvonz 
wrote:
  
  > In D7974#118682 , @pulkit 
wrote:
  >
  >> `test-rename-merge1.t` fails with this patch. Looks like there is one more 
instance of prompt which is not needed anymore. I didn't amend that in flight 
as I was not sure.
  >
  > I'm pretty sure it's flaky for some reason. Augie also mentioned that that 
test failed on one of my patches. I ran it 100 times with different python 
hashes and it never failed for me. I don't know why it behaves differently 
sometimes. I'm not even sure it started failing with this patch. Does it fail 
consistently on this one for you? Does it pass consistently on @?
  
  Oh, and note that `--runs-per-test=100` will run the test 100 times with the 
*same* python hash.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7974/new/

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

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


D7974: merge: when rename was made on both sides, use ancestor as merge base

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7974#118682 , @pulkit wrote:
  
  > `test-rename-merge1.t` fails with this patch. Looks like there is one more 
instance of prompt which is not needed anymore. I didn't amend that in flight 
as I was not sure.
  
  I'm pretty sure it's flaky for some reason. Augie also mentioned that that 
test failed on one of my patches. I ran it 100 times with different python 
hashes and it never failed for me. I don't know why it behaves differently 
sometimes. I'm not even sure it started failing with this patch. Does it fail 
consistently on this one for you? Does it pass consistently on @?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7974/new/

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

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


D8041: revset: add a revset for parents in merge state

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +@predicate(b'conflictparents()', safe=True)
  > +def parents(repo, subset, x):
  
^^^
  
  Nit: copy-paste error?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8041/new/

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

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


Re: D8041: revset: add a revset for parents in merge state

2020-01-30 Thread Yuya Nishihara
> +@predicate(b'conflictparents()', safe=True)
> +def parents(repo, subset, x):
   ^^^
Nit: copy-paste error?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7974: merge: when rename was made on both sides, use ancestor as merge base

2020-01-30 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  `test-rename-merge1.t` fails with this patch. Looks like there is one more 
instance of prompt which is not needed anymore. I didn't amend that in flight 
as I was not sure.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7974/new/

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

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


D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > - # Python3 has some logic to "coerce" the C locale to a UTF-8 capable
  > - # one, and it sets LC_CTYPE in the environment to C.UTF-8 if none of
  > - # 'LC_CTYPE', 'LC_ALL' or 'LANG' are set (to any value). This can be
  > - # disabled with PYTHONCOERCECLOCALE=0 in the environment.
  > - #
  > - # When fromui is called via _inithashstate, python has already set
  > - # this, so that's in the environment right when we start up the hg
  > - # process. Then chg will call us and tell us to set the environment to
  > - # the one it has; this might NOT have LC_CTYPE, so we'll need to
  > - # carry-forward the LC_CTYPE that was coerced in these situations.
  > - #
  > - # If this is not handled, we will fail config+env validation and fail
  > - # to start chg. If this is just ignored instead of carried forward, we
  > - # may have different behavior between chg and non-chg.
  
  Can you move and rephrase this comment?
  
  > @@ -730,6 +696,11 @@
  >
  > 1. environ cleaner. if b'CHGINTERNALMARK' in encoding.environ: del 
encoding.environ[b'CHGINTERNALMARK']
  >
  > +if b'CHGORIG_LC_CTYPE' in encoding.environ:
  > +encoding.environ[b'LC_CTYPE'] = 
encoding.environ[b'CHGORIG_LC_CTYPE']
  > +del encoding.environ[b'CHGORIG_LC_CTYPE']
  > +elif b'CHG_CLEAR_LC_CTYPE' in encoding.environ:
  > +del encoding.environ[b'LC_CTYPE']
  
  would crash if `LC_CTYPE` wasn't set, and probably needs to delete
  `CHG_CLEAR_LC_CTYPE`.
  
  > diff --git a/hg b/hg
  >
  > - a/hg
  >
  > +++ b/hg
  > @@ -1,4 +1,4 @@
  > -#!/usr/bin/env python
  > +#!/usr/bin/env python3
  
  Unrelated change.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8039/new/

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

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


Re: D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread Yuya Nishihara
> -# Python3 has some logic to "coerce" the C locale to a UTF-8 capable
> -# one, and it sets LC_CTYPE in the environment to C.UTF-8 if none of
> -# 'LC_CTYPE', 'LC_ALL' or 'LANG' are set (to any value). This can be
> -# disabled with PYTHONCOERCECLOCALE=0 in the environment.
> -#
> -# When fromui is called via _inithashstate, python has already set
> -# this, so that's in the environment right when we start up the hg
> -# process. Then chg will call us and tell us to set the environment 
> to
> -# the one it has; this might NOT have LC_CTYPE, so we'll need to
> -# carry-forward the LC_CTYPE that was coerced in these situations.
> -#
> -# If this is not handled, we will fail config+env validation and fail
> -# to start chg. If this is just ignored instead of carried forward, 
> we
> -# may have different behavior between chg and non-chg.

Can you move and rephrase this comment?

> @@ -730,6 +696,11 @@
>  # environ cleaner.
>  if b'CHGINTERNALMARK' in encoding.environ:
>  del encoding.environ[b'CHGINTERNALMARK']
> +if b'CHGORIG_LC_CTYPE' in encoding.environ:
> +encoding.environ[b'LC_CTYPE'] = encoding.environ[b'CHGORIG_LC_CTYPE']
> +del encoding.environ[b'CHGORIG_LC_CTYPE']
> +elif b'CHG_CLEAR_LC_CTYPE' in encoding.environ:
> +del encoding.environ[b'LC_CTYPE']

would crash if `LC_CTYPE` wasn't set, and probably needs to delete
`CHG_CLEAR_LC_CTYPE`.

> diff --git a/hg b/hg
> --- a/hg
> +++ b/hg
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3

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


D8041: revset: add a revset for parents in merge state

2020-01-30 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> revset.py:1866
> +
> +If "merge" here includes merge conflicts from e.g. 'hg rebase' or
> +'hg graft'.

The sentence looks incomplete.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8041/new/

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

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


D8022: chg: pass copies of some envvars so we can detect py37+ modifications

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   Getting this implemented "correctly" using daemon_postexec is getting 
relatively complicated - there's no way to backwards- and forwards-compatibly 
do this since there's no capabilities mechanism for daemon_postexec. If I 
blindly do it, it fails when connecting to an older hg saying it doesn't know 
how to do handle that command.
  
  For the record, chg doesn't need to support old hg versions. We did once
  add `--daemon-postexec chdir:/` for example.
  
  >   In execcmdserver, we copy LC_CTYPE to CHGORIG_LC_CTYPE, export that when 
starting
  >   In chgserver.py, when doing the initial startup process, check if 
CHGORIG_LC_CTYPE is in the environment, and overwrite LC_CTYPE with its value.
  >   I'll see how easy that is to implement and send a separate review request 
once I have it working.
  
  Thanks. I'll review it soon.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8022/new/

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

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


Re: D8022: chg: pass copies of some envvars so we can detect py37+ modifications

2020-01-30 Thread Yuya Nishihara
>   Getting this implemented "correctly" using daemon_postexec is getting 
> relatively complicated - there's no way to backwards- and forwards-compatibly 
> do this since there's no capabilities mechanism for daemon_postexec. If I 
> blindly do it, it fails when connecting to an older hg saying it doesn't know 
> how to do handle that command.

For the record, chg doesn't need to support old hg versions. We did once
add `--daemon-postexec chdir:/` for example.

>   In execcmdserver, we copy LC_CTYPE to CHGORIG_LC_CTYPE, export that when 
> starting
>   In chgserver.py, when doing the initial startup process, check if 
> CHGORIG_LC_CTYPE is in the environment, and overwrite LC_CTYPE with its value.
>   
>   I'll see how easy that is to implement and send a separate review request 
> once I have it working.

Thanks. I'll review it soon.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8029: uncopy: add new `hg uncopy` command

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> pulkit wrote in cmdutil.py:1698
> generally we refer to `repo[None]` as `wctx` right?

I didn't do that because I had planned the next patch, where the same code is 
used for working copy and not, so `ctx` isn't necessarily the working copy.

> pulkit wrote in commands.py:7502
> We should add descriptive function documentation which will be visible to 
> user when they do `hg uncopy -h`.

Oops, I just forgot about that, I think. I'll send a follow-up (I assume you 
know that many of the patches you're reviewing now are already queued).

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8029/new/

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

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


D8030: uncopy: add support for unmarking committed copies

2020-01-30 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D8030#118662 , @pulkit wrote:
  
  > I don't feel very good with this because this makes `hg uncopy` a history 
editing command.
  
  That's a good thing in my opinion :)
  
  > Something like `hg uncopy --after` which makes the changes in wdir which 
can be committed afterwards sounds best, but I am not sure if that's possible.
  
  Yeah, not really possible (Augie had the same comment on one of these 
patches).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8030/new/

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

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


D8030: uncopy: add support for unmarking committed copies

2020-01-30 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  I don't feel very good with this because this makes `hg uncopy` a history 
editing command. Something like `hg uncopy --after` which makes the changes in 
wdir which can be committed afterwards sounds best, but I am not sure if that's 
possible.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8030/new/

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

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


D8029: uncopy: add new `hg uncopy` command

2020-01-30 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> cmdutil.py:1698
> +def uncopy(ui, repo, pats, opts):
> +ctx = repo[None]
> +

generally we refer to `repo[None]` as `wctx` right?

> commands.py:7502
> +)
> +def uncopy(ui, repo, *pats, **opts):
> +"""unmark files as copied"""

We should add descriptive function documentation which will be visible to user 
when they do `hg uncopy -h`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8029/new/

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

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


D8049: rust-dirstatemap: add `NonNormalEntries` class

2020-01-30 Thread Raphaël Gomès
Alphare created this revision.
Herald added subscribers: mercurial-devel, kevincox.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fix introduces the same encapsulation as the `copymap`. There is no easy
  way of doing this any better for now.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  rust/hg-cpython/src/dirstate.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs
  rust/hg-cpython/src/dirstate/non_normal_entries.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/non_normal_entries.rs 
b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
new file mode 100644
--- /dev/null
+++ b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
@@ -0,0 +1,52 @@
+// non_normal_other_parent_entries.rs
+//
+// Copyright 2020 Raphaël Gomès 
+//
+// This software may be used and distributed according to the terms of the
+// GNU General Public License version 2 or any later version.
+
+use cpython::{
+exc::NotImplementedError, CompareOp, ObjectProtocol, PyErr, PyList,
+PyObject, PyResult, PyString, Python, PythonObject, ToPyObject,
+};
+
+use crate::dirstate::DirstateMap;
+
+py_class!(pub class NonNormalEntries |py| {
+data dmap: DirstateMap;
+
+def __contains__(, key: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_contains(py, key)
+}
+def remove(, key: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_remove(py, key)
+}
+def union(, other: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_union(py, other)
+}
+def __richcmp__(, other: PyObject, op: CompareOp) -> PyResult {
+match op {
+CompareOp::Eq => self.is_equal_to(py, other),
+CompareOp::Ne => Ok(!self.is_equal_to(py, other)?),
+_ => Err(PyErr::new::(py, ""))
+}
+}
+def __repr__() -> PyResult {
+self.dmap(py).non_normal_entries_display(py)
+}
+});
+
+impl NonNormalEntries {
+pub fn from_inner(py: Python, dm: DirstateMap) -> PyResult {
+Self::create_instance(py, dm)
+}
+
+fn is_equal_to(, py: Python, other: PyObject) -> PyResult {
+for item in other.iter(py)? {
+if !self.dmap(py).non_normal_entries_contains(py, item?)? {
+return Ok(false);
+}
+}
+Ok(true)
+}
+}
diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -13,12 +13,13 @@
 use std::time::Duration;
 
 use cpython::{
-exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyObject,
-PyResult, PyTuple, Python, PythonObject, ToPyObject,
+exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList,
+PyObject, PyResult, PyString, PyTuple, Python, PythonObject, ToPyObject,
 };
 
 use crate::{
 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
+dirstate::non_normal_entries::NonNormalEntries,
 dirstate::{dirs_multiset::Dirs, make_dirstate_tuple},
 ref_sharing::{PyLeaked, PySharedRefCell},
 };
@@ -168,32 +169,86 @@
 Ok(py.None())
 }
 
-// TODO share the reference
-def nonnormalentries() -> PyResult {
-let (non_normal, other_parent) =
-self.inner_shared(py).borrow().non_normal_other_parent_entries();
+def other_parent_entries() -> PyResult {
+let mut inner_shared = self.inner_shared(py).borrow_mut()?;
+let (_, other_parent) =
+inner_shared.get_non_normal_other_parent_entries();
 
 let locals = PyDict::new(py);
 locals.set_item(
 py,
-"non_normal",
-non_normal
-.iter()
-.map(|v| PyBytes::new(py, v.as_ref()))
-.collect::>()
-.to_py_object(py),
-)?;
-locals.set_item(
-py,
 "other_parent",
-other_parent
+other_parent.as_ref()
+.unwrap()
 .iter()
 .map(|v| PyBytes::new(py, v.as_ref()))
 .collect::>()
 .to_py_object(py),
 )?;
 
-py.eval("set(non_normal), set(other_parent)", None, Some())
+py.eval("set(other_parent)", None, Some())
+}
+
+def non_normal_entries() -> PyResult {
+NonNormalEntries::from_inner(py, self.clone_ref(py))
+}
+
+def non_normal_entries_contains(, key: PyObject) -> PyResult {
+let key = key.extract::(py)?;
+Ok(self
+.inner_shared(py)
+.borrow_mut()?
+.get_non_normal_other_parent_entries().0
+.as_ref()
+.unwrap()
+.contains(HgPath::new(key.data(py
+}
+
+def non_normal_entries_display() -> PyResult {
+Ok(
+PyString::new(
+py,
+  

D8050: rust-dirstatemap: update call sites from Python

2020-01-30 Thread Raphaël Gomès
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -1846,12 +1846,12 @@
 
 @property
 def nonnormalset(self):
-nonnorm, otherparents = self._rustmap.nonnormalentries()
+nonnorm = self._rustmap.non_normal_entries()
 return nonnorm
 
 @propertycache
 def otherparentset(self):
-nonnorm, otherparents = self._rustmap.nonnormalentries()
+otherparents = self._rustmap.other_parent_entries()
 return otherparents
 
 @propertycache



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


D8048: rust-dirstatemap: cache non normal and other parent set

2020-01-30 Thread Raphaël Gomès
Alphare created this revision.
Herald added subscribers: mercurial-devel, kevincox.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Performance of `hg update` was significantly worse since the introduction of
  the Rust `dirstatemap`. This regression was noticed by Valentin Gatien-Baron
  when working on a large repository, as it goes unnoticed for smaller
  repositories like Mercurial itself.
  
  This fix introduces the same getter/setter mechanism at `hg-core` level as
  for `set/get_dirs`.
  
  While this technique is, as previously discussed, quite suboptimal, it fixes 
an
  important enough problem. Refactoring `hg-core` to use the typestate
  pattern could be a good approach to improving code quality in a future patch.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs 
b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -34,8 +34,8 @@
 file_fold_map: Option,
 pub dirs: Option,
 pub all_dirs: Option,
-non_normal_set: HashSet,
-other_parent_set: HashSet,
+non_normal_set: Option>,
+other_parent_set: Option>,
 parents: Option,
 dirty_parents: bool,
 }
@@ -69,8 +69,8 @@
 self.state_map.clear();
 self.copy_map.clear();
 self.file_fold_map = None;
-self.non_normal_set.clear();
-self.other_parent_set.clear();
+self.non_normal_set = None;
+self.other_parent_set = None;
 self.set_parents( {
 p1: NULL_ID,
 p2: NULL_ID,
@@ -98,11 +98,19 @@
 self.state_map.insert(filename.to_owned(), entry.to_owned());
 
 if entry.state != EntryState::Normal || entry.mtime == MTIME_UNSET {
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 
 if entry.size == SIZE_FROM_OTHER_PARENT {
-self.other_parent_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.1
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 Ok(())
 }
@@ -142,7 +150,11 @@
 mtime: 0,
 },
 );
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 Ok(())
 }
 
@@ -168,7 +180,11 @@
 if let Some(ref mut file_fold_map) = self.file_fold_map {
 file_fold_map.remove(_case(filename));
 }
-self.non_normal_set.remove(filename);
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.remove(filename);
 
 Ok(exists)
 }
@@ -193,14 +209,55 @@
 }
 });
 if changed {
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 }
 }
 
-pub fn non_normal_other_parent_entries(
-,
-) -> (HashSet, HashSet) {
+pub fn non_normal_entries_remove(
+ self,
+key: impl AsRef,
+) -> bool {
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.remove(key.as_ref())
+}
+pub fn non_normal_entries_union(
+ self,
+other: HashSet,
+) -> Vec {
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.union()
+.map(|e| e.to_owned())
+.collect()
+}
+
+pub fn get_non_normal_other_parent_entries(
+ self,
+) -> (
+ Option>,
+ Option>,
+) {
+self.set_non_normal_other_parent_entries(false);
+( self.non_normal_set,  self.other_parent_set)
+}
+
+pub fn set_non_normal_other_parent_entries( self, force: bool) {
+if !force
+&& self.non_normal_set.is_some()
+&& self.other_parent_set.is_some()
+{
+return;
+}
 let mut non_normal = HashSet::new();
 let mut other_parent = HashSet::new();
 
@@ -219,8 +276,8 @@
 other_parent.insert(filename.to_owned());
 }
 }
-
-(non_normal, other_parent)
+self.non_normal_set = Some(non_normal);
+

D8047: rust-dirstate: add missing @propertycache

2020-01-30 Thread Raphaël Gomès
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While investigating a regression on `hg update` performance introduced by the
  Rust `dirstatemap`, two missing `@propertycache` were identified when 
comparing
  against the Python implementation. This adds back the first one, that has
  no observable impact on behavior. The second one (`nonnormalset`) is going to
  be more involved, as the caching has to be done from the Rust side of things.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -1849,7 +1849,7 @@
 nonnorm, otherparents = self._rustmap.nonnormalentries()
 return nonnorm
 
-@property
+@propertycache
 def otherparentset(self):
 nonnorm, otherparents = self._rustmap.nonnormalentries()
 return otherparents



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