Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, 16 Oct 2017 22:40:21 -0400, Matt Harbison wrote: > On Mon, 16 Oct 2017 10:36:22 -0400, Yuya Nishiharawrote: > > On Mon, 16 Oct 2017 09:21:24 -0400, Matt Harbison wrote: > >> +shared = hg.share(self._repo._subparent.baseui, > >> + other, self._repo.root, > >> + update=False, bookmarks=False) > > > > Perhaps bookmarks option should follow the parentrepo's, but that can be > > addressed later. > > I wondered about that. But since the subrepo update may be deferred, and > I don't think the -B for the original share command is preserved, I wasn't > sure how. (I don't think we can infer that -B was used, just because > there are bookmarks, right?) It's stored in .hg/shared file. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Tue, 17 Oct 2017 00:20:38 -0400, Matt Harbisonwrote: On Mon, 16 Oct 2017 10:00:32 -0400, Pulkit Goyal <7895pul...@gmail.com> wrote: On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbison wrote: # HG changeset patch # User Matt Harbison # Date 1508122082 14400 # Sun Oct 15 22:48:02 2017 -0400 # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) Can you please add a releasenotes part to the commit message? For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension I took a run at it (probably not successfully- the command aborts, but check-code didn't complain). $ hg --config extensions.releasenotes= releasenotes -r . rn.txt abort: unexpected block in release notes directive fix This went away after putting the 'and' line between the two annotations like Augie did in one of his commits. That's pretty subtle- it would be nice if that requirement went away somehow. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, 16 Oct 2017 10:00:32 -0400, Pulkit Goyal <7895pul...@gmail.com> wrote: On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbisonwrote: # HG changeset patch # User Matt Harbison # Date 1508122082 14400 # Sun Oct 15 22:48:02 2017 -0400 # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) Can you please add a releasenotes part to the commit message? For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension I took a run at it (probably not successfully- the command aborts, but check-code didn't complain). $ hg --config extensions.releasenotes= releasenotes -r . rn.txt abort: unexpected block in release notes directive fix Is there any way to get the location of the error? (I know nothing about this format, so I'm not sure where to start.) In trying to reproduce this on a revision that's not mine (and in fact doesn't have an annotation), I got this: $ hg --config extensions.releasenotes= releasenotes -r cfb054a7ecc4 rn.txt ** Unknown exception encountered with possibly-broken third-party extension evolve ** which supports versions 4.2 of Mercurial. ** Please disable evolve and try your action again. ** If that fixes the bug please report it to https://bz.mercurial-scm.org/ ** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] ** Mercurial Distributed SCM (version 4.3-rc+4-ac3477dc1814) ** Extensions loaded: eol, rebase, convert, graphlog, patchbomb, extdiff, strip, mq, evolve, releasenotes Traceback (most recent call last): File "hg", line 45, in File "mercurial\dispatch.pyc", line 81, in run File "mercurial\dispatch.pyc", line 162, in dispatch File "mercurial\dispatch.pyc", line 302, in _runcatch File "mercurial\dispatch.pyc", line 310, in _callcatch File "mercurial\scmutil.pyc", line 150, in callcatch File "mercurial\dispatch.pyc", line 292, in _runcatchfunc File "mercurial\dispatch.pyc", line 895, in _dispatch File "mercurial\dispatch.pyc", line 658, in runcommand File "mercurial\dispatch.pyc", line 903, in _runcommand File "mercurial\dispatch.pyc", line 892, in File "mercurial\util.pyc", line 1069, in check File "mercurial\extensions.pyc", line 322, in closure File "mercurial\util.pyc", line 1069, in check File "hgext\mq.pyc", line 3542, in mqcommand File "mercurial\util.pyc", line 1069, in check File "hgext\releasenotes.pyc", line 440, in releasenotes File "hgext\releasenotes.pyc", line 339, in serializenotes IndexError: list index out of range ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, 16 Oct 2017 10:36:22 -0400, Yuya Nishiharawrote: On Mon, 16 Oct 2017 09:21:24 -0400, Matt Harbison wrote: # HG changeset patch # User Matt Harbison # Date 1508122082 14400 # Sun Oct 15 22:48:02 2017 -0400 # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) Generally looks good to me, but a few questions. --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -255,6 +255,7 @@ r = repository(ui, destwvfs.base) postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath) _postshareupdate(r, update, checkout=checkout) +return r def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): """Called after a new shared repo is created. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -857,28 +857,40 @@ def _get(self, state): source, revision, kind = state +parentrepo = self._repo._subparent + if revision in self._repo.unfiltered(): -return True +# Allow shared subrepos tracked at null to setup the sharedpath +if revision != node.nullhex or not parentrepo.shared(): 'revisions != node.nullhex' looks a bit tricky, which seemed to assume a certain sequence how the current subrepo clone works under the hood. Can we check 'len(self._repo) != 0' instead? It looks like it. +return True self._repo._subsource = source srcurl = _abssource(self._repo) other = hg.peer(self._repo, {}, srcurl) if len(self._repo) == 0: -self.ui.status(_('cloning subrepo %s from %s\n') - % (subrelpath(self), srcurl)) -parentrepo = self._repo._subparent # use self._repo.vfs instead of self.wvfs to remove .hg only self._repo.vfs.rmtree() -other, cloned = hg.clone(self._repo._subparent.baseui, {}, - other, self._repo.root, - update=False) -self._repo = cloned.local() +if parentrepo.shared(): +self.ui.status(_('sharing subrepo %s from %s\n') + % (subrelpath(self), srcurl)) +shared = hg.share(self._repo._subparent.baseui, + other, self._repo.root, + update=False, bookmarks=False) Perhaps bookmarks option should follow the parentrepo's, but that can be addressed later. I wondered about that. But since the subrepo update may be deferred, and I don't think the -B for the original share command is preserved, I wasn't sure how. (I don't think we can infer that -B was used, just because there are bookmarks, right?) +self._repo = shared.local() +else: +self.ui.status(_('cloning subrepo %s from %s\n') + % (subrelpath(self), srcurl)) +other, cloned = hg.clone(self._repo._subparent.baseui, {}, + other, self._repo.root, + update=False) +self._repo = cloned.local() self._initrepo(parentrepo, source, create=True) self._cachestorehash(srcurl) else: -self.ui.status(_('pulling subrepo %s from %s\n') - % (subrelpath(self), srcurl)) cleansub = self.storeclean(srcurl) -exchange.pull(self._repo, other) +if not parentrepo.shared(): self._repo.shared() seems better since self._repo could be an existing unshared repo. I dropped this whole section. Originally I was thinking that you never pull on update with a share. But that aspect should be handled by the 'revision in self._repo' check at the top. You can `hg -R share pull some_other_clone`, so I think the pull code needs to stay. (Though I failed to adapt the test to show this making a difference.) +self.ui.status(_('pulling subrepo %s from %s\n') + % (subrelpath(self), srcurl)) +exchange.pull(self._repo, other) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, Oct 16, 2017 at 07:30:32PM +0530, Pulkit Goyal wrote: > On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbisonwrote: > > # HG changeset patch > > # User Matt Harbison > > # Date 1508122082 14400 > > # Sun Oct 15 22:48:02 2017 -0400 > > # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 > > # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 > > subrepo: share instead of clone if the parent repo is shared (issue5675) > > (BC) > > Can you please add a releasenotes part to the commit message? > For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension +1 - that'll make my life much easier on Wednesday! > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, 16 Oct 2017 09:21:24 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1508122082 14400 > # Sun Oct 15 22:48:02 2017 -0400 > # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 > # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 > subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) Generally looks good to me, but a few questions. > --- a/mercurial/hg.py > +++ b/mercurial/hg.py > @@ -255,6 +255,7 @@ > r = repository(ui, destwvfs.base) > postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath) > _postshareupdate(r, update, checkout=checkout) > +return r > > def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): > """Called after a new shared repo is created. > diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py > --- a/mercurial/subrepo.py > +++ b/mercurial/subrepo.py > @@ -857,28 +857,40 @@ > > def _get(self, state): > source, revision, kind = state > +parentrepo = self._repo._subparent > + > if revision in self._repo.unfiltered(): > -return True > +# Allow shared subrepos tracked at null to setup the sharedpath > +if revision != node.nullhex or not parentrepo.shared(): 'revisions != node.nullhex' looks a bit tricky, which seemed to assume a certain sequence how the current subrepo clone works under the hood. Can we check 'len(self._repo) != 0' instead? > +return True > self._repo._subsource = source > srcurl = _abssource(self._repo) > other = hg.peer(self._repo, {}, srcurl) > if len(self._repo) == 0: > -self.ui.status(_('cloning subrepo %s from %s\n') > - % (subrelpath(self), srcurl)) > -parentrepo = self._repo._subparent > # use self._repo.vfs instead of self.wvfs to remove .hg only > self._repo.vfs.rmtree() > -other, cloned = hg.clone(self._repo._subparent.baseui, {}, > - other, self._repo.root, > - update=False) > -self._repo = cloned.local() > +if parentrepo.shared(): > +self.ui.status(_('sharing subrepo %s from %s\n') > + % (subrelpath(self), srcurl)) > +shared = hg.share(self._repo._subparent.baseui, > + other, self._repo.root, > + update=False, bookmarks=False) Perhaps bookmarks option should follow the parentrepo's, but that can be addressed later. > +self._repo = shared.local() > +else: > +self.ui.status(_('cloning subrepo %s from %s\n') > + % (subrelpath(self), srcurl)) > +other, cloned = hg.clone(self._repo._subparent.baseui, {}, > + other, self._repo.root, > + update=False) > +self._repo = cloned.local() > self._initrepo(parentrepo, source, create=True) > self._cachestorehash(srcurl) > else: > -self.ui.status(_('pulling subrepo %s from %s\n') > - % (subrelpath(self), srcurl)) > cleansub = self.storeclean(srcurl) > -exchange.pull(self._repo, other) > +if not parentrepo.shared(): self._repo.shared() seems better since self._repo could be an existing unshared repo. > +self.ui.status(_('pulling subrepo %s from %s\n') > + % (subrelpath(self), srcurl)) > +exchange.pull(self._repo, other) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbisonwrote: > # HG changeset patch > # User Matt Harbison > # Date 1508122082 14400 > # Sun Oct 15 22:48:02 2017 -0400 > # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522 > # Parent 718adb1bf3a9a1ee509a803c7512c14296a1db79 > subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) Can you please add a releasenotes part to the commit message? For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel