[PATCH 1 of 1] ignore subrepo existance check fails when absent path out of repo-sparse

14 views
Skip to first unread message

alexrayne

unread,
May 8, 2021, 8:51:13 AM5/8/21
to thg...@googlegroups.com
# HG changeset patch
# User alexrayne <alexray...@gmail.com>
# Date 1620478030 -10800
# Sat May 08 15:47:10 2021 +0300
# Branch work/alexrayne
# Node ID 67b0f4a904608fcbe6abb584f3eb44469023248f
# Parent 20f6881fe13ea4ab0794a2f892dd4637edfd9a01
ignore subrepo existance check fails when absent path out of repo-sparse.

* thg check subepos existance in repo folders, and worn and aborts import them on first
sub-repo that absent. If we use repo-sparse, many subrepos may be out of sparse - user
declares that them are not meaningful. So, it essential to ignore them.

diff --git a/tortoisehg/hgqt/repotreeitem.py b/tortoisehg/hgqt/repotreeitem.py
--- a/tortoisehg/hgqt/repotreeitem.py
+++ b/tortoisehg/hgqt/repotreeitem.py
@@ -25,6 +25,7 @@
node,
pycompat,
util,
+ sparse,
)

from ..util import (
@@ -386,11 +387,16 @@
self._sharedpath = hglib.tounicode(repo.sharedpath)
wctx = repo[b'.']
sortkey = lambda x: os.path.basename(util.normpath(repo.wjoin(x)))
+ sparsematch = sparse.matcher(wctx.repo(), revs=[ wctx.rev() ])
for subpath in sorted(wctx.substate, key=sortkey):
sri = None
abssubpath = repo.wjoin(subpath)
subtype = pycompat.sysstr(wctx.substate[subpath][2])
sriIsValid = os.path.isdir(abssubpath)
+ if not sriIsValid:
+ if not sparsematch(subpath):
+ # ignore failed subrepo, that out of sparse
+ continue
sri = _newSubrepoItem(hglib.tounicode(abssubpath),
repotype=subtype)
sri._valid = sriIsValid
thg.work.patch

alexrayne

unread,
May 8, 2021, 8:51:13 AM5/8/21
to thg...@googlegroups.com
Hallow here provided patch preventing thg loading repo failure on absent subrepos, that out of repo sparse.

This just drops subrepos, that out of sparse, and absent - so they get out of subs list.

Matt Harbison

unread,
May 8, 2021, 2:00:51 PM5/8/21
to TortoiseHg Developers
I don't know a lot about sparse, but I wonder if Mercurial should be patched to filter out the .hgsubstate entries that aren't part of the checked out tree.  There are probably a bunch of places in both hg and thg that read .hgsubstate and process the entries, so a lot of places to fix if not handled in Mercurial itself.

Александр Литягин

unread,
May 8, 2021, 2:21:58 PM5/8/21
to 'IRPAN Paulus' via TortoiseHg Developers
yep, i've propose patch to hg for this, dont imagine - is developers look at it.
as for thg - patched place looks as a trick, to avoid bugs with absent subrepo in thg.
it not use native hg subrepo api, to check state of subrepo, but just brutal check dir existance.
as for me, it have tested with trivial case, and looks fine. looks need some test-suites for more complex cases.

сб, 8 мая 2021 г., 21:00 'Matt Harbison' via TortoiseHg Developers <thg...@googlegroups.com>:
--
You received this message because you are subscribed to the Google Groups "TortoiseHg Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thg-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thg-dev/bf7db6ef-dee1-419c-afe0-76d89dc21439n%40googlegroups.com.

Matt Harbison

unread,
May 8, 2021, 2:49:04 PM5/8/21
to TortoiseHg Developers
Can you point me where on the Mercurial mailing list you've posted a patch for this?  I don't see it in phabricator and I don't recall seeing it on the mailing list, though I may have missed it.

Александр Литягин

unread,
May 9, 2021, 12:58:51 AM5/9/21
to 'IRPAN Paulus' via TortoiseHg Developers
try look here https://bz.mercurial-scm.org/show_bug.cgi?id=6508

as for subject thg patch - i guess it not depends/demand hg patching. 
current behaviour quite brutual - if repo have some absent subs, it breaks load subs list on this first absent. there we have a list of subs in repo-tree, with last entry of absent sub. and other subs, that not luky, goes after missed one - they are just drops.
So, looks now thg work well besides contents of repo-tree subs - it can miss any subs, and even contain absent one. 
this patch just gives a bit more tolerance for loading - absent sub out of sparse not blocks loading other subs.

imho, this filtering process may be make more stronger with just ignore all absent subs, and not breaking loading them on a first absent - loads all subs list. why loading process breaks on first absent - i not imagine.

сб, 8 мая 2021 г., 21:49 'Matt Harbison' via TortoiseHg Developers <thg...@googlegroups.com>:

Matt Harbison

unread,
May 9, 2021, 1:07:39 PM5/9/21
to TortoiseHg Developers
On Sunday, May 9, 2021 at 12:58:51 AM UTC-4 alexray...@gmail.com wrote:

Can you post that to phabricator or email it to mercuri...@mercurial-scm.org?  You're correct- nobody looks on bugzilla for patches because there's a wider audience on the mailing list.

Александр Литягин

unread,
May 9, 2021, 1:13:53 PM5/9/21
to 'IRPAN Paulus' via TortoiseHg Developers
>>You're correct- nobody looks on bugzilla for patches because there's a wider audience on the mailing list.

it's a mercurial disaster. mailing list - closed internal comuniti. bugzilla - interface to wide world. if this portal not used, mercurial cimunity comes to self-isolation.



вс, 9 мая 2021 г., 20:07 'Matt Harbison' via TortoiseHg Developers <thg...@googlegroups.com>:

On Sunday, May 9, 2021 at 12:58:51 AM UTC-4 alexray...@gmail.com wrote:

Can you post that to phabricator or email it to mercuri...@mercurial-scm.org?  You're correct- nobody looks on bugzilla for patches because there's a wider audience on the mailing list.

--
You received this message because you are subscribed to the Google Groups "TortoiseHg Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thg-dev+u...@googlegroups.com.

Александр Литягин

unread,
May 13, 2021, 1:41:12 PM5/13/21
to thg...@googlegroups.com
Well, Matt, i've try to post a patch to mercurial devel email, and they answer :
> Message rejected by filter rule match


09.05.2021 20:07, 'Matt Harbison' via TortoiseHg Developers пишет:

On Sunday, May 9, 2021 at 12:58:51 AM UTC-4 alexray...@gmail.com wrote:

Can you post that to phabricator or email it to mercuri...@mercurial-scm.org?  You're correct- nobody looks on bugzilla for patches because there's a wider audience on the mailing list.

--
You received this message because you are subscribed to the Google Groups "TortoiseHg Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thg-dev+u...@googlegroups.com.

Matt Harbison

unread,
May 13, 2021, 8:19:40 PM5/13/21
to TortoiseHg Developers
It made it through:


What was apparently rejected was the 0 of N message- anything you say in there should be in a commit comment instead so it doesn't get lost.
Reply all
Reply to author
Forward
0 new messages