D8281: narrow: escape includepats/excludepats when sending over the wire (BC)

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D8281#123625 , @spectral 
wrote:
  
  > In D8281#123621 , @mharbison72 
wrote:
  >
  >> The Windows path changes seem like a good idea.
  >> Would quoting paths with commas eliminate the need for custom escaping?  I 
don't feel strongly about it, but custom escaping always feels weird to me.  (I 
fact, a coworker did some homebrew escaping for CSV files a few days ago, but I 
forget how it ultimately ended up.)
  >
  > Let me play with that a bit, I think it'll work and be detectable on the 
server since the first character can't currently be a double-quote, so there 
wouldn't really be any BC issues aside from the pconvert (which wouldn't be as 
important anymore, but still probably a good idea?)
  
  It's a little weird to me that there's no step corresponding to `pconvert()` 
in the decoding function. Maybe we should do the `pconvert()` step outside 
`encodecsvpaths()`, maybe in `narrowspec.normalizepattern()`? However, that 
would make it impossible to have backslashes in paths in the narrowspec on 
Windows even after this patch (because they would always be converted to 
slashes), including narrowspecs returned from the server. However^2, maybe it 
wouldn't work to check out such paths on Windows anyway, so it doesn't really 
matter (so it's fine to call `pconvert()`)?

REPOSITORY
  rHG Mercurial

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

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

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


D8282: tests: consistently put #testcases at beginning of file

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think it's misleading to put `#testcases` statements further down in
  the file because any statements before it will be executed in all
  cases. I also find them easier to find at the beginning of the file.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-fix-topology.t
  tests/test-narrow-sparse.t
  tests/test-push-race.t

CHANGE DETAILS

diff --git a/tests/test-push-race.t b/tests/test-push-race.t
--- a/tests/test-push-race.t
+++ b/tests/test-push-race.t
@@ -1,3 +1,5 @@
+#testcases strict unrelated
+
 

 Test cases where there are race condition between two clients pushing to the 
same repository
 

@@ -7,6 +9,10 @@
 perform its push. The "raced" client starts its actual push after the "racing"
 client push is fully complete.
 
+We tests multiple cases:
+* strict: no race detected,
+* unrelated: race on unrelated heads are allowed.
+
 A set of extension and shell functions ensures this scheduling.
 
   $ cat >> delaypush.py << EOF
@@ -113,12 +119,6 @@
   > graph = log -G --rev 'sort(all(), "topo")'
   > EOF
 
-We tests multiple cases:
-* strict: no race detected,
-* unrelated: race on unrelated heads are allowed.
-
-#testcases strict unrelated
-
 #if strict
 
   $ cat >> $HGRCPATH << EOF
diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -1,7 +1,8 @@
+#testcases tree flat
+
 Testing interaction of sparse and narrow when both are enabled on the client
 side and we do a non-ellipsis clone
 
-#testcases tree flat
   $ . "$TESTDIR/narrow-library.sh"
   $ cat << EOF >> $HGRCPATH
   > [extensions]
diff --git a/tests/test-fix-topology.t b/tests/test-fix-topology.t
--- a/tests/test-fix-topology.t
+++ b/tests/test-fix-topology.t
@@ -1,3 +1,5 @@
+#testcases obsstore-off obsstore-on
+
 A script that implements uppercasing all letters in a file.
 
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
@@ -30,7 +32,6 @@
 we'll test it with evolution off and on. This only changes the revision
 numbers, if all is well.
 
-#testcases obsstore-off obsstore-on
 #if obsstore-on
   $ cat >> $HGRCPATH < [experimental]



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


D8283: tests: simplify test-fix-topology.t slightly by using a `(case !)`

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-fix-topology.t

CHANGE DETAILS

diff --git a/tests/test-fix-topology.t b/tests/test-fix-topology.t
--- a/tests/test-fix-topology.t
+++ b/tests/test-fix-topology.t
@@ -129,12 +129,8 @@
 
 Fix all but the root revision and its four children.
 
-#if obsstore-on
   $ hg fix -r '2|4|7|8|9' --working-dir
-#else
-  $ hg fix -r '2|4|7|8|9' --working-dir
-  saved backup bundle to * (glob)
-#endif
+  saved backup bundle to * (glob) (obsstore-off !)
 
 The five revisions remain, but the other revisions were fixed and replaced. All
 parent pointers have been accurately set to reproduce the previous topology



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


D8281: narrow: escape includepats/excludepats when sending over the wire (BC)

2020-03-12 Thread spectral (Kyle Lippincott)
spectral added a comment.


  In D8281#123621 , @mharbison72 
wrote:
  
  > The Windows path changes seem like a good idea.
  > Would quoting paths with commas eliminate the need for custom escaping?  I 
don't feel strongly about it, but custom escaping always feels weird to me.  (I 
fact, a coworker did some homebrew escaping for CSV files a few days ago, but I 
forget how it ultimately ended up.)
  
  Let me play with that a bit, I think it'll work and be detectable on the 
server since the first character can't currently be a double-quote, so there 
wouldn't really be any BC issues aside from the pconvert (which wouldn't be as 
important anymore, but still probably a good idea?)

REPOSITORY
  rHG Mercurial

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

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

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


D8281: narrow: escape includepats/excludepats when sending over the wire (BC)

2020-03-12 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 20767.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8281?vs=20765=20767

BRANCH
  default

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

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py
  mercurial/wireprototypes.py
  mercurial/wireprotov1peer.py
  mercurial/wireprotov1server.py
  relnotes/next
  tests/test-doctest.py
  tests/test-narrow-exchange.t

CHANGE DETAILS

diff --git a/tests/test-narrow-exchange.t b/tests/test-narrow-exchange.t
--- a/tests/test-narrow-exchange.t
+++ b/tests/test-narrow-exchange.t
@@ -223,3 +223,62 @@
   remote: rollback completed (lfs-on !)
   remote: abort: data/inside2/f.i@f59b4e021835: no match found! (lfs-on !)
   abort: stream ended unexpectedly (got 0 bytes, expected 4) (lfs-on !)
+
+Test paths with commas in them
+  $ cd $TESTTMP
+  $ hg init commas-master
+  $ cd commas-master
+  $ mkdir a,b
+  $ mkdir a,b/c,d
+  $ mkdir a,b/e,f
+  $ mkdir g
+  $ echo abcd > a,b/c,d/abcd
+  $ echo abef > a,b/e,f/abef
+  $ echo ghi > g/h,i
+  $ hg ci -qAm r0
+  $ echo abcd2 >> a,b/c,d/abcd
+  $ echo abef2 >> a,b/e,f/abef
+  $ echo ghi2 >> g/h,i
+  $ hg ci -qm r1
+  $ cd ..
+
+Test that we can pull and push with a file that has a comma in the name, even
+though the commas don't appear in the narrowspec file (since they're just
+filenames)
+  $ hg clone --narrow ssh://user@dummy/commas-master commas-in-file \
+  >   --include g -qr 0
+  $ cd commas-in-file
+  $ hg pull -q
+  $ echo ghi3 >> g/h,i
+  $ hg ci -qm 'modify g/h,i'
+  $ hg push -qf
+  $ cd ..
+
+Test commas in the --include, plus pull+push
+  $ hg clone --narrow ssh://user@dummy/commas-master commas-in-dir \
+  >   --include a,b --exclude a,b/c,d -qr 0
+  $ cd commas-in-dir
+  $ hg pull -q
+  $ echo abef3 >> a,b/e,f/abef
+  $ hg ci -qm 'modify a,b/e,f'
+  $ hg push -qf
+
+Test that --{add,remove}{include,exclude} work with commas in the directory
+names.
+  $ hg tracked
+  I path:a,b
+  X path:a,b/c,d
+  $ hg tracked --removeexclude a,b/c,d --addinclude a,b/e,f -q
+  $ hg tracked
+  I path:a,b
+  I path:a,b/e,f
+  $ hg files
+  a,b/c,d/abcd
+  a,b/e,f/abef
+  $ hg tracked --removeinclude a,b/e,f --addexclude a,b/c,d -q
+  $ hg tracked
+  I path:a,b
+  X path:a,b/c,d
+  $ hg files
+  a,b/e,f/abef
+  $ cd ..
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -79,6 +79,7 @@
 testmod('mercurial.util', testtarget='platform')  # windows.py or posix.py
 testmod('mercurial.utils.dateutil')
 testmod('mercurial.utils.stringutil')
+testmod('mercurial.wireprototypes')
 testmod('hgext.convert.convcmd')
 testmod('hgext.convert.cvsps')
 testmod('hgext.convert.filemap')
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -23,6 +23,10 @@
Will use `zstd` compression for new repositories is available, and will
simply fall back to `zlib` if not.
 
+ * The experimental `narrow` extension will now be able to have include or
+   exclude patterns that have a comma in the name when both client and server
+   are updated.
+
 == New Experimental Features ==
 
  * `hg copy` now supports a `--at-rev` argument to mark files as
@@ -49,6 +53,15 @@
  * `hg recover` does not verify the validity of the whole repository
anymore. You can pass `--verify` or call `hg verify` if necessary.
 
+ * The experimental `narrow` extension wireproto serialization format is
+   changing slightly. Windows clients will transmit paths with `/` as the path
+   separator instead of `\`. Any `,` or `\` in the path for include or exclude
+   patterns will be escaped. Newer servers speaking with older clients may
+   accidentally unescape paths that weren't actually escaped by the client, but
+   this is extremely unlikely to happen in practice. Newer clients speaking 
with
+   older servers will escape any `\` character and this will not be interpreted
+   properly by the server, causing the path to not match.
+
 == Internal API Changes ==
 
  * The deprecated `ui.progress()` has now been deleted. Please use
diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -448,6 +448,8 @@
 opts[k] = list(v.split(b','))
 elif keytype == b'scsv':
 opts[k] = set(v.split(b','))
+elif keytype == b'csvpaths':
+opts[k] = wireprototypes.decodecsvpaths(v)
 elif keytype == b'boolean':
 # Client should serialize False as '0', which is a non-empty string
 # so it evaluates as a True bool.
diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -462,6 +462,8 @@
 value = b','.join(value)
 elif keytype == b'scsv':
 

D8280: tests: make test-doctest.t module list match reality

2020-03-12 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 20766.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8280?vs=20764=20766

BRANCH
  default

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

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

AFFECTED FILES
  tests/test-doctest.py

CHANGE DETAILS

diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -49,14 +49,11 @@
 runner.summarize()
 
 
-testmod('mercurial.changegroup')
 testmod('mercurial.changelog')
 testmod('mercurial.cmdutil')
 testmod('mercurial.color')
 testmod('mercurial.config')
-testmod('mercurial.context')
 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
-testmod('mercurial.dispatch')
 testmod('mercurial.encoding')
 testmod('mercurial.fancyopts')
 testmod('mercurial.formatter')
@@ -65,23 +62,21 @@
 testmod('mercurial.match')
 testmod('mercurial.mdiff')
 testmod('mercurial.minirst')
+testmod('mercurial.parser')
 testmod('mercurial.patch')
 testmod('mercurial.pathutil')
-testmod('mercurial.parser')
 testmod('mercurial.pycompat')
-testmod('mercurial.revlog')
 testmod('mercurial.revlogutils.deltas')
 testmod('mercurial.revset')
 testmod('mercurial.revsetlang')
+testmod('mercurial.simplemerge')
 testmod('mercurial.smartset')
 testmod('mercurial.store')
 testmod('mercurial.subrepo')
-testmod('mercurial.templatefilters')
 testmod('mercurial.templater')
 testmod('mercurial.ui')
-testmod('mercurial.url')
 testmod('mercurial.util')
-testmod('mercurial.util', testtarget='platform')
+testmod('mercurial.util', testtarget='platform')  # windows.py or posix.py
 testmod('mercurial.utils.dateutil')
 testmod('mercurial.utils.stringutil')
 testmod('hgext.convert.convcmd')
@@ -93,3 +88,7 @@
 testmod('hgext.mq')
 # Helper scripts in tests/ that have doctests:
 testmod('drawdag')
+testmod('test-run-tests')
+
+# Disabled since it requires extra modules that might not be installed.
+# testmod('i18n.check-translation')



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


D8281: narrow: escape includepats/excludepats when sending over the wire (BC)

2020-03-12 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  The Windows path changes seem like a good idea.
  
  Would quoting paths with commas eliminate the need for custom escaping?  I 
don't feel strongly about it, but custom escaping always feels weird to me.  (I 
fact, a coworker did some homebrew escaping for CSV files a few days ago, but I 
forget how it ultimately ended up.)

REPOSITORY
  rHG Mercurial

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

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

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


D8280: tests: make test-doctest.t module list match reality

2020-03-12 Thread mharbison72 (Matt Harbison)
This revision now requires changes to proceed.
mharbison72 added a comment.
mharbison72 requested changes to this revision.


  It looks like test-run-tests.py and i18n/check-translation.py have a test 
too.  (Not sure if we care about them; I mostly care about Windows.)
  
  It also looks like dispatch.py can be dropped.  Presumably `mercurial.util` 
being duplicated (once with a `testtarget=...` and once without) is on purpose, 
but IDK what that does.

INLINE COMMENTS

> test-doctest.py:69
>  testmod('mercurial.pathutil')
> -testmod('mercurial.parser')
> +testmod('mercurial.posix')
>  testmod('mercurial.pycompat')

It looks like this needs to be conditionalized, like the Windows module test:

  --- c:/Users/Matt/hg/tests/test-doctest.py.out
  +++ c:/Users/Matt/hg/tests/test-doctest.py.err
  @@ -0,0 +1,8 @@
  +Traceback (most recent call last):
  +  File "c:\Users\Matt\hg\tests\test-doctest.py", line 69, in 
  +testmod('mercurial.posix')
  +  File "c:\Users\Matt\hg\tests\test-doctest.py", line 36, in testmod
  +__import__(name)
  +  File "c:\Users\Matt\hg\mercurial\posix.py", line 11, in 
  +import fcntl
  +ImportError: No module named fcntl

REPOSITORY
  rHG Mercurial

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

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

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


D8281: narrow: escape includepats/excludepats when sending over the wire (BC)

2020-03-12 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When transmitting data over the wire, first run util.pconvert on each item 
(this is
  just good practice in general to have the wire protocol have posix style 
paths).
  Then, escape any existing backslash with \SlAsH, and any existing comma with
  \CoMmA.  Finally, join everything together with commas like before.
  
  This has a minor breaking change in some scenarios:
  
  Old server, old client:
  
  - paths with commas in them will cause errors if added to the narrowspec
  
  Old server, new client:
  
  - commas in paths will be interpreted by the server as `\CoMmA`, and not match
  - backslashes in paths will be interpreted by the server as `\SlAsH`, and not 
match.  Due to the pconvert, windows clients shouldn't have any `\` characters 
in their paths, and it's still probably very rare for non-windows clients to 
have paths with a \ in the name.
  
  New server, old client:
  
  - paths with commas in them will cause errors if added to the narrowspec
  - any path that (pre-escaping) contains the substring `\SlAsH` or `\CoMmA` 
will have these converted to `\` and `,` respectively, and likely not match. 
This is a case-sensitive comparison, so it's extremely unlikely to be a problem 
in practice.
  
  New server, new client:
  
  - everything should work

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py
  mercurial/wireprototypes.py
  mercurial/wireprotov1peer.py
  mercurial/wireprotov1server.py
  relnotes/next
  tests/test-doctest.py
  tests/test-narrow-exchange.t

CHANGE DETAILS

diff --git a/tests/test-narrow-exchange.t b/tests/test-narrow-exchange.t
--- a/tests/test-narrow-exchange.t
+++ b/tests/test-narrow-exchange.t
@@ -223,3 +223,62 @@
   remote: rollback completed (lfs-on !)
   remote: abort: data/inside2/f.i@f59b4e021835: no match found! (lfs-on !)
   abort: stream ended unexpectedly (got 0 bytes, expected 4) (lfs-on !)
+
+Test paths with commas in them
+  $ cd $TESTTMP
+  $ hg init commas-master
+  $ cd commas-master
+  $ mkdir a,b
+  $ mkdir a,b/c,d
+  $ mkdir a,b/e,f
+  $ mkdir g
+  $ echo abcd > a,b/c,d/abcd
+  $ echo abef > a,b/e,f/abef
+  $ echo ghi > g/h,i
+  $ hg ci -qAm r0
+  $ echo abcd2 >> a,b/c,d/abcd
+  $ echo abef2 >> a,b/e,f/abef
+  $ echo ghi2 >> g/h,i
+  $ hg ci -qm r1
+  $ cd ..
+
+Test that we can pull and push with a file that has a comma in the name, even
+though the commas don't appear in the narrowspec file (since they're just
+filenames)
+  $ hg clone --narrow ssh://user@dummy/commas-master commas-in-file \
+  >   --include g -qr 0
+  $ cd commas-in-file
+  $ hg pull -q
+  $ echo ghi3 >> g/h,i
+  $ hg ci -qm 'modify g/h,i'
+  $ hg push -qf
+  $ cd ..
+
+Test commas in the --include, plus pull+push
+  $ hg clone --narrow ssh://user@dummy/commas-master commas-in-dir \
+  >   --include a,b --exclude a,b/c,d -qr 0
+  $ cd commas-in-dir
+  $ hg pull -q
+  $ echo abef3 >> a,b/e,f/abef
+  $ hg ci -qm 'modify a,b/e,f'
+  $ hg push -qf
+
+Test that --{add,remove}{include,exclude} work with commas in the directory
+names.
+  $ hg tracked
+  I path:a,b
+  X path:a,b/c,d
+  $ hg tracked --removeexclude a,b/c,d --addinclude a,b/e,f -q
+  $ hg tracked
+  I path:a,b
+  I path:a,b/e,f
+  $ hg files
+  a,b/c,d/abcd
+  a,b/e,f/abef
+  $ hg tracked --removeinclude a,b/e,f --addexclude a,b/c,d -q
+  $ hg tracked
+  I path:a,b
+  X path:a,b/c,d
+  $ hg files
+  a,b/e,f/abef
+  $ cd ..
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -83,6 +83,7 @@
 testmod('mercurial.utils.stringutil')
 if os.name == 'nt':
 testmod('mercurial.windows')
+testmod('mercurial.wireprototypes')
 testmod('hgext.convert.convcmd')
 testmod('hgext.convert.cvsps')
 testmod('hgext.convert.filemap')
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -23,6 +23,10 @@
Will use `zstd` compression for new repositories is available, and will
simply fall back to `zlib` if not.
 
+ * The experimental `narrow` extension will now be able to have include or
+   exclude patterns that have a comma in the name when both client and server
+   are updated.
+
 == New Experimental Features ==
 
  * `hg copy` now supports a `--at-rev` argument to mark files as
@@ -49,6 +53,15 @@
  * `hg recover` does not verify the validity of the whole repository
anymore. You can pass `--verify` or call `hg verify` if necessary.
 
+ * The experimental `narrow` extension wireproto serialization format is
+   changing slightly. Windows clients will transmit paths with `/` as the path
+   separator instead of `\`. Any `,` or `\` in the path for include or exclude
+   patterns will be escaped. Newer 

D8280: tests: make test-doctest.t module list match reality

2020-03-12 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-doctest.py

CHANGE DETAILS

diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -49,12 +49,10 @@
 runner.summarize()
 
 
-testmod('mercurial.changegroup')
 testmod('mercurial.changelog')
 testmod('mercurial.cmdutil')
 testmod('mercurial.color')
 testmod('mercurial.config')
-testmod('mercurial.context')
 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
 testmod('mercurial.dispatch')
 testmod('mercurial.encoding')
@@ -65,25 +63,26 @@
 testmod('mercurial.match')
 testmod('mercurial.mdiff')
 testmod('mercurial.minirst')
+testmod('mercurial.parser')
 testmod('mercurial.patch')
 testmod('mercurial.pathutil')
-testmod('mercurial.parser')
+testmod('mercurial.posix')
 testmod('mercurial.pycompat')
-testmod('mercurial.revlog')
 testmod('mercurial.revlogutils.deltas')
 testmod('mercurial.revset')
 testmod('mercurial.revsetlang')
+testmod('mercurial.simplemerge')
 testmod('mercurial.smartset')
 testmod('mercurial.store')
 testmod('mercurial.subrepo')
-testmod('mercurial.templatefilters')
 testmod('mercurial.templater')
 testmod('mercurial.ui')
-testmod('mercurial.url')
 testmod('mercurial.util')
 testmod('mercurial.util', testtarget='platform')
 testmod('mercurial.utils.dateutil')
 testmod('mercurial.utils.stringutil')
+if os.name == 'nt':
+testmod('mercurial.windows')
 testmod('hgext.convert.convcmd')
 testmod('hgext.convert.cvsps')
 testmod('hgext.convert.filemap')



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


D8279: tests: remove doctest in narrowspec, it is broken

2020-03-12 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think every item here is considered incorrect (if we fix doctest to run it),
  so let's just delete it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -233,21 +233,6 @@
 :param repo_includes: repo includes
 :param repo_excludes: repo excludes
 :return: include patterns, exclude patterns, and invalid include patterns.
-
->>> restrictpatterns({'f1','f2'}, {}, ['f1'], [])
-(set(['f1']), {}, [])
->>> restrictpatterns({'f1'}, {}, ['f1','f2'], [])
-(set(['f1']), {}, [])
->>> restrictpatterns({'f1/fc1', 'f3/fc3'}, {}, ['f1','f2'], [])
-(set(['f1/fc1']), {}, [])
->>> restrictpatterns({'f1_fc1'}, {}, ['f1','f2'], [])
-([], set(['path:.']), [])
->>> restrictpatterns({'f1/../f2/fc2'}, {}, ['f1','f2'], [])
-(set(['f2/fc2']), {}, [])
->>> restrictpatterns({'f1/../f3/fc3'}, {}, ['f1','f2'], [])
-([], set(['path:.']), [])
->>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], [])
-(set(['f1/$non_exitent_var']), {}, [])
 """
 res_excludes = set(req_excludes)
 res_excludes.update(repo_excludes)



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


D8278: rust-core: add missing `Debug` traits

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

REVISION SUMMARY
  Turns out you need them when trying to use `hg-core` as a library. Who knew.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs
  rust/hg-core/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -103,6 +103,7 @@
 }
 }
 
+#[derive(Debug)]
 pub enum DirstateError {
 Parse(DirstateParseError),
 Pack(DirstatePackError),
diff --git a/rust/hg-core/src/dirstate/status.rs 
b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -623,6 +623,7 @@
 );
 }
 
+#[derive(Debug)]
 pub struct DirstateStatus<'a> {
 pub modified: Vec>,
 pub added: Vec>,
@@ -679,6 +680,7 @@
 )
 }
 
+#[derive(Debug)]
 pub enum StatusError {
 IO(std::io::Error),
 Path(HgPathError),



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


D8277: tests: fix rebase test broken by earlier cleanup

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It turns out I broke one of the rebase tests in dd2833e4d660 
 
(tests:
  use drawdag in test-rebase-collapse.t, 2018-03-18) and didn't notice
  until now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-rebase-collapse.t

CHANGE DETAILS

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
@@ -184,33 +184,33 @@
 
 Rebase and collapse - E onto H:
 
-  $ hg rebase -s E --dest I --collapse # root (E) is not a merge
-  abort: unknown revision 'I'!
-  [255]
+  $ hg rebase -s E --dest H --collapse # root (E) is not a merge
+  rebasing 5:49cb92066bfd "E" (E)
+  rebasing 6:11abe3fb10b8 "F" (F)
+  rebasing 7:64e264db77f0 "G" (G tip)
+  saved backup bundle to 
$TESTTMP/multiple-external-parents/.hg/strip-backup/49cb92066bfd-ee8a8a79-rebase.hg
 
   $ hg tglog
-  o7: 64e264db77f0 'G'
-  |\
-  | o  6: 11abe3fb10b8 'F'
-  | |
-  | o  5: 49cb92066bfd 'E'
+  o5: 8b2315790719 'Collapsed revision
+  |\   * E
+  | |  * F
+  | |  * G'
+  | o4: 4e4f9194f9f1 'D'
+  | |\
+  o | |  3: 575c4b5ec114 'H'
+  | | |
+  +---o  2: dc0947a82db8 'C'
   | |
-  o |  4: 4e4f9194f9f1 'D'
-  |\|
-  | | o  3: 575c4b5ec114 'H'
-  | | |
-  o---+  2: dc0947a82db8 'C'
-   / /
-  o /  1: 112478962961 'B'
+  | o  1: 112478962961 'B'
   |/
   o  0: 426bada5c675 'A'
   
   $ hg manifest --rev tip
   A
-  B
   C
   E
   F
+  H
 
   $ cd ..
 



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


D8246: hg-core: add a compilation error if trying to compile outside of Linux

2020-03-12 Thread Raphaël Gomès
Alphare added a comment.


  In D8246#123554 , @yuja wrote:
  
  >> +/// Remove this to see (potential) non-artificial compile failures. MacOS
  >> +/// *should* compile, but fail to compile tests for example as of 
2020-03-06
  >
  > Un-doccommented this to silence build warning.
  
  Thanks, good catch.

REPOSITORY
  rHG Mercurial

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

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

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


D8276: cext-index: propagate inline_scan error in `index_deref`

2020-03-12 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this change, revlog index corruption could be silently ignored in some
  situation.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -157,7 +157,10 @@
 sizeof(*self->offsets));
if (self->offsets == NULL)
return (const char *)PyErr_NoMemory();
-   inline_scan(self, self->offsets);
+   Py_ssize_t ret = inline_scan(self, self->offsets);
+   if (ret == -1) {
+   return NULL;
+   };
}
return self->offsets[pos];
}



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


D8275: heptapod-ci: fix test paths in the listing file

2020-03-12 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now what we run the test from the root, we need to list test name from the 
root.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  contrib/heptapod-ci.yml

CHANGE DETAILS

diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml
+++ b/contrib/heptapod-ci.yml
@@ -6,7 +6,7 @@
 - hg clone . /tmp/mercurial-ci/ --noupdate
 - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
 - cd /tmp/mercurial-ci/
-- (cd tests; ls -1 test-check-*.*) > /tmp/check-tests.txt
+- ls -1 tests/test-check-*.* > /tmp/check-tests.txt
 
 variables:
 PYTHON: python



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


D8244: copies: fix the changeset based algorithm regarding merge

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D8244#122821 , @marmoute 
wrote:
  
  > In D8244#122806 , @martinvonz 
wrote:
  >
  >>> In 99ebde4fec99 
, 
we changed the list of files stored into the files field.
  >>> This lead to the changeset centric copy algorithm to break in various 
merge
  >>> situation involving merge.
  >>
  >> Could you explain why it broke? It's hard to review this patch without 
really knowing what the problem or the solution is.
  >
  > Outdated information from p1 could overwrite newer information from p2.
  >
  >>> The new implementation focus on correctness. Performance improvement will 
come
  >>>  later.
  >>
  >> How much slower is it? Could you run some of those benchmarks you have run 
on previous patches touching this code? How do you plan to improve it?
  >
  > There are two new calls that might degrade performance. This `isancestor` 
call that is easy to cache in memory. And the "ismerged" logic that is easy to 
cache on disk with the rest of the copy related information (the case is rare).
  > There is some win to have in python, but the main win will be the move the 
Rust algorithm (that need to be updated with the new logic). Moving to rust 
give a very large performance boost on the slow cases (usually over 10x, 
sometime 100x IIRC). That is the one I care about.
  
  I'll make the performance impact more concrete myself. I picked two quite 
arbitrary tags in the mozilla-unified repo and this is what I saw:
  
  Before this patch:
  
$ python3 ~/hg/hg perfpathcopies FIREFOX_BETA_44_END FIREFOX_BETA_54_END
! wall 5.279230 comb 5.27 user 5.25 sys 0.02 (best of 3)
  
  After this patch:
  
$ python3 ~/hg/hg perfpathcopies FIREFOX_BETA_44_END FIREFOX_BETA_54_END
! wall 8.277523 comb 8.28 user 8.17 sys 0.11 (best of 3)
  
  Could you share some more benchmarking data? I know you had a set of commits 
that you've used before (and that you've asked me to use for benchmarking my 
patches to `copies.py` against). It's quite a significant slowdown for the case 
I tested above, but I'm fine with it since it fixes a bug. I'd just like to see 
how it behaves in other cases.

INLINE COMMENTS

> martinvonz wrote in copies.py:277
> s/had/add/?

Not actually done, it seems, but not a big deal anyway.

REPOSITORY
  rHG Mercurial

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

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

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


D8243: copies: stop recording buggy file merge when new file overwrite an old one

2020-03-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  This is pretty ugly and it doesn't seem that the next patch depends on it. 
You said you'll soon clean it up anyway, so I wonder if should just wait for 
the better solution instead. It doesn't seem like this fixes a serious bug so 
we have to rush it. Thoughts?

REPOSITORY
  rHG Mercurial

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

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

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


D8274: rust: update the README with more up-to-date and thorough information

2020-03-12 Thread Raphaël Gomès
Closed by commit rHG47f8c741df0f: rust: update the README with more up-to-date 
and thorough information (authored by Alphare).
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/D8274?vs=20756=20758

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

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

AFFECTED FILES
  rust/README.rst

CHANGE DETAILS

diff --git a/rust/README.rst b/rust/README.rst
--- a/rust/README.rst
+++ b/rust/README.rst
@@ -11,28 +11,57 @@
 - hgcli. A experiment for starting hg in rust rather than in python,
   by linking with the python runtime. Probably meant to be replaced by
   PyOxidizer at some point.
-- hg-core (and hg-cpython/hg-directffi): implementation of some
+- hg-core (and hg-cpython): implementation of some
   functionality of mercurial in rust, e.g. ancestry computations in
-  revision graphs or pull discovery. The top-level ``Cargo.toml`` file
+  revision graphs, status or pull discovery. The top-level ``Cargo.toml`` file
   defines a workspace containing these crates.
 
-Using hg-core
-=
+Using Rust code
+===
 
 Local use (you need to clean previous build artifacts if you have
 built without rust previously)::
 
-  $ HGWITHRUSTEXT=cpython make local # to use ./hg
-  $ HGWITHRUSTEXT=cpython make tests # to run all tests
-  $ (cd tests; HGWITHRUSTEXT=cpython ./run-tests.py) # only the .t
-  $ ./hg debuginstall | grep rust # to validate rust is in use
+  $ make PURE=--rust local # to use ./hg
+  $ ./tests/run-tests.py --rust # to run all tests
+  $ ./hg debuginstall | grep -i rust # to validate rust is in use
+  checking Rust extensions (installed)
   checking module policy (rust+c-allow)
+  checking "re2" regexp engine Rust bindings (installed)
+
+
+If the environment variable ``HGWITHRUSTEXT=cpython`` is set, the Rust
+extension will be used by default unless ``--no-rust``.
+
+One day we may use this environment variable to switch to new experimental
+binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``.
+
+Using the full ``hg status`` extension
+--
 
-Setting ``HGWITHRUSTEXT`` to other values like ``true`` is deprecated
-and enables only a fraction of the rust code.
+The code for ``hg status`` needs to conform to ``.hgignore`` rules, which are
+all translated into regex. For compatibility and ease of development reasons
+the Re2 regex engine is in use until we figure out if the ``regex`` crate has
+similar enough behavior. This implies that you need to install ``Re2``
+following Google's guidelines: https://github.com/google/re2/wiki/Install
+
+Then, use ``HG_RUST_FEATURES=with-re2`` when building ``hg`` to use the full
+status code.
+
+Developing Rust
+===
 
-Developing hg-core
-==
+The current version of Rust in use is ``1.34.2``, because it's what Debian
+stable has. You can use ``rustup override set 1.34.2`` at the root of the repo
+to make it easier on you.
+
+Go to the ``hg-cpython`` folder::
+
+  $ cd rust/hg-cpython
+
+Or, only the ``hg-core`` folder. Be careful not to break compatibility::
+
+  $ cd rust/hg-core
 
 Simply run::
 
@@ -46,7 +75,35 @@
 
   $ cargo check
 
+For even faster typing::
+
+  $ cargo c
+
 You can run only the rust-specific tests (as opposed to tests of
 mercurial as a whole) with::
 
   $ cargo test --all
+
+Formatting the code
+---
+
+We use ``rustfmt`` to keep the code formatted at all times. For now, we are
+using the nightly version because it has been stable enough and provides
+comment folding.
+
+To format the entire Rust workspace::
+
+  $ cargo +nightly fmt
+
+This requires you to have the nightly toolchain installed.
+
+Additional features
+---
+
+As mentioned in the section about ``hg status``, code paths using ``re2`` are
+opt-in.
+
+For example::
+
+  $ cargo check --features with-re2
+



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


mercurial@44476: new changeset (1 on stable)

2020-03-12 Thread Mercurial Commits
New changeset (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/df5dfee8cfb4
changeset:   44476:df5dfee8cfb4
branch:  stable
tag: tip
user:Raphaël Gomès 
date:Fri Mar 06 10:38:37 2020 +0100
summary: hg-core: add a compilation error if trying to compile outside of 
Linux

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


D8246: hg-core: add a compilation error if trying to compile outside of Linux

2020-03-12 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +/// Remove this to see (potential) non-artificial compile failures. MacOS
  > +/// *should* compile, but fail to compile tests for example as of 
2020-03-06
  
  Un-doccommented this to silence build warning.

REPOSITORY
  rHG Mercurial

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

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

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


Re: D8246: hg-core: add a compilation error if trying to compile outside of Linux

2020-03-12 Thread Yuya Nishihara
> +/// Remove this to see (potential) non-artificial compile failures. MacOS
> +/// *should* compile, but fail to compile tests for example as of 2020-03-06

Un-doccommented this to silence build warning.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8274: rust: update the README with more up-to-date and thorough information

2020-03-12 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
  default

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

AFFECTED FILES
  rust/README.rst

CHANGE DETAILS

diff --git a/rust/README.rst b/rust/README.rst
--- a/rust/README.rst
+++ b/rust/README.rst
@@ -11,28 +11,57 @@
 - hgcli. A experiment for starting hg in rust rather than in python,
   by linking with the python runtime. Probably meant to be replaced by
   PyOxidizer at some point.
-- hg-core (and hg-cpython/hg-directffi): implementation of some
+- hg-core (and hg-cpython): implementation of some
   functionality of mercurial in rust, e.g. ancestry computations in
-  revision graphs or pull discovery. The top-level ``Cargo.toml`` file
+  revision graphs, status or pull discovery. The top-level ``Cargo.toml`` file
   defines a workspace containing these crates.
 
-Using hg-core
-=
+Using Rust code
+===
 
 Local use (you need to clean previous build artifacts if you have
 built without rust previously)::
 
-  $ HGWITHRUSTEXT=cpython make local # to use ./hg
-  $ HGWITHRUSTEXT=cpython make tests # to run all tests
-  $ (cd tests; HGWITHRUSTEXT=cpython ./run-tests.py) # only the .t
-  $ ./hg debuginstall | grep rust # to validate rust is in use
+  $ make PURE=--rust local # to use ./hg
+  $ ./tests/run-tests.py --rust # to run all tests
+  $ ./hg debuginstall | grep -i rust # to validate rust is in use
+  checking Rust extensions (installed)
   checking module policy (rust+c-allow)
+  checking "re2" regexp engine Rust bindings (installed)
+
+
+If the environment variable ``HGWITHRUSTEXT=cpython`` is set, the Rust
+extension will be used by default unless ``--no-rust``.
+
+One day we may use this environment variable to switch to new experimental
+binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``.
+
+Using the full ``hg status`` extension
+--
 
-Setting ``HGWITHRUSTEXT`` to other values like ``true`` is deprecated
-and enables only a fraction of the rust code.
+The code for ``hg status`` needs to conform to ``.hgignore`` rules, which are
+all translated into regex. For compatibility and ease of development reasons
+the Re2 regex engine is in use until we figure out if the ``regex`` crate has
+similar enough behavior. This implies that you need to install ``Re2``
+following Google's guidelines: https://github.com/google/re2/wiki/Install
+
+Then, use ``HG_RUST_FEATURES=with-re2`` when building ``hg`` to use the full
+status code.
+
+Developing Rust
+===
 
-Developing hg-core
-==
+The current version of Rust in use is ``1.34.2``, because it's what Debian
+stable has. You can use ``rustup override set 1.34.2`` at the root of the repo
+to make it easier on you.
+
+Go to the ``hg-cpython`` folder::
+
+  $ cd rust/hg-cpython
+
+Or, only the ``hg-core`` folder. Be careful not to break compatibility::
+
+  $ cd rust/hg-core
 
 Simply run::
 
@@ -46,7 +75,35 @@
 
   $ cargo check
 
+For even faster typing::
+
+  $ cargo c
+
 You can run only the rust-specific tests (as opposed to tests of
 mercurial as a whole) with::
 
   $ cargo test --all
+
+Formatting the code
+---
+
+We use ``rustfmt`` to keep the code formatted at all times. For now, we are
+using the nightly version because it has been stable enough and provides
+comment folding.
+
+To format the entire Rust workspace::
+
+  $ cargo +nightly fmt
+
+This requires you to have the nightly toolchain installed.
+
+Additional features
+---
+
+As mentioned in the section about ``hg status``, code paths using ``re2`` are
+opt-in.
+
+For example::
+
+  $ cargo check --features with-re2
+



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