D12556: windows: disable pager when packaged with py2exe

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  With Windows and py3, all output that got directed to the pager was lost.  It
  can be worked around by the user piping to `more`, but that's easy to forget,
  and can be dangerous if `hg diff` or similar incorrectly shows no changes.  
The
  problem appears to be the new WindowsConsoleIO in py3.6[1].  We've worked 
around
  it with PyOxidizer by setting the `Py_LegacyWindowsStdioFlag` interpreter
  option, and worked around it with `hg.bat` and `exewrapper.c` by internally
  setting `PYTHONLEGACYWINDOWSSTDIO=1`.
  
  Unfortunately, py2exe doesn't appear to be able to set the interpreter option,
  and somehow seems to also ignore the environment variable.  The latter isn't a
  good fix anyway, since setting it in the environment would affect other python
  programs too.  We can't install a global config for this because a config 
closer
  to the user (e.g. from before pager was turned on by default) can override it.
  
  [1] https://peps.python.org/pep-0528/

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1432,6 +1432,14 @@
 # HGPLAINEXCEPT=pager, and the user didn't specify --debug.
 return
 
+# py2exe doesn't appear to be able to use legacy I/O, and nothing is
+# output to the pager for paged commands.  Piping to `more` in cmd.exe
+# works, but is easy to forget.  Just disable pager for py2exe, but
+# leave it working for pyoxidizer and exewrapper builds.
+if pycompat.iswindows and getattr(sys, "frozen", None) == 
"console_exe":
+self.debug(b"pager is unavailable with py2exe packaging\n")
+return
+
 pagercmd = self.config(b'pager', b'pager', rcutil.fallbackpager)
 if not pagercmd:
 return



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


D12557: windows: fix stdio with py2exe and py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  - DO NOT QUEUE THIS **
  
  I have no idea how this is supposed to be fixed for real, but it's likely
  related to the comment above where stdout is set about maybe needing a silly
  wrapper.  PEP 528[1] talks about not assuming the encoding of 
sys.stdout.buffer,
  but I thought the whole point of always using bytes was to avoid encoding.
  
  This hack allows TortoiseHg to work when built with py2exe on py3, by avoiding
  this:
  
#!python
** Mercurial version (6.1.1+hg216.d8b5fd0ab640local20220412).  TortoiseHg 
version (6.1.1+26-204092cabbee)
** Command: --nofork workbench
** CWD: C:\Users\Administrator\Desktop
** Encoding: cp1252
** Extensions loaded: absorb, strip, tortoisehg.util.configitems
** Python version: 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) 
[MSC v.1929 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=2, build=9200, 
platform=2, service_pack='')
** Processor architecture: x64
** Qt-5.15.2 PyQt-5.15.6 QScintilla-2.13.1
Traceback (most recent call last):
  File "tortoisehg\hgqt\repotab.pyc", line 355, in _onCurrentTabChanged
  File "tortoisehg\hgqt\repotab.pyc", line 406, in _createRepoWidget
  File "tortoisehg\hgqt\repowidget.pyc", line 228, in __init__
  File "tortoisehg\hgqt\repowidget.pyc", line 260, in setupUi
  File "tortoisehg\hgqt\repofilter.pyc", line 264, in __init__
  File "tortoisehg\hgqt\repofilter.pyc", line 554, in refresh
  File "tortoisehg\hgqt\repofilter.pyc", line 491, in _updateBranchFilter
  File "tortoisehg\util\hglib.pyc", line 237, in namedbranches
  File "mercurial\localrepo.pyc", line 2154, in branchmap
  File "mercurial\branchmap.pyc", line 72, in __getitem__
  File "mercurial\branchmap.pyc", line 81, in updatecache
  File "mercurial\repoview.pyc", line 421, in changelog
  File "mercurial\repoview.pyc", line 248, in filterrevs
  File "mercurial\repoview.pyc", line 104, in computehidden
  File "mercurial\repoview.pyc", line 43, in hideablerevs
  File "mercurial\obsolete.pyc", line 911, in getrevs
  File "mercurial\localrepo.pyc", line 118, in __get__
  File "mercurial\scmutil.pyc", line 1709, in __get__
  File "mercurial\localrepo.pyc", line 1723, in obsstore
  File "mercurial\obsolete.pyc", line 817, in makestore
  File "mercurial\ui.pyc", line 1855, in warn
  File "mercurial\ui.pyc", line 1330, in _writemsg
  File "mercurial\ui.pyc", line 2282, in _writemsgwith
  File "mercurial\ui.pyc", line 1273, in _write
  File "mercurial\ui.pyc", line 1298, in _writenobuf
  File "mercurial\windows.pyc", line 240, in write
  File "mercurial\utils\procutil.pyc", line 114, in write
  File "boot_common.py", line 74, in write
TypeError: write() argument must be str, not memoryview
  
  [1] https://peps.python.org/pep-0528/

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -107,11 +107,11 @@
 
 def write(self, s):
 write1 = self.orig.write
-m = memoryview(s)
-total_to_write = len(s)
+v = encoding.strfromlocal(s)
+total_to_write = len(v)
 total_written = 0
 while total_written < total_to_write:
-c = write1(m[total_written:])
+c = write1(v[total_written:])
 if c:
 total_written += c
 return total_written
@@ -147,11 +147,11 @@
 if sys.stdout is None:
 stdout = BadFile()
 else:
-stdout = _make_write_all(sys.stdout.buffer)
+stdout = _make_write_all(getattr(sys.stdout, 'buffer', sys.stdout))
 if sys.stderr is None:
 stderr = BadFile()
 else:
-stderr = _make_write_all(sys.stderr.buffer)
+stderr = _make_write_all(getattr(sys.stderr, 'buffer', sys.stderr))
 
 if pycompat.iswindows:
 # Work around Windows bugs.



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


D12555: procutil: avoid `+= None` when writing to full std{err, out} descriptor on py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The write function returns `None` if there was no room to write the given
  data[1].  I don't like that this is effectively an infinite loop if there's
  never any progress emptying the underlying buffer, but we're no worse off than
  before, and it fixes random stacktrace popups seen in the py3 build of
  TortoiseHg.
  
  [1] https://docs.python.org/3/library/io.html#io.RawIOBase.write

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -111,7 +111,9 @@
 total_to_write = len(s)
 total_written = 0
 while total_written < total_to_write:
-total_written += write1(m[total_written:])
+c = write1(m[total_written:])
+if c:
+total_written += c
 return total_written
 
 



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


D12553: setup: fix the py2exe logic to work with py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  TortoiseHg still uses (the modernized) py2exe packaging, but the build was
  failing since `py2exe.Distribution` was removed.
  
  One thing to note is that later in this module, there's a hack to include
  `distutils` when building from a virtualenv.  While `import distutils` works 
in
  `hg debugshell` when built with py2, it doesn't work in py3.  I'm not sure 
why-
  I don't see it in `library.zip` either.  It doesn't seem to break anything
  though.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -197,7 +197,7 @@
 try:
 import py2exe
 
-py2exe.Distribution  # silence unused import warning
+py2exe.patch_distutils()
 py2exeloaded = True
 # import py2exe's patched Distribution class
 from distutils.core import Distribution



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


D12554: resourceutil: force filesystem access to resources when using py2exe

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know why it doesn't work, but it avoids this fatal error on startup:
  
> hg debugshell
Traceback (most recent call last):
  File "hg", line 58, in 
  File "mercurial\dispatch.pyc", line 143, in run
  File "mercurial\dispatch.pyc", line 232, in dispatch
  File "mercurial\dispatch.pyc", line 254, in _rundispatch
  File "mercurial\ui.pyc", line 316, in load
  File "mercurial\rcutil.pyc", line 98, in rccomponents
  File "mercurial\rcutil.pyc", line 68, in default_rc_resources
  File "mercurial\utils\resourceutil.pyc", line 102, in contents
  File "", line 775, in contents
AssertionError
  
  I assume the py2 version of py2exe never hit this because 
`importlib.resources`
  failed to import.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -61,6 +61,10 @@
 # Force loading of the resources module
 resources.open_binary  # pytype: disable=module-attr
 
+# py2exe raises an AssertionError if uses importlib.resources
+if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"):
+raise ImportError
+
 except (ImportError, AttributeError):
 # importlib.resources was not found (almost definitely because we're on a
 # Python version before 3.7)



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


D12552: rebase: while rewriting desc hashes, ignore ambiguous prefix "hashes"

2022-04-13 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If a repo is sufficiently large, a six digit number "hash prefix" can somewhat
  easily reference an ambiguous hash prefix.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/rewriteutil.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -1027,8 +1027,7 @@
   $ hg ci -qAm 'The previous two (parentless) commits had a hash prefix of 
b04363. Check that rewrite_hash_refs will not fail because of that.'
   $ hg rebase -r . -d 5
   rebasing 8:5c4cdabf5769 tip "The previous two (parentless) commits had a 
hash prefix of b04363. Check that rewrite_hash_refs will not fail because of 
that."
-  abort: 00changelog@b04363: ambiguous identifier
-  [50]
+  saved backup bundle to 
$TESTTMP/keep_merge/.hg/strip-backup/5c4cdabf5769-335e1828-rebase.hg
 
   $ cd ..
 
diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -215,9 +215,9 @@
 for h in hashes:
 try:
 fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
-except error.WdirUnsupported:
-# Someone has an f... in a commit message we're
-# rewriting. Don't try rewriting that.
+except (error.WdirUnsupported, error.AmbiguousPrefixLookupError):
+# Someone has an f... or some other prefix that's ambiguous in 
a
+# commit message we're rewriting. Don't try rewriting that.
 continue
 if fullnode is None:
 continue



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


D12551: tests: add test demonstrating issue with ambiguous has prefixes during rebase

2022-04-13 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -1003,6 +1003,33 @@
   o  0: d20a80d4def3 'base'
   
 
+Add an explicit test for rewrite_hash_refs when the detected prefix is
+ambiguous. Here's the super low-tech way I found this collision, if the hashing
+scheme ever changes:
+# hg init
+# echo test0 > test
+# hg ci -qAm 'test0' -u 'test' -d '0 0'
+# i=1
+# while [[ $(chg log -r . -T'{shortest(node, 6)}' | wc -c) -eq 6 ]]; do
+#   chg co -r 00
+#   echo "test$i" > test
+#   chg ci -qAm "test$i" -u test -d '0 0'
+#   (( ++i ))
+# done
+  $ hg co -q 00
+  $ echo test5281 > test
+  $ hg ci -qAm 'test5281'
+  $ hg co -q 0
+  $ echo test9912 > test
+  $ hg ci -qAm 'test9912'
+  $ hg co -q 4
+  $ echo contents > some_file
+  $ hg ci -qAm 'The previous two (parentless) commits had a hash prefix of 
b04363. Check that rewrite_hash_refs will not fail because of that.'
+  $ hg rebase -r . -d 5
+  rebasing 8:5c4cdabf5769 tip "The previous two (parentless) commits had a 
hash prefix of b04363. Check that rewrite_hash_refs will not fail because of 
that."
+  abort: 00changelog@b04363: ambiguous identifier
+  [50]
+
   $ cd ..
 
 Test (virtual) working directory without changes, created by merge conflict



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


Re: Moving away from Phabricator

2022-04-13 Thread Augie Fackler


> On Apr 13, 2022, at 12:06 PM, Raphaël Gomès  wrote:
> 
> Hi everyone,
> 
> It has now been more than a month and our window to migrate out of our VM is 
> closing down.
> 

Thanks for keeping track of this!

> I am happy to report that the new versions of Heptapod and the evolve 
> extension have brought the expected speedups and the push/pull times on 
> Heptapod are now much better. There still remains a lot to be desired with 
> regards to exchange, but that is for another discussion.
> 
> It's time to make an inventory of the project and make some decisions about 
> what stays the same, what changes and what disappears. We also need to 
> discuss the contribution and review process.
> 
> # Inventory
> 
> We still don't have a clear path for VM hosting, but maybe the OSUOSL can 
> help us, seeing as a good amount of the foss.heptapod.net CI there. 
> Seehttps://osuosl.org/services/hosting/details 
> .
> 
> ## The mailing lists
> 
> They're not going anywhere, of course. Additionally, the ability to send 
> patches to the devel mailing list will stay, but will not be the preferred 
> way proposed.
> 
> They are currently managed by a mailman on the VM, which will need to be 
> migrated out. The OSUOSL people have already agreed to manage our mailing 
> lists for us. This could be a good solution to further reduce sysadmin burden.
> 

If we finish off the lists and phabricator, that reduces our footprint a _lot_ 
FWIW. That removes all (I think?) the reasons we have to send mail, so you’re 
really down to hosting the wiki and the repos.

> 
> ## Phabricator
> 
> Phabricator will be turned off and be replaced as a means of contribution by 
> Heptapod.
> 
> The `phab.mercurial-scm.org` differential URLs will be kept around as a 
> static archive: I have already started the relatively painful (basically 
> because of AJAX) endeavor of creating the scripts to save the valuable 
> history of our review discussions, and hope to have enough free time to have 
> it done before the VM dies.
> 
> ## mercurial-scm.org
> 
> The website will need to be migrated out. I don't expect this to be a major 
> hassle.
> 
> On a related but technically independent front, I've started some very simple 
> patches to improve its contents (like not advertising that we use Python 
> 2...).
> 
> ## Wiki
> 
> The wiki needs to be migrated out. I'm not exactly sure what the story of 
> MoinMoin is currently, but this should also be a relatively simple process.
> 
> ## Repos
> 
> I think the project should still use hgweb to advertise at least its main 
> (read-only) repository and any other repo that doesn't have a better home. 
> See the part about the contribution process for more discussion about the 
> hg-committed repo.
> 

These all sound right.

> ## Patchwork
> 
> What should we do about patchwork? I've only been reminded of its existence 
> by looking around the VM. Maybe my `getpatches` alias uses it underneath for 
> queuing from the mailing list?
> 

If your getpatches alias is the one I think it is, that probably hits 
https://hgpatches.durin42.com/?  Which, as the 
URL suggests, is actually running on a machine I own. It’s been 
zero-maintenance for years, but if y’all care about it long-term we should 
probably transition it eventually. Though it’s not as pressing.

> ## Buildbot
> 
> This has been functionally dead for a long while and will not be carried over 
> now that we have the Heptapod CI.
> 
> ## Bugzilla
> 
> We will want to - of course - keep our bug tracking. We're using Bugzilla 
> with MySQL, but we could use PostgreSQL in the target machine if that makes 
> it easier, I don't think this particular aspect would be too hard to migrate 
> on its own.
> 
> The migration from bugzilla to another tool (like Heptapod/Gitlab issues) 
> should probably be another discussion to simplify the transition.
> 

Agreed. Bugzilla has been a pretty minor pain point compared to phabricator.

> ## Other things?
> 
> Have I forgotten an important piece of the project?
> 

hgbot runs on mercurial-scm.org . It uses a sqlite 
database and is pretty minimal in terms of overhead, so as long as wherever we 
put the VM can handle the irc connection, seems fine.

> 
> # Review process
> 

I’m inactive enough I’ll defer to the opinions of others here. Others: if you 
have opinions, _please_ speak up! This is your chance to make a difference 
before we EOL phabricator and your choices are (by default) heptapod and `hg 
email`.

[snip review process options]
> 
> # Conclusion
> 
> The hope of this migration is to remove a lot of the sysadmin burden, 
> simplify, strengthen and modernize the contribution and review process and 
> leave the project in a healthier, more maintainable state. I hope to see my 
> mental load reduced by a lot after this transition, and I'm pretty sure I'm 
> not the only one.
> 

Thanks a bunch!


Re: Moving away from Phabricator

2022-04-13 Thread Raphaël Gomès

Hi everyone,

It has now been more than a month and our window to migrate out of our 
VM is closing down.


I am happy to report that the new versions of Heptapod and the evolve 
extension have brought the expected speedups and the push/pull times on 
Heptapod are now much better. There still remains a lot to be desired 
with regards to exchange, but that is for another discussion.


It's time to make an inventory of the project and make some decisions 
about what stays the same, what changes and what disappears. We also 
need to discuss the contribution and review process.


# Inventory

We still don't have a clear path for VM hosting, but maybe the OSUOSL 
can help us, seeing as a good amount of the foss.heptapod.net CI there. 
See https://osuosl.org/services/hosting/details.


## The mailing lists

They're not going anywhere, of course. Additionally, the ability to send 
patches to the devel mailing list will stay, but will not be the 
preferred way proposed.


They are currently managed by a mailman on the VM, which will need to be 
migrated out. The OSUOSL people have already agreed to manage our 
mailing lists for us. This could be a good solution to further reduce 
sysadmin burden.


## Phabricator

Phabricator will be turned off and be replaced as a means of 
contribution by Heptapod.


The `phab.mercurial-scm.org` differential URLs will be kept around as a 
static archive: I have already started the relatively painful (basically 
because of AJAX) endeavor of creating the scripts to save the valuable 
history of our review discussions, and hope to have enough free time to 
have it done before the VM dies.


## mercurial-scm.org

The website will need to be migrated out. I don't expect this to be a 
major hassle.


On a related but technically independent front, I've started some very 
simple patches to improve its contents (like not advertising that we use 
Python 2...).


## Wiki

The wiki needs to be migrated out. I'm not exactly sure what the story 
of MoinMoin is currently, but this should also be a relatively simple 
process.


## Repos

I think the project should still use hgweb to advertise at least its 
main (read-only) repository and any other repo that doesn't have a 
better home. See the part about the contribution process for more 
discussion about the hg-committed repo.


## Patchwork

What should we do about patchwork? I've only been reminded of its 
existence by looking around the VM. Maybe my `getpatches` alias uses it 
underneath for queuing from the mailing list?


## Buildbot

This has been functionally dead for a long while and will not be carried 
over now that we have the Heptapod CI.


## Bugzilla

We will want to - of course - keep our bug tracking. We're using 
Bugzilla with MySQL, but we could use PostgreSQL in the target machine 
if that makes it easier, I don't think this particular aspect would be 
too hard to migrate on its own.


The migration from bugzilla to another tool (like Heptapod/Gitlab 
issues) should probably be another discussion to simplify the transition.


## Other things?

Have I forgotten an important piece of the project?

# Review process

Moving to Heptapod will imply a change in review process.

## Default Heptapod workflow

Here's what the expected workflow would look like (this is *not* an 
exhaustive list of all possible workflows):

    - Contributor creates their changesets locally and affects them a topic
    - Contributor pushes their changesets to the repository to test 
them against the CI, which launches automatically on the tip of their 
topic (the push is refused if not in a topic, or if it's a public 
changeset for non-maintainers, of course)
    - Contributor decides that their changes are good enough to review, 
they create a merge request (MR) associated with their topic (either 
from the web UI or through push options). Note that that's what happens 
today, but at some point we may want to reduce the duplicate pipelines, 
e.g., limiting pipelines to MRs could become necessary.

    - Reviewer reviews the MR:
    - Both make comments back-and-forth either on the general diff, 
or on the individual changesets
    - The changesets get updated on each push with context as to 
what changed since the comments were made
    - MRs that need adjusting  are put in the Draft state and 
assigned to the original author
    - Reviewer "merges" the MR. This does not imply a merge and can be 
forced to always rebase (and wait for a green CI). Doing so manually, 
mainly for taking a series partially, is entirely possible with a normal 
`push --publish` (though this would not run the CI before publishing, 
which we will need to think about). In any case, removing the topic from 
a draft also **makes the changeset public** upon push.


That last point is important and we need to evaluate how we want to go 
forward.


## Current process

The current review process goes as follows:
    - One committer pushes the draft changesets to the 

D12550: absorb: make `--edit-lines` imply `--apply-changes`

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  One of our users tried to use `hg absorb -e` but it seemed that it
  would only bring up the editor if there were no changes the command
  could automatically detect destination for. I spent probably half an
  hour debugging why it worked that way. I finally figured out that it
  does bring up the editor, but you have to answer "yes" to the "apply
  changes" prompt *first*. That seems very unintuitive. If the user
  wants to edit the changes, there seems to be little reason to present
  them with a prompt first, so let's have `-e/--edit-lines` imply
  `-a/--apply-changes`. All the tests using `-e` also already used
  `-a`. I changed them to rely on the implied `-a` so we get coverage of
  that.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/absorb.py
  tests/test-absorb-edit-lines.t

CHANGE DETAILS

diff --git a/tests/test-absorb-edit-lines.t b/tests/test-absorb-edit-lines.t
--- a/tests/test-absorb-edit-lines.t
+++ b/tests/test-absorb-edit-lines.t
@@ -15,10 +15,10 @@
 
 absorb --edit-lines will run the editor if filename is provided:
 
-  $ hg absorb --edit-lines --apply-changes
+  $ hg absorb --edit-lines
   nothing applied
   [1]
-  $ HGEDITOR=cat hg absorb --edit-lines --apply-changes a
+  $ HGEDITOR=cat hg absorb --edit-lines a
   HG: editing a
   HG: "y" means the line to the right exists in the changeset to the top
   HG:
@@ -43,7 +43,7 @@
   > y   : f
   > yyy : g
   > EOF
-  $ HGEDITOR='cat editortext >' hg absorb -q --edit-lines --apply-changes a
+  $ HGEDITOR='cat editortext >' hg absorb -q --edit-lines a
   $ hg cat -r 0 a
   d  
   e
diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -1045,6 +1045,10 @@
 origchunks = patch.parsepatch(diff)
 chunks = cmdutil.recordfilter(ui, origchunks, matcher)[0]
 targetctx = overlaydiffcontext(stack[-1], chunks)
+if opts.get(b'edit_lines'):
+# If we're going to open the editor, don't ask the user to confirm
+# first
+opts[b'apply_changes'] = True
 fm = None
 if opts.get(b'print_changes') or not opts.get(b'apply_changes'):
 fm = ui.formatter(b'absorb', opts)



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


D12549: branchmap: add a test that shows bad interaction with strip

2022-04-13 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-strip-branch-cache.t

CHANGE DETAILS

diff --git a/tests/test-strip-branch-cache.t b/tests/test-strip-branch-cache.t
new file mode 100644
--- /dev/null
+++ b/tests/test-strip-branch-cache.t
@@ -0,0 +1,59 @@
+Define helpers.
+
+  $ hg_log () { hg log -G -T "{rev}:{node|short}"; }
+  $ commit () { echo "foo - ${2:-$1}" > $1; hg commit -Aqm "Edited $1"; }
+  $ strip() { hg --config extensions.strip= strip -q -r "$1" ; }
+
+Setup hg repo.
+
+  $ hg init repo
+  $ cd repo
+  $ touch x; hg add x; hg commit -m "initial"
+  $ hg clone -q . ../clone
+  $ commit a
+
+  $ cd ../clone
+  $ hg up -q root 
+  abort: unknown revision 'root'
+  [10]
+
+  $ commit b
+
+  $ hg pull -q ../repo
+
+  $ cat .hg/cache/branch2-visible
+  222ae9789a75703f9836e44de7db179cbfd420ee 2
+  a3498d6e39376d2456425dd8c692367bdbf00fa2 o default
+  222ae9789a75703f9836e44de7db179cbfd420ee o default
+
+  $ hg_log
+  o  2:222ae9789a75
+  |
+  | @  1:a3498d6e3937
+  |/
+  o  0:7ab0a3bd758a
+  
+
+  $ strip '1:'
+
+The branchmap cache is not adjusted on strip.
+Now mentions a changelog entry that has been stripped.
+
+  $ cat .hg/cache/branch2-visible
+  222ae9789a75703f9836e44de7db179cbfd420ee 2
+  a3498d6e39376d2456425dd8c692367bdbf00fa2 o default
+  222ae9789a75703f9836e44de7db179cbfd420ee o default
+
+  $ commit c
+
+Not adjusted on commit, either.
+
+  $ cat .hg/cache/branch2-visible
+  222ae9789a75703f9836e44de7db179cbfd420ee 2
+  a3498d6e39376d2456425dd8c692367bdbf00fa2 o default
+  222ae9789a75703f9836e44de7db179cbfd420ee o default
+
+On pull we end up with the same tip, and so wrongly reuse the invalid cache 
and crash.
+
+  $ hg pull ../repo 2>&1 | grep 'ValueError:'
+  ValueError: node a3498d6e39376d2456425dd8c692367bdbf00fa2 does not exist



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


D12548: changelog: avoid copying changeset data into `ChangesetRevisionData`

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/changelog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/changelog.rs 
b/rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs
+++ b/rust/hg-core/src/revlog/changelog.rs
@@ -7,6 +7,7 @@
 use crate::utils::hg_path::HgPath;
 use itertools::Itertools;
 use std::ascii::escape_default;
+use std::borrow::Cow;
 use std::fmt::{Debug, Formatter};
 
 /// A specialized `Revlog` to work with `changelog` data format.
@@ -52,7 +53,7 @@
 ,
 rev: Revision,
 ) -> Result {
-let bytes = self.revlog.get_rev_data(rev)?.into_owned();
+let bytes = self.revlog.get_rev_data(rev)?;
 if bytes.is_empty() {
 Ok(ChangelogRevisionData::null())
 } else {
@@ -79,9 +80,9 @@
 
 /// `Changelog` entry which knows how to interpret the `changelog` data bytes.
 #[derive(PartialEq)]
-pub struct ChangelogRevisionData {
+pub struct ChangelogRevisionData<'changelog> {
 /// The data bytes of the `changelog` entry.
-bytes: Vec,
+bytes: Cow<'changelog, [u8]>,
 /// The end offset for the hex manifest (not including the newline)
 manifest_end: usize,
 /// The end offset for the user+email (not including the newline)
@@ -93,8 +94,8 @@
 files_end: usize,
 }
 
-impl ChangelogRevisionData {
-fn new(bytes: Vec) -> Result {
+impl<'changelog> ChangelogRevisionData<'changelog> {
+fn new(bytes: Cow<'changelog, [u8]>) -> Result {
 let mut line_iter = bytes.split(|b| b == '\n');
 let manifest_end = line_iter
 .next()
@@ -137,9 +138,9 @@
 }
 
 fn null() -> Self {
-Self::new(
-b"\n\n0 0\n\n".to_vec(),
-)
+Self::new(Cow::Borrowed(
+b"\n\n0 0\n\n",
+))
 .unwrap()
 }
 
@@ -181,7 +182,7 @@
 }
 }
 
-impl Debug for ChangelogRevisionData {
+impl Debug for ChangelogRevisionData<'_> {
 fn fmt(, f:  Formatter<'_>) -> std::fmt::Result {
 f.debug_struct("ChangelogRevisionData")
 .field("bytes", _bytes())
@@ -228,28 +229,30 @@
 #[test]
 fn test_create_changelogrevisiondata_invalid() {
 // Completely empty
-assert!(ChangelogRevisionData::new(b"abcd".to_vec()).is_err());
+assert!(ChangelogRevisionData::new(Cow::Borrowed(b"abcd")).is_err());
 // No newline after manifest
-assert!(ChangelogRevisionData::new(b"abcd".to_vec()).is_err());
+assert!(ChangelogRevisionData::new(Cow::Borrowed(b"abcd")).is_err());
 // No newline after user
-assert!(ChangelogRevisionData::new(b"abcd\n".to_vec()).is_err());
+assert!(ChangelogRevisionData::new(Cow::Borrowed(b"abcd\n")).is_err());
 // No newline after timestamp
-assert!(ChangelogRevisionData::new(b"abcd\n\n0 0".to_vec()).is_err());
+assert!(
+ChangelogRevisionData::new(Cow::Borrowed(b"abcd\n\n0 0")).is_err()
+);
 // Missing newline after files
-assert!(ChangelogRevisionData::new(
-b"abcd\n\n0 0\nfile1\nfile2".to_vec()
-)
+assert!(ChangelogRevisionData::new(Cow::Borrowed(
+b"abcd\n\n0 0\nfile1\nfile2"
+))
 .is_err(),);
 // Only one newline after files
-assert!(ChangelogRevisionData::new(
-b"abcd\n\n0 0\nfile1\nfile2\n".to_vec()
-)
+assert!(ChangelogRevisionData::new(Cow::Borrowed(
+b"abcd\n\n0 0\nfile1\nfile2\n"
+))
 .is_err(),);
 }
 
 #[test]
 fn test_create_changelogrevisiondata() {
-let data = ChangelogRevisionData::new(
+let data = ChangelogRevisionData::new(Cow::Borrowed(
 b"0123456789abcdef0123456789abcdef01234567
 Some One 
 0 0
@@ -258,9 +261,8 @@
 
 some
 commit
-message"
-.to_vec(),
-)
+message",
+))
 .unwrap();
 assert_eq!(
 data.manifest_node().unwrap(),



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


D12547: rust-revlog: make unaware of `Repo`

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/operations/debugdata.rs
  rust/hg-core/src/revlog/changelog.rs
  rust/hg-core/src/revlog/filelog.rs
  rust/hg-core/src/revlog/manifest.rs
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/revlog.rs 
b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -16,8 +16,8 @@
 use super::nodemap_docket::NodeMapDocket;
 use super::patch;
 use crate::errors::HgError;
-use crate::repo::Repo;
 use crate::revlog::Revision;
+use crate::vfs::Vfs;
 use crate::{Node, NULL_REVISION};
 
 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
@@ -81,14 +81,14 @@
 /// interleaved.
 #[timed]
 pub fn open(
-repo: ,
+store_vfs: ,
 index_path: impl AsRef,
 data_path: Option<>,
 use_nodemap: bool,
 ) -> Result {
 let index_path = index_path.as_ref();
 let index = {
-match repo.store_vfs().mmap_open_opt(_path)? {
+match store_vfs.mmap_open_opt(_path)? {
 None => Index::new(Box::new(vec![])),
 Some(index_mmap) => {
 let index = Index::new(Box::new(index_mmap))?;
@@ -106,7 +106,7 @@
 None
 } else {
 let data_path = data_path.unwrap_or(_data_path);
-let data_mmap = repo.store_vfs().mmap_open(data_path)?;
+let data_mmap = store_vfs.mmap_open(data_path)?;
 Some(Box::new(data_mmap))
 };
 
@@ -115,7 +115,7 @@
 } else if !use_nodemap {
 None
 } else {
-NodeMapDocket::read_from_file(_vfs(), index_path)?.map(
+NodeMapDocket::read_from_file(store_vfs, index_path)?.map(
 |(docket, data)| {
 nodemap::NodeTree::load_bytes(
 Box::new(data),
diff --git a/rust/hg-core/src/revlog/manifest.rs 
b/rust/hg-core/src/revlog/manifest.rs
--- a/rust/hg-core/src/revlog/manifest.rs
+++ b/rust/hg-core/src/revlog/manifest.rs
@@ -19,7 +19,12 @@
 let use_nodemap = repo
 .requirements()
 .contains(requirements::NODEMAP_REQUIREMENT);
-let revlog = Revlog::open(repo, "00manifest.i", None, use_nodemap)?;
+let revlog = Revlog::open(
+_vfs(),
+"00manifest.i",
+None,
+use_nodemap,
+)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/revlog/filelog.rs 
b/rust/hg-core/src/revlog/filelog.rs
--- a/rust/hg-core/src/revlog/filelog.rs
+++ b/rust/hg-core/src/revlog/filelog.rs
@@ -24,8 +24,12 @@
 let use_nodemap = repo
 .requirements()
 .contains(requirements::NODEMAP_REQUIREMENT);
-let revlog =
-Revlog::open(repo, index_path, Some(_path), use_nodemap)?;
+let revlog = Revlog::open(
+_vfs(),
+index_path,
+Some(_path),
+use_nodemap,
+)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/revlog/changelog.rs 
b/rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs
+++ b/rust/hg-core/src/revlog/changelog.rs
@@ -21,7 +21,12 @@
 let use_nodemap = repo
 .requirements()
 .contains(requirements::NODEMAP_REQUIREMENT);
-let revlog = Revlog::open(repo, "00changelog.i", None, use_nodemap)?;
+let revlog = Revlog::open(
+_vfs(),
+"00changelog.i",
+None,
+use_nodemap,
+)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/operations/debugdata.rs 
b/rust/hg-core/src/operations/debugdata.rs
--- a/rust/hg-core/src/operations/debugdata.rs
+++ b/rust/hg-core/src/operations/debugdata.rs
@@ -29,7 +29,8 @@
 let use_nodemap = repo
 .requirements()
 .contains(requirements::NODEMAP_REQUIREMENT);
-let revlog = Revlog::open(repo, index_file, None, use_nodemap)?;
+let revlog =
+Revlog::open(_vfs(), index_file, None, use_nodemap)?;
 let rev =
 crate::revset::resolve_rev_number_or_hex_prefix(revset, )?;
 let data = revlog.get_rev_data(rev)?;



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


D12546: rust-revlog: move check for nodemap requirement to caller

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's good for both making `Revlog` testable and reusable to have it
  not depend on the higher-level `Repo` type. This patch is one step in
  towards that. Additionally, this change in particular gives the
  callers more control over when to use a nodemap.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/operations/debugdata.rs
  rust/hg-core/src/revlog/changelog.rs
  rust/hg-core/src/revlog/filelog.rs
  rust/hg-core/src/revlog/manifest.rs
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/revlog.rs 
b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -18,7 +18,7 @@
 use crate::errors::HgError;
 use crate::repo::Repo;
 use crate::revlog::Revision;
-use crate::{requirements, Node, NULL_REVISION};
+use crate::{Node, NULL_REVISION};
 
 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
 const REVISION_FLAG_ELLIPSIS: u16 = 1 << 14;
@@ -84,6 +84,7 @@
 repo: ,
 index_path: impl AsRef,
 data_path: Option<>,
+use_nodemap: bool,
 ) -> Result {
 let index_path = index_path.as_ref();
 let index = {
@@ -111,11 +112,7 @@
 
 let nodemap = if index.is_inline() {
 None
-} else if !repo
-.requirements()
-.contains(requirements::NODEMAP_REQUIREMENT)
-{
-// If .hg/requires does not opt it, don’t try to open a nodemap
+} else if !use_nodemap {
 None
 } else {
 NodeMapDocket::read_from_file(_vfs(), index_path)?.map(
diff --git a/rust/hg-core/src/revlog/manifest.rs 
b/rust/hg-core/src/revlog/manifest.rs
--- a/rust/hg-core/src/revlog/manifest.rs
+++ b/rust/hg-core/src/revlog/manifest.rs
@@ -1,5 +1,6 @@
 use crate::errors::HgError;
 use crate::repo::Repo;
+use crate::requirements;
 use crate::revlog::revlog::{Revlog, RevlogError};
 use crate::revlog::Revision;
 use crate::revlog::{Node, NodePrefix};
@@ -15,7 +16,10 @@
 impl Manifestlog {
 /// Open the `manifest` of a repository given by its root.
 pub fn open(repo: ) -> Result {
-let revlog = Revlog::open(repo, "00manifest.i", None)?;
+let use_nodemap = repo
+.requirements()
+.contains(requirements::NODEMAP_REQUIREMENT);
+let revlog = Revlog::open(repo, "00manifest.i", None, use_nodemap)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/revlog/filelog.rs 
b/rust/hg-core/src/revlog/filelog.rs
--- a/rust/hg-core/src/revlog/filelog.rs
+++ b/rust/hg-core/src/revlog/filelog.rs
@@ -1,5 +1,6 @@
 use crate::errors::HgError;
 use crate::repo::Repo;
+use crate::requirements;
 use crate::revlog::path_encode::path_encode;
 use crate::revlog::revlog::RevlogEntry;
 use crate::revlog::revlog::{Revlog, RevlogError};
@@ -20,7 +21,11 @@
 pub fn open(repo: , file_path: ) -> Result {
 let index_path = store_path(file_path, b".i");
 let data_path = store_path(file_path, b".d");
-let revlog = Revlog::open(repo, index_path, Some(_path))?;
+let use_nodemap = repo
+.requirements()
+.contains(requirements::NODEMAP_REQUIREMENT);
+let revlog =
+Revlog::open(repo, index_path, Some(_path), use_nodemap)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/revlog/changelog.rs 
b/rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs
+++ b/rust/hg-core/src/revlog/changelog.rs
@@ -1,5 +1,6 @@
 use crate::errors::HgError;
 use crate::repo::Repo;
+use crate::requirements;
 use crate::revlog::revlog::{Revlog, RevlogError};
 use crate::revlog::Revision;
 use crate::revlog::{Node, NodePrefix};
@@ -17,7 +18,10 @@
 impl Changelog {
 /// Open the `changelog` of a repository given by its root.
 pub fn open(repo: ) -> Result {
-let revlog = Revlog::open(repo, "00changelog.i", None)?;
+let use_nodemap = repo
+.requirements()
+.contains(requirements::NODEMAP_REQUIREMENT);
+let revlog = Revlog::open(repo, "00changelog.i", None, use_nodemap)?;
 Ok(Self { revlog })
 }
 
diff --git a/rust/hg-core/src/operations/debugdata.rs 
b/rust/hg-core/src/operations/debugdata.rs
--- a/rust/hg-core/src/operations/debugdata.rs
+++ b/rust/hg-core/src/operations/debugdata.rs
@@ -6,6 +6,7 @@
 // GNU General Public License version 2 or any later version.
 
 use crate::repo::Repo;
+use crate::requirements;
 use crate::revlog::revlog::{Revlog, RevlogError};
 
 /// Kind of data to debug
@@ -25,7 +26,10 @@
 DebugDataKind::Changelog => "00changelog.i",
 DebugDataKind::Manifest => "00manifest.i",
 };
-let revlog = Revlog::open(repo, index_file, None)?;
+let use_nodemap = repo
+

D12545: rust-nodemap-docket: make unaware of `Repo`

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/nodemap_docket.rs
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/revlog.rs 
b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -118,7 +118,7 @@
 // If .hg/requires does not opt it, don’t try to open a nodemap
 None
 } else {
-NodeMapDocket::read_from_file(repo, index_path)?.map(
+NodeMapDocket::read_from_file(_vfs(), index_path)?.map(
 |(docket, data)| {
 nodemap::NodeTree::load_bytes(
 Box::new(data),
diff --git a/rust/hg-core/src/revlog/nodemap_docket.rs 
b/rust/hg-core/src/revlog/nodemap_docket.rs
--- a/rust/hg-core/src/revlog/nodemap_docket.rs
+++ b/rust/hg-core/src/revlog/nodemap_docket.rs
@@ -3,8 +3,8 @@
 use memmap2::Mmap;
 use std::path::{Path, PathBuf};
 
-use crate::repo::Repo;
 use crate::utils::strip_suffix;
+use crate::vfs::Vfs;
 
 const ONDISK_VERSION: u8 = 1;
 
@@ -34,12 +34,12 @@
 /// * The docket file points to a missing (likely deleted) data file (this
 ///   can happen in a rare race condition).
 pub fn read_from_file(
-repo: ,
+store_vfs: ,
 index_path: ,
 ) -> Result, HgError> {
 let docket_path = index_path.with_extension("n");
 let docket_bytes = if let Some(bytes) =
-repo.store_vfs().read(_path).io_not_found_as_none()?
+store_vfs.read(_path).io_not_found_as_none()?
 {
 bytes
 } else {
@@ -75,10 +75,8 @@
 let data_path = rawdata_path(_path, uid);
 // TODO: use `vfs.read()` here when the `persistent-nodemap.mmap`
 // config is false?
-if let Some(mmap) = repo
-.store_vfs()
-.mmap_open(_path)
-.io_not_found_as_none()?
+if let Some(mmap) =
+store_vfs.mmap_open(_path).io_not_found_as_none()?
 {
 if mmap.len() >= data_length {
 Ok(Some((docket, mmap)))



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


D12544: rust-nodemap-docket: move check of nodemap requirement to caller

2022-04-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I think it's cleaner if `NodeMapDocket` doesn't know about the `Repo`
  type. That makes it more easily reusable and testable. This patch
  moves out one of the uses of `Repo` out of it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/nodemap_docket.rs
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/revlog.rs 
b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -18,7 +18,7 @@
 use crate::errors::HgError;
 use crate::repo::Repo;
 use crate::revlog::Revision;
-use crate::{Node, NULL_REVISION};
+use crate::{requirements, Node, NULL_REVISION};
 
 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
 const REVISION_FLAG_ELLIPSIS: u16 = 1 << 14;
@@ -111,6 +111,12 @@
 
 let nodemap = if index.is_inline() {
 None
+} else if !repo
+.requirements()
+.contains(requirements::NODEMAP_REQUIREMENT)
+{
+// If .hg/requires does not opt it, don’t try to open a nodemap
+None
 } else {
 NodeMapDocket::read_from_file(repo, index_path)?.map(
 |(docket, data)| {
diff --git a/rust/hg-core/src/revlog/nodemap_docket.rs 
b/rust/hg-core/src/revlog/nodemap_docket.rs
--- a/rust/hg-core/src/revlog/nodemap_docket.rs
+++ b/rust/hg-core/src/revlog/nodemap_docket.rs
@@ -1,5 +1,4 @@
 use crate::errors::{HgError, HgResultExt};
-use crate::requirements;
 use bytes_cast::{unaligned, BytesCast};
 use memmap2::Mmap;
 use std::path::{Path, PathBuf};
@@ -38,14 +37,6 @@
 repo: ,
 index_path: ,
 ) -> Result, HgError> {
-if !repo
-.requirements()
-.contains(requirements::NODEMAP_REQUIREMENT)
-{
-// If .hg/requires does not opt it, don’t try to open a nodemap
-return Ok(None);
-}
-
 let docket_path = index_path.with_extension("n");
 let docket_bytes = if let Some(bytes) =
 repo.store_vfs().read(_path).io_not_found_as_none()?



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


mercurial-devel | Failed pipeline for branch/default | 5d205e47

2022-04-13 Thread Heptapod


Pipeline #53171 has failed!

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

Commit: 5d205e47 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/5d205e476057453e6ccd07088872b147a222e295
 )
Commit Message: rust-revlog: add methods for getting parent rev...
Commit Author: Martin von Zweigbergk ( https://foss.heptapod.net/martinvonz )

Pipeline #53171 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/53171 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

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

Stage: tests
Name: test-pure

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



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