D4934: narrow: don't compress the bundle2 when sending 'error:abort'
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb9a07a58b44d: narrow: dont compress the bundle2 when sending error:abort (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4934?vs=11794=11801 REVISION DETAIL https://phab.mercurial-scm.org/D4934 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -57,6 +57,7 @@ ellipses: whether to send ellipses data or not """ +preferuncompressed = False try: oldincludes = wireprototypes.decodelist(oldincludes) newincludes = wireprototypes.decodelist(newincludes) @@ -92,9 +93,11 @@ if exc.hint is not None: advargs.append(('hint', exc.hint)) bundler.addpart(bundle2.bundlepart('error:abort', manargs, advargs)) +preferuncompressed = True chunks = bundler.getchunks() -return wireprototypes.streamres(gen=chunks) +return wireprototypes.streamres(gen=chunks, +prefer_uncompressed=preferuncompressed) def peernarrowwiden(remote, **kwargs): for ch in ('oldincludes', 'newincludes', 'oldexcludes', 'newexcludes', To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4933: push:Added keyword remote to 'repository changed while pushing' error(Issue5971)(whitespaces fixed)
pulkit added a comment. @timeless suggested using the word 'destination' instead of 'remote'. I feel like destination is a better word. How do others feel? @taapas1128 no need to update the patch right now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4933 To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4934: narrow: don't compress the bundle2 when sending 'error:abort'
pulkit 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 This is similar to waht getbundle() does and also explicitly specifies that we should get a compressed bundle2 in normal cases when not sending 'error:abort'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4934 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -57,6 +57,7 @@ ellipses: whether to send ellipses data or not """ +preferuncompressed = False try: oldincludes = wireprototypes.decodelist(oldincludes) newincludes = wireprototypes.decodelist(newincludes) @@ -92,9 +93,11 @@ if exc.hint is not None: advargs.append(('hint', exc.hint)) bundler.addpart(bundle2.bundlepart('error:abort', manargs, advargs)) +preferuncompressed = True chunks = bundler.getchunks() -return wireprototypes.streamres(gen=chunks) +return wireprototypes.streamres(gen=chunks, +prefer_uncompressed=preferuncompressed) def peernarrowwiden(remote, **kwargs): for ch in ('oldincludes', 'newincludes', 'oldexcludes', 'newexcludes', To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4932: push:Added keyword remote to 'repository changed while pushing' error(Issue5971)
pulkit added a comment. Hi Taapas, thanks for taking time and preparing this patch. This patch contains unrelated whitespace changes, can you undo them. There is not much left to do in this patch but still I will be happy to mentor you on this if required. I am pulkit25 on #mercurial on IRC. Feel free to ping me if you need any help. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4932 To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4931: narrow: only send the narrowspecs back if ACL in play
pulkit 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 I am unable to think why we need to send narrowspecs back from the server. The current state adds a 'narrow:spec' part to each changegroup which is generated when narrow extension is enabled. So we are sending narrowspecs on pull also. There is a problem with sending the narrowspecs the way we are doing it right now. We add include and exclude as parameter of the 'narrow:spec' bundle2 part. The the len of include or exclude string increase 255 which is obvious while working on large repos, bundle2 generation code breaks. For more on that refer issue5952 on bugzilla. I was thinking why we need to send the narrowspecs back, and deleted the 'narrow:spec' bundle2 part generation code and found that only narrow-acl test has some failure. With this patch, we will only send the 'narrow:spec' bundle2 part if ACL is enabled because the original narrowspecs in those cases can be a subset of narrowspecs user requested. There are phase related output change in couple of tests. The output change shows that we are now dealing in public phases completely. So maybe sending the narrow:spec bundle2 part was preventing phases being exchanged or phase bundle2 data being applied. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4931 AFFECTED FILES hgext/narrow/narrowbundle2.py mercurial/exchange.py tests/test-narrow-rebase.t tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -137,7 +137,6 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) - 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved diff --git a/tests/test-narrow-rebase.t b/tests/test-narrow-rebase.t --- a/tests/test-narrow-rebase.t +++ b/tests/test-narrow-rebase.t @@ -86,7 +86,6 @@ $ hg update -q 'desc("conflicting outside/f1")' $ hg phase -f -d . - no phases changed $ hg rebase -d 'desc("modify outside/f1")' rebasing 4:707c035aadb6 "conflicting outside/f1" abort: conflict in file 'outside/f1' is outside narrow clone diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -2164,7 +2164,8 @@ if 'treemanifest' in repo.requirements: part.addparam('treemanifest', '1') -if kwargs.get(r'narrow', False) and (include or exclude): +if (kwargs.get(r'narrow', False) and kwargs.get('narrow_acl', False) +and (include or exclude)): narrowspecpart = bundler.newpart('narrow:spec') if include: narrowspecpart.addparam( diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -270,6 +270,7 @@ repo = args[1] if repo.ui.has_section(_NARROWACL_SECTION): kwargs = exchange.applynarrowacl(repo, kwargs) +kwargs['narrow_acl'] = True if (kwargs.get(r'narrow', False) and repo.ui.configbool('experimental', 'narrowservebrokenellipses')): To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4876: amend: add config to skip amend if only date is changed (issue5828)
pulkit added a comment. (Replying because I adviced Zharas to take up this issue and he is a new mercurial user and have less context on the problem) In https://phab.mercurial-scm.org/D4876#74017, @martinvonz wrote: > I'm not sure how I feel about this. I think we talked within the team at Google about always passing a `-D now` and decided not to do it because of the issue you're fixing here (I may be confusing the discussion with one about using `hg metaedit`). Still, I feel like this patch is a workaround for the real problem. I assume that the real problem is that there the date is not normally updated when you amend a commit (i.e. you want to always pass `-D now`, not a specific other timestamp). If that's the problem we're trying address, should we instead introduce a config called something like `amend.updatetimestamp` that makes it update the timestamp to the current time? That would naturally not update the timestamp if the timestamp was the only thing that changed (just like this patch does it). The natural generalization of `amend.updatetimestamp` is something like `rewrite.updatetimestamp` that would be respected by amend, histedit, rebase, etc. > > What do you think? Is that the use case you're trying to address with this patch? I agree that the real problem is amend not updating the timestamp. People have aliased `amend` to `amend -D now` or just like you said, they always pass `-D now`. In such cases, even if the working directory is not changed, we end up creating a new commit with just date change. This patch tries to solve the problem of creating a new commit when only date has changed for people who do `amend -D now` always by preventing that if the config option is turned on. I like your idea of having a config option which is respected by all the commands. That said, will you like to see a v2 of this patch with inline comments addressed or we abandon this idea in favour of proposed config option to change the date. INLINE COMMENTS > martinvonz wrote in configitems.py:440-442 > "amend.dateonly" sounds like it only updates the date. Maybe > "amend.skipdateonly" or "amend.nodateonly"? It doesn't matter much because > we'll need to update it anyway later if we drop the "experimental" label. "amend.skipdateonly" sounds good. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4876 To: Zharaskhan, #hg-reviewers, pulkit Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4901: narrow: move remaining narrow-limited dirstate walks to core
pulkit added a comment. > These places now end up doing an unrestricted dirstate walk after this > patch: > > debugfileset > perfwalk > sparse (but restricted to sparse config) > largefiles > > I'll let anyone who cares about these cases adapt them to work with > narrow if necessary. There is a TODO.rst in hgext/narrow I think it's worth adding this thing there. That will help people to realize that it's a know behavior and a TODO. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4901 To: martinvonz, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4895: RFC: narrow: don't include manifests the client already has
pulkit added inline comments. INLINE COMMENTS > changegroup.py:1056 > > -yield tree, deltas > +if not tree or not self._oldfilematcher.visitdir(store.tree[:-1] > or '.'): > +yield tree, deltas Also, I think this is not the right place to case this because not yielding these deltas will prevent the lookupfn being called and will result in tmfnodes being not updated correctly. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4895 To: martinvonz, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4895: RFC: narrow: don't include manifests the client already has
pulkit added a comment. @martinvonz Thanks a lot for putting time and effort in trying alternate approach. Sadly this does not work. I didn't tested this on our repo yet, but I tested this on test-narrow-widen-no-ellipsis.t. You can also do that, by removing the globs from this line https://www.mercurial-scm.org/repo/hg-committed/file/daff528e00d7/tests/test-narrow-widen-no-ellipsis.t#l116 and seeing the payload before and after the patch. With this patch they don't change, so we are sending the same amount of data before and after this patch. I have mentioned numbers in https://phab.mercurial-scm.org/D4887 description. INLINE COMMENTS > narrowwirepeer.py:96 > > -bundler = bundle2.widen_bundle(repo, diffmatch, common, known, > +bundler = bundle2.widen_bundle(repo, diffmatch, oldmatch, common, > known, > cgversion, ellipses) I swapped diffmatch and oldmatch here while testing because that's how widen_bundle() accepts them REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4895 To: martinvonz, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4893: py3: add 8 new passing tests to whitelist found by buildbot
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdaff528e00d7: py3: add 8 new passing tests to whitelist found by buildbot (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4893?vs=11712=11719 REVISION DETAIL https://phab.mercurial-scm.org/D4893 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -573,6 +573,14 @@ test-websub.t test-win32text.t test-wireproto-clientreactor.py +test-wireproto-command-branchmap.t +test-wireproto-command-changesetdata.t +test-wireproto-command-filedata.t +test-wireproto-command-heads.t +test-wireproto-command-listkeys.t +test-wireproto-command-lookup.t +test-wireproto-command-manifestdata.t +test-wireproto-command-pushkey.t test-wireproto-framing.py test-wireproto-serverreactor.py test-wireproto.py To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4894: py3: use '%f' for floats instead of '%s'
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2e9378f62232: py3: use %f for floats instead of %s (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4894?vs=11713=11718 REVISION DETAIL https://phab.mercurial-scm.org/D4894 AFFECTED FILES mercurial/copies.py CHANGE DETAILS diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -212,7 +212,7 @@ dbg('debug.copies: rename of: %s\n' % ofctx._path) cm[f] = ofctx.path() if debug: -dbg('debug.copies: time: %s seconds\n' +dbg('debug.copies: time: %f seconds\n' % (util.timer() - start)) return cm To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4891: narrow: move adding of narrow server capabilities to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHGad8d8dc9be3f: narrow: move adding of narrow server capabilities to core (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4891?vs=11710=11717 REVISION DETAIL https://phab.mercurial-scm.org/D4891 AFFECTED FILES hgext/narrow/narrowwirepeer.py mercurial/wireprotov1server.py CHANGE DETAILS diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -286,6 +286,11 @@ caps.append('bundle2=' + urlreq.quote(capsblob)) caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) +if repo.ui.configbool('experimental', 'narrow'): +caps.append(wireprototypes.NARROWCAP) +if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): +caps.append(wireprototypes.ELLIPSESCAP) + return proto.addcapabilities(repo, caps) # If you are writing an extension and consider wrapping this function. Wrap diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -21,17 +21,8 @@ ) def uisetup(): -extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden -def addnarrowcap(orig, repo, proto): -"""add the narrow capability to the server""" -caps = orig(repo, proto) -caps.append(wireprototypes.NARROWCAP) -if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(wireprototypes.ELLIPSESCAP) -return caps - def reposetup(repo): def wirereposetup(ui, peer): def wrapped(orig, cmd, *args, **kwargs): To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4890: wireprotoserver: move narrow capabilities to wireprototypes.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf7011b44d205: wireprotoserver: move narrow capabilities to wireprototypes.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4890?vs=11709=11716 REVISION DETAIL https://phab.mercurial-scm.org/D4890 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py mercurial/wireprototypes.py CHANGE DETAILS diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -28,6 +28,9 @@ SSHV2 = 'exp-ssh-v2-0002' HTTP_WIREPROTO_V2 = 'exp-http-v2-0002' +NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' + # All available wire protocol transports. TRANSPORTS = { SSHV1: { diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -38,9 +38,6 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -NARROWCAP = 'exp-narrow-1' -ELLIPSESCAP = 'exp-ellipses-1' - SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -15,7 +15,6 @@ match as matchmod, narrowspec, pycompat, -wireprotoserver, wireprototypes, wireprotov1peer, wireprotov1server, @@ -28,9 +27,9 @@ def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) -caps.append(wireprotoserver.NARROWCAP) +caps.append(wireprototypes.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(wireprotoserver.ELLIPSESCAP) +caps.append(wireprototypes.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -8,7 +8,7 @@ from __future__ import absolute_import from mercurial import ( -wireprotoserver, +wireprototypes, ) from . import ( @@ -26,8 +26,8 @@ def peer(self): peer = super(narrowrepository, self).peer() -peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(wireprotoserver.ELLIPSESCAP) +peer._caps.add(wireprototypes.NARROWCAP) +peer._caps.add(wireprototypes.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -30,7 +30,7 @@ repoview, sparse, util, -wireprotoserver, +wireprototypes, ) table = {} @@ -134,7 +134,7 @@ if repository.NARROW_REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) -if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): +if wireprototypes.NARROWCAP not in pullop.remote.capabilities(): raise error.Abort(_("server does not support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True @@ -145,7 +145,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] @@ -259,7 +259,7 @@ # then send that information to server whether we want ellipses or not. # Theoretically a non-ellipses repo should be able to use narrow # functionality from an ellipses enabled server -ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities() +ellipsesremote = wireprototypes.ELLIPSESCAP in remote.capabilities() def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) @@ -427,7 +427,7 @@ # check narrow support before doing anything if widening needs to be # performed. In future we should also abort if client is ellipses and # server does not support ellipses -if widening and wireprotoserver.NARROWCAP not in remote.capabilities(): +if widening and wireprototypes.NARROWCAP not in remote.capabilities(): raise error.Abort(_("server does not support narrow clones")) commoninc = discovery.findcommonincoming(repo, remote) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list
D4889: narrow: introduce a config option to check if narrow is enabled or not
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe92454e69dc3: narrow: introduce a config option to check if narrow is enabled or not (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4889?vs=11708=11715 REVISION DETAIL https://phab.mercurial-scm.org/D4889 AFFECTED FILES hgext/narrow/__init__.py mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -538,6 +538,9 @@ coreconfigitem('experimental', 'mmapindexthreshold', default=None, ) +coreconfigitem('experimental', 'narrow', +default=False, +) coreconfigitem('experimental', 'nonnormalparanoidcheck', default=False, ) diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -62,6 +62,7 @@ if not repo.local(): return +repo.ui.setconfig('experimental', 'narrow', True, 'narrow-ext') if repository.NARROW_REQUIREMENT in repo.requirements: narrowrepo.wraprepo(repo) narrowwirepeer.reposetup(repo) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4894: py3: use '%f' for floats instead of '%s'
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I remember Yuya saying we need to use bytestr() or '%r' because '%s' was clever. Not sure it applies to this or not. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4894 AFFECTED FILES mercurial/copies.py CHANGE DETAILS diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -212,7 +212,7 @@ dbg('debug.copies: rename of: %s\n' % ofctx._path) cm[f] = ofctx.path() if debug: -dbg('debug.copies: time: %s seconds\n' +dbg('debug.copies: time: %f seconds\n' % (util.timer() - start)) return cm To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4893: py3: add 8 new passing tests to whitelist found by buildbot
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We are getting close! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4893 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -573,6 +573,14 @@ test-websub.t test-win32text.t test-wireproto-clientreactor.py +test-wireproto-command-branchmap.t +test-wireproto-command-changesetdata.t +test-wireproto-command-filedata.t +test-wireproto-command-heads.t +test-wireproto-command-listkeys.t +test-wireproto-command-lookup.t +test-wireproto-command-manifestdata.t +test-wireproto-command-pushkey.t test-wireproto-framing.py test-wireproto-serverreactor.py test-wireproto.py To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4892: narrow: drop the bundle2 capability since we have server capabilities (BC)
pulkit 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 This patch drops the narrow bundle2 capabilities since we introduced narrow server capabilities which are more nice and now used everywhere. I am not sure what it can affect, so on safe side I marked this as BC. Also I removed the NARROWCAP constant as that kind of conflicts with the same name constant in wireprototypes.py. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4892 AFFECTED FILES hgext/narrow/narrowbundle2.py tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -32,7 +32,6 @@ > EOF $ echo hello | hg -R . serve --stdio | \ > "$PYTHON" unquote.py | tr ' ' '\n' | grep narrow - narrow=v0 exp-narrow-1 $ cd .. diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -20,7 +20,6 @@ changegroup, error, exchange, -extensions, narrowspec, repair, repository, @@ -31,10 +30,9 @@ stringutil, ) -NARROWCAP = 'narrow' _NARROWACL_SECTION = 'narrowhgacl' -_CHANGESPECPART = NARROWCAP + ':changespec' -_SPECPART = NARROWCAP + ':spec' +_CHANGESPECPART = 'narrow:changespec' +_SPECPART = 'narrow:spec' _SPECPART_INCLUDE = 'include' _SPECPART_EXCLUDE = 'exclude' _KILLNODESIGNAL = 'KILL' @@ -44,12 +42,6 @@ _CSHEADERSIZE = struct.calcsize(_ELIDEDCSHEADER) _MFHEADERSIZE = struct.calcsize(_ELIDEDMFHEADER) -# When advertising capabilities, always include narrow clone support. -def getrepocaps_narrow(orig, repo, **kwargs): -caps = orig(repo, **kwargs) -caps[NARROWCAP] = ['v0'] -return caps - # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, @@ -252,8 +244,6 @@ def setup(): """Enable narrow repo support in bundle2-related extension points.""" -extensions.wrapfunction(bundle2, 'getrepocaps', getrepocaps_narrow) - getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS getbundleargs['narrow'] = 'boolean' To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4891: narrow: move adding of narrow server capabilities to core
pulkit 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 We use the experimental.narrow config option introduced in one of the previous patch and move the functionality of adding narrow server capabilities to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4891 AFFECTED FILES hgext/narrow/narrowwirepeer.py mercurial/wireprotov1server.py CHANGE DETAILS diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -286,6 +286,11 @@ caps.append('bundle2=' + urlreq.quote(capsblob)) caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) +if repo.ui.configbool('experimental', 'narrow'): +caps.append(wireprototypes.NARROWCAP) +if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): +caps.append(wireprototypes.ELLIPSESCAP) + return proto.addcapabilities(repo, caps) # If you are writing an extension and consider wrapping this function. Wrap diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -21,17 +21,8 @@ ) def uisetup(): -extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden -def addnarrowcap(orig, repo, proto): -"""add the narrow capability to the server""" -caps = orig(repo, proto) -caps.append(wireprototypes.NARROWCAP) -if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(wireprototypes.ELLIPSESCAP) -return caps - def reposetup(repo): def wirereposetup(ui, peer): def wrapped(orig, cmd, *args, **kwargs): To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4890: wireprotoserver: move narrow capabilities to wireprototypes.py
pulkit 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 This is done because wireprotoserver import wireprotov1server, so you cannot import wireprotoserver in wireprotov1server to use the capabilities constants. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4890 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py mercurial/wireprototypes.py CHANGE DETAILS diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -28,6 +28,9 @@ SSHV2 = 'exp-ssh-v2-0002' HTTP_WIREPROTO_V2 = 'exp-http-v2-0002' +NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' + # All available wire protocol transports. TRANSPORTS = { SSHV1: { diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -38,9 +38,6 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' -NARROWCAP = 'exp-narrow-1' -ELLIPSESCAP = 'exp-ellipses-1' - SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -15,7 +15,6 @@ match as matchmod, narrowspec, pycompat, -wireprotoserver, wireprototypes, wireprotov1peer, wireprotov1server, @@ -28,9 +27,9 @@ def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) -caps.append(wireprotoserver.NARROWCAP) +caps.append(wireprototypes.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(wireprotoserver.ELLIPSESCAP) +caps.append(wireprototypes.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -8,7 +8,7 @@ from __future__ import absolute_import from mercurial import ( -wireprotoserver, +wireprototypes, ) from . import ( @@ -26,8 +26,8 @@ def peer(self): peer = super(narrowrepository, self).peer() -peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(wireprotoserver.ELLIPSESCAP) +peer._caps.add(wireprototypes.NARROWCAP) +peer._caps.add(wireprototypes.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -30,7 +30,7 @@ repoview, sparse, util, -wireprotoserver, +wireprototypes, ) table = {} @@ -134,7 +134,7 @@ if repository.NARROW_REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) -if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): +if wireprototypes.NARROWCAP not in pullop.remote.capabilities(): raise error.Abort(_("server does not support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True @@ -145,7 +145,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] @@ -259,7 +259,7 @@ # then send that information to server whether we want ellipses or not. # Theoretically a non-ellipses repo should be able to use narrow # functionality from an ellipses enabled server -ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities() +ellipsesremote = wireprototypes.ELLIPSESCAP in remote.capabilities() def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) @@ -427,7 +427,7 @@ # check narrow support before doing anything if widening needs to be # performed. In future we should also abort if client is ellipses and # server does not support ellipses -if widening and wireprotoserver.NARROWCAP not in remote.capabilities(): +if widening and wireprototypes.NARROWCAP not in remote.capabilities(): raise error.Abort(_("server does not support narrow clones")) commoninc = discovery.findcommonincoming(repo, remote) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel
D4889: narrow: introduce a config option to check if narrow is enabled or not
pulkit 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 This patch introduces a new config option experimental.narrow which is set to False by default and set to True by the narrow extension. While moving narrow related logic into core, we need to know at places whether narrow extension is enabled or not. Checking the list of extension enabled is one solution but once narrow is inbuilt, we will definitely want a config option to check whether narrow is turned on or not. So this patch introduces a config option, which will evolve to the main point to turn narrow capability on and off once all the narrow is in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4889 AFFECTED FILES hgext/narrow/__init__.py mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -538,6 +538,9 @@ coreconfigitem('experimental', 'mmapindexthreshold', default=None, ) +coreconfigitem('experimental', 'narrow', +default=False, +) coreconfigitem('experimental', 'nonnormalparanoidcheck', default=False, ) diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -62,6 +62,7 @@ if not repo.local(): return +repo.ui.setconfig('experimental', 'narrow', True, 'narrow-ext') if repository.NARROW_REQUIREMENT in repo.requirements: narrowrepo.wraprepo(repo) narrowwirepeer.reposetup(repo) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4888: narrow: move the code to generate a widening bundle2 to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1ea80ac13f19: narrow: move the code to generate a widening bundle2 to core (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4888?vs=11704=11707 REVISION DETAIL https://phab.mercurial-scm.org/D4888 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2266,3 +2266,37 @@ repo.ui.debug('applying stream bundle\n') streamclone.applybundlev2(repo, part, filecount, bytecount, requirements) + +def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): +"""generates bundle2 for widening a narrow clone + +repo is the localrepository instance +diffmatcher is a differencemacther of '(newincludes, newexcludes) - +(oldincludes, oldexcludes)' +common is set of common heads between server and client +known is a set of revs known on the client side (used in ellipses) +cgversion is the changegroup version to send +ellipses is boolean value telling whether to send ellipses data or not + +returns bundle2 of the data required for extending +""" +bundler = bundle20(repo.ui) +commonnodes = set() +cl = repo.changelog +for r in repo.revs("::%ln", common): +commonnodes.add(cl.node(r)) +if commonnodes: +# XXX: we should only send the filelogs (and treemanifest). user +# already has the changelog and manifest +packer = changegroup.getbundler(cgversion, repo, +filematcher=diffmatcher, +fullnodes=commonnodes) +cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), + False, 'narrow_widen', changelog=False) + +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') + +return bundler diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -21,8 +21,6 @@ wireprotov1server, ) -from . import narrowbundle2 - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden @@ -95,7 +93,7 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) -bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, +bundler = bundle2.widen_bundle(repo, diffmatch, common, known, cgversion, ellipses) except error.Abort as exc: bundler = bundle2.bundle20(repo.ui) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -50,40 +50,6 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates bundle2 for widening a narrow clone - -repo is the localrepository instance -diffmatcher is a differencemacther of '(newincludes, newexcludes) - -(oldincludes, oldexcludes)' -common is set of common heads between server and client -known is a set of revs known on the client side (used in ellipses) -cgversion is the changegroup version to send -ellipses is boolean value telling whether to send ellipses data or not - -returns bundle2 of the data required for extending -""" -bundler = bundle2.bundle20(repo.ui) -commonnodes = set() -cl = repo.changelog -for r in repo.revs("::%ln", common): -commonnodes.add(cl.node(r)) -if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest -packer = changegroup.getbundler(cgversion, repo, -filematcher=diffmatcher, -fullnodes=commonnodes) -cgdata = packer.generate(set([nullid]), list(commonnodes), False, - 'narrow_widen', changelog=False) - -part = bundler.newpart('changegroup', data=cgdata) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') - -return bundler - # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, To: pulkit, durin42,
D4887: narrow: don't include the manifests while widening a narrow clone
pulkit updated this revision to Diff 11706. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4887?vs=11700=11706 REVISION DETAIL https://phab.mercurial-scm.org/D4887 AFFECTED FILES mercurial/bundle2.py mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -862,6 +862,8 @@ yield chunk for delta in deltas: +if not tree and 'manifest' not in parts: +continue chunks = _revisiondeltatochunks(delta, self._builddeltaheader) for chunk in chunks: size += len(chunk) diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2286,12 +2286,10 @@ for r in repo.revs("::%ln", common): commonnodes.add(cl.node(r)) if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest packer = changegroup.getbundler(cgversion, repo, filematcher=diffmatcher, fullnodes=commonnodes) -reqparts = ('manifest', 'dirlogs', 'filelog') +reqparts = ('dirlogs', 'filelog') cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), False, 'narrow_widen', parts=reqparts) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4886: changegroup: add a parts argument to cgpacker.generate()
pulkit updated this revision to Diff 11705. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4886?vs=11699=11705 REVISION DETAIL https://phab.mercurial-scm.org/D4886 AFFECTED FILES mercurial/bundle2.py mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -788,20 +788,29 @@ self._verbosenote = lambda s: None def generate(self, commonrevs, clnodes, fastpathlinkrev, source, - changelog=True): + parts=None): """Yield a sequence of changegroup byte chunks. -If changelog is False, changelog data won't be added to changegroup + +parts is a tuple of things which should be generated in the changegroup. +Possible values of tuple are 'changelog', 'manifest', 'dirlogs' and +'filelogs' +callers can pass a tuple omitting some part which they don't want in the +changegroup. For ex. widening with narrow passes parts as +('dirlogs', 'filelogs') """ +if parts is None: +parts = ('changelog', 'manifest', 'dirlogs', 'filelog') + repo = self._repo cl = repo.changelog self._verbosenote(_('uncompressed size of bundle content:\n')) size = 0 clstate, deltas = self._generatechangelog(cl, clnodes) for delta in deltas: -if changelog: +if 'changelog' in parts: for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): size += len(chunk) diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2291,8 +2291,9 @@ packer = changegroup.getbundler(cgversion, repo, filematcher=diffmatcher, fullnodes=commonnodes) +reqparts = ('manifest', 'dirlogs', 'filelog') cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), - False, 'narrow_widen', changelog=False) + False, 'narrow_widen', parts=reqparts) part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', cgversion) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4888: narrow: move the code to generate a widening bundle2 to core
pulkit 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 This is a part of moving more narrow related bits to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4888 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2266,3 +2266,37 @@ repo.ui.debug('applying stream bundle\n') streamclone.applybundlev2(repo, part, filecount, bytecount, requirements) + +def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): +"""generates bundle2 for widening a narrow clone + +repo is the localrepository instance +diffmatcher is a differencemacther of '(newincludes, newexcludes) - +(oldincludes, oldexcludes)' +common is set of common heads between server and client +known is a set of revs known on the client side (used in ellipses) +cgversion is the changegroup version to send +ellipses is boolean value telling whether to send ellipses data or not + +returns bundle2 of the data required for extending +""" +bundler = bundle20(repo.ui) +commonnodes = set() +cl = repo.changelog +for r in repo.revs("::%ln", common): +commonnodes.add(cl.node(r)) +if commonnodes: +# XXX: we should only send the filelogs (and treemanifest). user +# already has the changelog and manifest +packer = changegroup.getbundler(cgversion, repo, +filematcher=diffmatcher, +fullnodes=commonnodes) +cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), + False, 'narrow_widen', changelog=False) + +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') + +return bundler diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -21,8 +21,6 @@ wireprotov1server, ) -from . import narrowbundle2 - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden @@ -95,7 +93,7 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) -bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, +bundler = bundle2.widen_bundle(repo, diffmatch, common, known, cgversion, ellipses) except error.Abort as exc: bundler = bundle2.bundle20(repo.ui) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -50,40 +50,6 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates bundle2 for widening a narrow clone - -repo is the localrepository instance -diffmatcher is a differencemacther of '(newincludes, newexcludes) - -(oldincludes, oldexcludes)' -common is set of common heads between server and client -known is a set of revs known on the client side (used in ellipses) -cgversion is the changegroup version to send -ellipses is boolean value telling whether to send ellipses data or not - -returns bundle2 of the data required for extending -""" -bundler = bundle2.bundle20(repo.ui) -commonnodes = set() -cl = repo.changelog -for r in repo.revs("::%ln", common): -commonnodes.add(cl.node(r)) -if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest -packer = changegroup.getbundler(cgversion, repo, -filematcher=diffmatcher, -fullnodes=commonnodes) -cgdata = packer.generate(set([nullid]), list(commonnodes), False, - 'narrow_widen', changelog=False) - -part = bundler.newpart('changegroup', data=cgdata) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') - -return bundler - # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, To: pulkit, durin42, martinvonz, #hg-reviewers
D4887: narrow: don't include the manifests while widening a narrow clone
pulkit added a comment. In https://phab.mercurial-scm.org/D4887#73793, @martinvonz wrote: > > I'm still fine with queuing this for now if you need this patch somewhat urgently even though I think the code in this patch and in https://phab.mercurial-scm.org/D4886 should eventually go away. Well, we do want to optimize this manifest thing before the upcoming release because it adds 3-4 minutes to some narrow-copy extending. I also agree that all these hacks should go away. I was thinking to implement something like widen_changegroup() which will generate the changegroup which we want instead of hacking into the original changegroup code. INLINE COMMENTS > changegroup.py:1051 > prunednodes = self._prunemanifests(store, nodes, commonrevs) > if tree and not prunednodes: > continue > I don't think this is quite the right approach. If we're using treemanifest > and widening from {foo/, bar/} to {foo/, bar/, baz/}, then we'd still be > sending manifests for all those directories (and their subdirectories, > right)? We should only have to send manifests for baz/ (and subdirectories). @martinvonz IIUC because of this and condition in line 1041 above, we won't send the manifest for all those directories and we will be sending manifest for baz/. The filematcher here is the differencematcher so foo/ and bar/ does not match it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4887 To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4838: narrow: start returning bundle2 from widen_bundle()
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe8132a8897da: narrow: start returning bundle2 from widen_bundle() (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4838?vs=11701=11703 REVISION DETAIL https://phab.mercurial-scm.org/D4838 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -69,7 +69,6 @@ ellipses: whether to send ellipses data or not """ -bundler = bundle2.bundle20(repo.ui) try: oldincludes = wireprototypes.decodelist(oldincludes) newincludes = wireprototypes.decodelist(newincludes) @@ -96,15 +95,10 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) -# get changegroup data -cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, -cgversion, ellipses) -if cg is not None: -part = bundler.newpart('changegroup', data=cg) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') +bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) except error.Abort as exc: +bundler = bundle2.bundle20(repo.ui) manargs = [('message', pycompat.bytestr(exc))] advargs = [] if exc.hint is not None: diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,7 +51,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates changegroup for widening a narrow clone +"""generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -61,11 +61,9 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not -returns changegroup data of the changegroup built or return None if there -are no common revs +returns bundle2 of the data required for extending """ -# XXX: This patch will start sending bundle2 after couple of patches when -# called from the wireprotocol command +bundler = bundle2.bundle20(repo.ui) commonnodes = set() cl = repo.changelog for r in repo.revs("::%ln", common): @@ -79,9 +77,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) -return cgdata +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') -return None +return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: narrow: the first version of narrow_widen wireprotocol command
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8feae5b989bc: narrow: the first version of narrow_widen wireprotocol command (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4813?vs=11675=11702 REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,8 +104,7 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command + sending narrow_widen command bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) adding changesets @@ -115,12 +114,7 @@ adding widest/f revisions (tree !) added 0 changesets with 1 changes to 1 files bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published + bundle2-input-bundle: 0 parts total widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +137,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +174,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +277,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +367,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,24 @@ from __future__ import absolute_import from mercurial import ( +bundle2, +error, extensions, hg, +match as matchmod, +narrowspec, +pycompat, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" @@ -37,3 +47,78 @@ return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, '_calltwowaystream', wrapped) hg.wirepeersetupfuncs.append(wirereposetup) + +@wireprotov1server.wireprotocommand('narrow_widen', 'oldincludes oldexcludes' +' newincludes newexcludes' +' commonheads cgversion' +' known ellipses', +permission='pull') +def narrow_widen(repo, proto, oldincludes, oldexcludes, newincludes, + newexcludes, commonheads, cgversion, known, ellipses): +"""wireprotocol command to send data when a narrow clone is widen. We will +be sending a changegroup here. + +The current set of arguments which are required: +oldincludes: the old includes of the narrow copy +oldexcludes: the old excludes of the narrow copy +newincludes: the new includes of the narrow copy +newexcludes: the new excludes of the narrow copy +commonheads: list of heads which are common between the server and client +cgversion(maybe): the changegroup version to produce +known: list of nodes which are known on the client (used in ellipses cases) +
D4838: narrow: start returning bundle2 from widen_bundle()
pulkit updated this revision to Diff 11701. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4838?vs=11592=11701 REVISION DETAIL https://phab.mercurial-scm.org/D4838 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -69,7 +69,6 @@ ellipses: whether to send ellipses data or not """ -bundler = bundle2.bundle20(repo.ui) try: oldincludes = wireprototypes.decodelist(oldincludes) newincludes = wireprototypes.decodelist(newincludes) @@ -96,15 +95,10 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) -# get changegroup data -cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, -cgversion, ellipses) -if cg is not None: -part = bundler.newpart('changegroup', data=cg) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') +bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) except error.Abort as exc: +bundler = bundle2.bundle20(repo.ui) manargs = [('message', pycompat.bytestr(exc))] advargs = [] if exc.hint is not None: diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,7 +51,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates changegroup for widening a narrow clone +"""generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -61,11 +61,9 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not -returns changegroup data of the changegroup built or return None if there -are no common revs +returns bundle2 of the data required for extending """ -# XXX: This patch will start sending bundle2 after couple of patches when -# called from the wireprotocol command +bundler = bundle2.bundle20(repo.ui) commonnodes = set() cl = repo.changelog for r in repo.revs("::%ln", common): @@ -79,9 +77,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) -return cgdata +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') -return None +return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: narrow: the first version of narrow_widen wireprotocol command
pulkit added inline comments. INLINE COMMENTS > indygreg wrote in narrowwirepeer.py:107 > This may want to catch `Exception`. Okay, I will followup if this got pushed. Also I copied it from getbundle, do we want to change it there also? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4813 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4838: narrow: start returning bundle2 from widen_bundle()
pulkit planned changes to this revision. pulkit added a comment. This one does not apply cleanly on it's parent now. I will rebase and resend. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4838 To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4887: narrow: don't include the manifests while widening a narrow clone
pulkit 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 a narrow clone is done initially the whole manifest is send. In case of treemanifests, the manifest and the dirlogs of the paths matching the narrowmatcher are send while clone. So while widening, we don't need the manifests again. In case of treemanifests, we just need the dirlogs. This patch adds logic in cgpacker.generate() to skip adding the manifests if they are not dirlogs and omit manifest from the required parts in call while widening in narrow extension. This saves a lot of time on big repos. It prevents downloading manifest which can be in GB's on big repos and also since we don't get it, we don't try to unpack and apply it saving more time. It saves around 3-4 minutes on our internal repository while extending on the treemanifest repo. On flat manifest repo, since the manifest is much much larger, I can guess this saves around ~10 mins. I also checked the actual payload size of changegroup in bundle2 in test-narrow-widen-no-ellipsis.t. Before this patch flat: 662 tree: 835 After this patch flat: 157 tree: 333 These are the numbers from the test which has 7-8 commits and few dirs. On big repos the improvement is *huge*. The above all is the case when we are widening without ellipses. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4887 AFFECTED FILES hgext/narrow/narrowbundle2.py mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -862,6 +862,8 @@ yield chunk for delta in deltas: +if not tree and 'manifest' not in parts: +continue chunks = _revisiondeltatochunks(delta, self._builddeltaheader) for chunk in chunks: size += len(chunk) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -78,7 +78,7 @@ filematcher=diffmatcher, fullnodes=commonnodes) # XXX: we should also prevent manifests -reqparts = ('manifest', 'dirlogs', 'filelog') +reqparts = ('dirlogs', 'filelog') cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', parts=reqparts) To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4886: changegroup: add a parts argument to cgpacker.generate()
pulkit 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 This patch removes the changelog argument added to cgpacker.generate() few weeks ago and add a parts argument which will be a tuple of parts to be included into the changegroup. The changelog argument was used to determine that whether we need to add changelog data to the changegroup or not. In upcoming patches, I will need same functionality for manifests where I just want to send the dirlogs for extending a narrow clone. Instead of adding a new argument for each possible thing, let's add one argument specifying things we want to generate. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4886 AFFECTED FILES hgext/narrow/narrowbundle2.py mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -788,20 +788,29 @@ self._verbosenote = lambda s: None def generate(self, commonrevs, clnodes, fastpathlinkrev, source, - changelog=True): + parts=None): """Yield a sequence of changegroup byte chunks. -If changelog is False, changelog data won't be added to changegroup + +parts is a tuple of things which should be generated in the changegroup. +Possible values of tuple are 'changelog', 'manifest', 'dirlogs' and +'filelogs' +callers can pass a tuple omitting some part which they don't want in the +changegroup. For ex. widening with narrow passes parts as +('dirlogs', 'filelogs') """ +if parts is None: +parts = ('changelog', 'manifest', 'dirlogs', 'filelog') + repo = self._repo cl = repo.changelog self._verbosenote(_('uncompressed size of bundle content:\n')) size = 0 clstate, deltas = self._generatechangelog(cl, clnodes) for delta in deltas: -if changelog: +if 'changelog' in parts: for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): size += len(chunk) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -77,8 +77,10 @@ packer = changegroup.getbundler(cgversion, repo, filematcher=diffmatcher, fullnodes=commonnodes) +# XXX: we should also prevent manifests +reqparts = ('manifest', 'dirlogs', 'filelog') cgdata = packer.generate(set([nullid]), list(commonnodes), False, - 'narrow_widen', changelog=False) + 'narrow_widen', parts=reqparts) return cgdata To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3639: remotenames: add names argument to remotenames revset
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6638bd3f061b: remotenames: add names argument to remotenames revset (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3639?vs=9669=11694 REVISION DETAIL https://phab.mercurial-scm.org/D3639 AFFECTED FILES hgext/remotenames.py tests/test-logexchange.t CHANGE DETAILS diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t --- a/tests/test-logexchange.t +++ b/tests/test-logexchange.t @@ -289,6 +289,7 @@ ~ Updating to revision using hoisted name +--- Deleting local bookmark to make sure we update to hoisted name only @@ -393,3 +394,187 @@ default/bar 6:87d6d6676308 default/foo 8:3e1487808078 * foo 8:3e1487808078 + +Testing the names argument to remotenames, remotebranches and remotebookmarks revsets +-- + + $ cd .. + $ hg clone ssh://user@dummy/server client2 + requesting all changes + adding changesets + adding manifests + adding file changes + added 9 changesets with 9 changes to 9 files (+1 heads) + new changesets 18d04c59bb5d:3e1487808078 + updating to branch default + 8 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd server2 + $ hg up wat + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo foo > watwat + $ hg ci -Aqm "added watwat" + $ hg bookmark bar + abort: bookmark 'bar' already exists (use -f to force) + [255] + $ hg up ec24 + 3 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo i > i + $ hg ci -Aqm "added i" + + $ cd ../client2 + $ echo "[paths]" >> .hg/hgrc + $ echo "server2 = $TESTTMP/server2" >> .hg/hgrc + $ hg pull server2 + pulling from $TESTTMP/server2 + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + new changesets f34adec73c21:bf433e48adea + (run 'hg update' to get a working copy) + + $ hg log -Gr 'remotenames()' -T '{rev}:{node|short} {desc}\n({remotebranches}) [{remotebookmarks}]\n\n' + o 10:bf433e48adea added i + | (server2/default) [] + | + | o 9:f34adec73c21 added watwat + | | (server2/wat) [] + | | + | o 8:3e1487808078 added bar + | : (default/wat) [default/foo] + | : + @ : 7:ec2426147f0e Added h + | : (default/default) [] + | : + o : 6:87d6d6676308 Added g + :/ () [default/bar server2/bar] + : + o 3:62615734edd5 Added d + | () [server2/foo] + ~ + +Testing for a single remote name which exists + + $ hg log -r 'remotebranches("default/wat")' -GT "{rev}:{node|short} {remotebranches}\n" + o 8:3e1487808078 default/wat + | + ~ + + $ hg log -r 'remotebookmarks("server2/foo")' -GT "{rev}:{node|short} {remotebookmarks}\n" + o 3:62615734edd5 server2/foo + | + ~ + + $ hg log -r 'remotenames("re:default")' -GT "{rev}:{node|short} {remotenames}\n" + o 10:bf433e48adea server2/default + | + | o 8:3e1487808078 default/foo default/wat + | | + | ~ + @ 7:ec2426147f0e default/default + | + o 6:87d6d6676308 default/bar server2/bar + | + ~ + +Testing for a single name which does not exists + + $ hg log -r 'remotebranches(def)' -GT "{rev}:{node|short} {remotenames}\n" + + $ hg log -r 'remotebookmarks("server3")' -GT "{rev}:{node|short} {remotenames}\n" + + $ hg log -r 'remotenames("server3")' -GT "{rev}:{node|short} {remotenames}\n" + +Testing for multiple names where all of them exists + + $ hg log -r 'remotenames("re:default", "re:server2")' -GT "{rev}:{node|short} {remotenames}\n" + o 10:bf433e48adea server2/default + | + | o 9:f34adec73c21 server2/wat + | | + | o 8:3e1487808078 default/foo default/wat + | : + @ : 7:ec2426147f0e default/default + | : + o : 6:87d6d6676308 default/bar server2/bar + :/ + o 3:62615734edd5 server2/foo + | + ~ + + $ hg log -r 'remotebranches("default/wat", "server2/wat")' -GT "{rev}:{node|short} {remotebranches}\n" + o 9:f34adec73c21 server2/wat + | + o 8:3e1487808078 default/wat + | + ~ + + $ hg log -r 'remotebookmarks("default/foo", "server2/foo")' -GT "{rev}:{node|short} {remotebookmarks}\n" + o 8:3e1487808078 default/foo + : + o 3:62615734edd5 server2/foo + | + ~ + +Testing for multipe names where some exists and some not + + $ hg log -r 'remotenames(def, "re:server2")' -GT "{rev}:{node|short} {remotenames}\n" + o 10:bf433e48adea server2/default + : + : o 9:f34adec73c21 server2/wat + : : + o : 6:87d6d6676308 default/bar server2/bar + :/ + o 3:62615734edd5 server2/foo + | + ~ + + $ hg log -r 'remotebranches("default/default", server)' -GT "{rev}:{node|short} {remotebranches}\n" + @ 7:ec2426147f0e default/default + | + ~ + + $ hg log -r 'remotebookmarks("default/foo",
D4882: obsolete: fixed ValueError when stored note contains ':' char (issue5783)
pulkit accepted this revision. pulkit added a comment. This series looks good to me but again since I helped Zharas prepare it, I won't queue it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4882 To: Zharaskhan, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4876: amend: add config to skip amend if only date is changed (issue5828)
pulkit accepted this revision. pulkit added a comment. This looks good to me but since I helped Zharas in preparing the patch, I won't queue it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4876 To: Zharaskhan, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: narrow: the first version of narrow_widen wireprotocol command
pulkit updated this revision to Diff 11675. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4813?vs=11591=11675 REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,8 +104,7 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command + sending narrow_widen command bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) adding changesets @@ -115,12 +114,7 @@ adding widest/f revisions (tree !) added 0 changesets with 1 changes to 1 files bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published + bundle2-input-bundle: 0 parts total widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +137,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +174,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +277,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +367,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,24 @@ from __future__ import absolute_import from mercurial import ( +bundle2, +error, extensions, hg, +match as matchmod, +narrowspec, +pycompat, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" @@ -37,3 +47,78 @@ return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, '_calltwowaystream', wrapped) hg.wirepeersetupfuncs.append(wirereposetup) + +@wireprotov1server.wireprotocommand('narrow_widen', 'oldincludes oldexcludes' +' newincludes newexcludes' +' commonheads cgversion' +' known ellipses', +permission='pull') +def narrow_widen(repo, proto, oldincludes, oldexcludes, newincludes, + newexcludes, commonheads, cgversion, known, ellipses): +"""wireprotocol command to send data when a narrow clone is widen. We will +be sending a changegroup here. + +The current set of arguments which are required: +oldincludes: the old includes of the narrow copy +oldexcludes: the old excludes of the narrow copy +newincludes: the new includes of the narrow copy +newexcludes: the new excludes of the narrow copy +commonheads: list of heads which are common between the server and client +cgversion(maybe): the changegroup version to produce +known: list of nodes which are known on the client (used in ellipses cases) +ellipses: whether to send ellipses data or not +""" + +bundler = bundle2.bundle20(repo.ui) +try: +
D4813: narrow: the first version of narrow_widen wireprotocol command
pulkit added a comment. In https://phab.mercurial-scm.org/D4813#73534, @martinvonz wrote: > > I need to specify the arguments instead of just specifying "*". > > Don't forget this one. Did that! INLINE COMMENTS > indygreg wrote in narrowbundle2.py:329 > Because of how `wireprotov1server.getbundle()` handles arguments, removing > this argument from the definition of arguments to the `getbundle` wire > protocol command means that existing clients attempting to send the argument > to the `getbundle` wire protocol command will cause a server-side exception. > > We need to keep this key around for BC unless we're fine breaking old clients > or unless there is something that changes server capabilities in a way that > prevents old clients from calling `getbundle` with this argument. We could > ignore the argument or nerf the server to error if it is received. This argument has not yet been a part of release. It was introduced in https://phab.mercurial-scm.org/D4383 which was pushed in the end on August. So I don't think we need to take care of that unless someone is using hg from default branch. @martinvonz will this removal affect you? Do you have https://phab.mercurial-scm.org/D4383 grafted to your internal mercurial? > martinvonz wrote in narrowwirepeer.py:49 > It seems to depend only on `widen_bundle`, which doesn't seem to depend on > anything else, so it would probably be easy to move it to core, but I won't > insist. I will try to follow-up before the freeze. > indygreg wrote in narrowwirepeer.py:79-82 > We probably want to extract the argument "parsing" from > `wireprotov1server.getbundle()` into a standalone function so we can use it > for this command. > > Arguments in wire protocol version 1 are wonky :/ Maybe we need to have a function which takes the values and what type to decode into and that can be used in both places. Also after specifying the args names instead of "*", we don't have a dictionary with all the arguments. We need to build one. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4813 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4851: streamclone: pass narrowing related info in generatev2() and _walkstreamfiles()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds includes and excludes as argument to generatev2() and build a matcher using that and pass that into _walkstreamfiles(). This will help us in filtering files we stream depending on the includes and excludes passed in by the user. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4851 AFFECTED FILES mercurial/streamclone.py CHANGE DETAILS diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -16,6 +16,7 @@ branchmap, cacheutil, error, +narrowspec, phases, pycompat, store, @@ -190,8 +191,8 @@ return True # This is it's own function so extensions can override it. -def _walkstreamfiles(repo): -return repo.store.walk() +def _walkstreamfiles(repo, matcher=None): +return repo.store.walk(matcher) def generatev1(repo): """Emit content for version 1 of a streaming clone. @@ -527,7 +528,7 @@ finally: fp.close() -def generatev2(repo): +def generatev2(repo, includes=None, excludes=None): """Emit content for version 2 of a streaming clone. the data stream consists the following entries: @@ -545,8 +546,12 @@ entries = [] totalfilesize = 0 +matcher = None +if includes or excludes: +matcher = narrowspec.match(repo.root, includes, excludes) + repo.ui.debug('scanning\n') -for name, ename, size in _walkstreamfiles(repo): +for name, ename, size in _walkstreamfiles(repo, matcher): if size: entries.append((_srcstore, name, _fileappend, size)) totalfilesize += size To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4850: store: pass matcher to store.datafiles() and filter files according to it
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY To get narrow stream clones working, we need a way to filter the storage files using a matcher. This patch adds matcher as an argument to store.walk() and store.datafiles() so that we can filter the files returned according to the matcher. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4850 AFFECTED FILES mercurial/store.py CHANGE DETAILS diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -374,17 +374,21 @@ l.sort() return l -def datafiles(self): +def datafiles(self, matcher=None): return self._walk('data', True) + self._walk('meta', True) def topfiles(self): # yield manifest before changelog return reversed(self._walk('', False)) -def walk(self): -'''yields (unencoded, encoded, size)''' +def walk(self, matcher=None): +'''yields (unencoded, encoded, size) + +if a matcher is passed, storage files of only those tracked paths +are passed with matches the matcher +''' # yield data files first -for x in self.datafiles(): +for x in self.datafiles(matcher): yield x for x in self.topfiles(): yield x @@ -422,12 +426,14 @@ self.vfs = vfsmod.filtervfs(vfs, encodefilename) self.opener = self.vfs -def datafiles(self): +def datafiles(self, matcher=None): for a, b, size in super(encodedstore, self).datafiles(): try: a = decodefilename(a) except KeyError: a = None +if matcher and not matcher(_gettrackedpath(a)): +continue yield a, b, size def join(self, f): @@ -551,8 +557,10 @@ def getsize(self, path): return self.rawvfs.stat(path).st_size -def datafiles(self): +def datafiles(self, matcher=None): for f in sorted(self.fncache): +if matcher and not matcher(_gettrackedpath(f)): +continue ef = self.encode(f) try: yield f, ef, self.getsize(ef) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4849: store: introduce a function to get tracked path from a fncache entry
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch introduces a function to get the trakced path from a fncache entry. This will be used to filter out files to streamclone using a narrowmatcher. The function decodes the entries, and then returns the part after omitting the ending .d, .i and starting meta/ and data/. I am not sure if this is correct. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4849 AFFECTED FILES mercurial/store.py CHANGE DETAILS diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -24,6 +24,21 @@ parsers = policy.importmod(r'parsers') +def _gettrackedpath(path): +"""parses a fncahe entry and returns the path which that +entry is tracking. + +If None is returned, it means it does not track any path. +""" +path = decodefilename(path) +if path.startswith('data/'): +return path[5:-2] +elif path.startswith('dh/'): +return path[3:-2] +elif path.startswith('meta/'): +return path[5:-2] +return None + # This avoids a collision between a file named foo and a dir named # foo.i or foo.d def _encodedir(path): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in narrowbundle2.py:54 > > I said that because there is a 'narrow:changespec' part being send from the > > server. > > I assumed that was the reason :) But I don't think we'll need that part > because we don't need to strip nodes in the ellipsis case either. > But I don't think we'll need that part because we don't need to strip nodes > in the ellipsis case either. I am still not able to understand the complete idea here, but preventing sending the kill signals and stripping will be very good. If I don't understand, I will try to understand this from you in upcoming sprint. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4786 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4847: manifest: remove an unused variable caught by pyflakes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe22016e83c1e: manifest: remove an unused variable caught by pyflakes (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4847?vs=11589=11594 REVISION DETAIL https://phab.mercurial-scm.org/D4847 AFFECTED FILES mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -719,7 +719,6 @@ self._loadalllazy() return None -todel = [] loadlazy = self._loadlazy for k in visit: loadlazy(k + '/') To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4848: py3: whitelist another passing tests caught by buildbot
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa8ec8bce14c6: py3: whitelist another passing tests caught by buildbot (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4848?vs=11590=11593 REVISION DETAIL https://phab.mercurial-scm.org/D4848 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -524,6 +524,7 @@ test-status-inprocess.py test-status-rev.t test-status-terse.t +test-storage.py test-stream-bundle-v2.t test-strict.t test-strip-cross.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: narrow: the first version of narrow_widen wireprotocol command
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in narrowcommands.py:293-295 > As I said on IRC, I think we (Google) would appreciate it if this could > remain here for a while to give us more time to migrate our custom server to > the new wire protocol command. I was thinking we could just fall back to the > getbundle command if narrow_widen isn't supported. That probably means > changing the capability to "exp-narrow-2" now and call getbundle if > "exp-narrow-1" is supported but "exp-narrow-2" isn't. That shouldn't be very > difficult, but I don't think we've done kind of thing before. > > Actually, you can ignore all that because our server has the ellipses > capability, so it will not get here anyway :) We should instead think about > such a migration path when we add support for ellipses to narrow_widen. We can have a 'exp-ellipses-2' which will tell whether the server supports ellipses widening using narrow_widen() wireprotocol command or not. I think that should help in the meantime. Also will a week, or 10-15 days be enough for you? I think it will be better if can prevent releasing this compatibility because exp-ellipses-1 was introduced in this cycle only. > martinvonz wrote in narrowcommands.py:302 > Should we call this something like "heads" instead? It's the set of common > heads between the server and client and "common" makes sense together with > "heads" in the getbundle call, but it doesn't seem to make as much sense here. Made this commonheads which makes more sense. Thanks for the suggestion! > martinvonz wrote in narrowcommands.py:307-310 > It looks like this doesn't need to be in in the commandexecutor block and the > transaction probably doesn't need to span the wire protocol request. IOW, I > think you can drop `repo.transaction()`from line 293 and instead put that > togetgher this with this with-block. Did that, thanks! > martinvonz wrote in narrowwirepeer.py:49 > Should we just put this in core from the beginning? I implemented the peer initially in core only, but while implementing server side, I realized it rely on logic in narrowbundle2.py which also needs to be moved to core. Then I decided to implement it cleanly in the extension and then move it to core. > martinvonz wrote in narrowwirepeer.py:79-82 > I suppose we want the default to be False? Isn't `ellipses = > (args.get('ellipses') == '1')` enough? Or is the idea to be flexible with > what values we accept? Is that what other wire protocol commands do? I am not sure, I just copied from getbundle() handling: https://www.mercurial-scm.org/repo/hg/file/1a4c1a3cc3f5/mercurial/wireprotov1server.py#l404 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4813 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4838: narrow: start returning bundle2 from widen_bundle()
pulkit updated this revision to Diff 11592. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4838?vs=11573=11592 REVISION DETAIL https://phab.mercurial-scm.org/D4838 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -89,13 +89,8 @@ bundler = bundle2.bundle20(repo.ui) # get changegroup data -cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, cgversion, -ellipses) -if cg is not None: -part = bundler.newpart('changegroup', data=cg) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') +bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) chunks = bundler.getchunks() return wireprototypes.streamres(gen=chunks) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,7 +51,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates changegroup for widening a narrow clone +"""generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -61,11 +61,9 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not -returns changegroup data of the changegroup built or return None if there -are no common revs +returns bundle2 of the data required for extending """ -# XXX: This patch will start sending bundle2 after couple of patches when -# called from the wireprotocol command +bundler = bundle2.bundle20(repo.ui) commonnodes = set() cl = repo.changelog for r in repo.revs("::%ln", common): @@ -79,9 +77,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) -return cgdata +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') -return None +return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4848: py3: whitelist another passing tests caught by buildbot
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I this indygreg recent patches made this test pass on Python 3. So thanks to him! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4848 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -524,6 +524,7 @@ test-status-inprocess.py test-status-rev.t test-status-terse.t +test-storage.py test-stream-bundle-v2.t test-strict.t test-strip-cross.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4847: manifest: remove an unused variable caught by pyflakes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Uses of todel were removed in https://phab.mercurial-scm.org/D4843. This patch will make buildbots green again. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4847 AFFECTED FILES mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -719,7 +719,6 @@ self._loadalllazy() return None -todel = [] loadlazy = self._loadlazy for k in visit: loadlazy(k + '/') To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
pulkit added a comment. Can we please add a simple test for the new command? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4832 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: narrow: the first version of narrow_widen wireprotocol command
pulkit updated this revision to Diff 11572. pulkit edited the summary of this revision. pulkit retitled this revision from "[RFC] narrow: the first version of narrow_widen wireprotocol command" to "narrow: the first version of narrow_widen wireprotocol command". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4813?vs=11561=11572 REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,8 +104,7 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command + sending narrow_widen command bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) adding changesets @@ -115,12 +114,7 @@ adding widest/f revisions (tree !) added 0 changesets with 1 changes to 1 files bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published + bundle2-input-bundle: 0 parts total widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +137,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +174,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +277,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +367,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,22 @@ from __future__ import absolute_import from mercurial import ( +bundle2, extensions, hg, +match as matchmod, +narrowspec, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" @@ -37,3 +45,65 @@ return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, '_calltwowaystream', wrapped) hg.wirepeersetupfuncs.append(wirereposetup) + +@wireprotov1server.wireprotocommand('narrow_widen', '*', permission='pull') +def narrow_widen(repo, proto, args): +"""wireprotocol command to send data when a narrow clone is widen. We will +be sending a changegroup here. + +The current set of arguments which are required: +oldincludes: the old includes of the narrow copy +oldexcludes: the old excludes of the narrow copy +newincludes: the new includes of the narrow copy +newexcludes: the new excludes of the narrow copy +common: list of nodes which are common between the server and client +cgversion(maybe): the changegroup version to produce +known: list of nodes which are known on the client (used in ellipses cases) +ellipses: whether to send ellipses data or not +""" + +oldincludes = wireprototypes.decodelist(args.get('oldincludes')) +newincludes = wireprototypes.decodelist(args.get('newincludes')) +oldexcludes = wireprototypes.decodelist(args.get('oldexcludes')) +newexcludes = wireprototypes.decodelist(args.get('newexcludes')) +# validate the
D4838: narrow: start returning bundle2 from widen_bundle()
pulkit updated this revision to Diff 11573. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4838?vs=11562=11573 REVISION DETAIL https://phab.mercurial-scm.org/D4838 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -89,13 +89,8 @@ bundler = bundle2.bundle20(repo.ui) # get changegroup data -cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, cgversion, -ellipses) -if cg is not None: -part = bundler.newpart('changegroup', data=cg) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') +bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) chunks = bundler.getchunks() return wireprototypes.streamres(gen=chunks) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -52,7 +52,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates changegroup for widening a narrow clone +"""generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -62,11 +62,10 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not -returns changegroup data of the changegroup built or return None if there -are no common revs +returns bundle2 of the data required for extending """ -# XXX: This patch will start sending bundle2 after couple of patches when -# called from the wireprotocol command +bundler = bundle2.bundle20(repo.ui) + common = repo.revs("::%ln", common) commonnodes = set() cl = repo.changelog @@ -81,9 +80,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) -return cgdata +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') -return None +return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4789: narrow: check for servers' narrow support before doing anything (BC)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG06e75fbf9d6b: narrow: check for servers narrow support before doing anything (BC) (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4789?vs=11518=11569 REVISION DETAIL https://phab.mercurial-scm.org/D4789 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-clone-non-narrow-server.t tests/test-narrow-clone.t CHANGE DETAILS diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -65,7 +65,7 @@ $ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" requesting all changes - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] $ hg tracked -R narrow-via-localpeer abort: repository narrow-via-localpeer not found! diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -39,7 +39,7 @@ $ hg clone --narrow --include f1 http://localhost:$HGPORT1/ narrowclone requesting all changes - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] Make a narrow clone (via HGPORT2), then try to narrow and widen @@ -60,7 +60,5 @@ looking for local changes to affected paths $ hg tracked --addinclude f1 http://localhost:$HGPORT1/ comparing with http://localhost:$HGPORT1/ - searching for changes - no changes found - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -134,7 +134,7 @@ return orig(pullop, kwargs) if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): -raise error.Abort(_("server doesn't support narrow clones")) +raise error.Abort(_("server does not support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True include, exclude = repo.narrowpats @@ -408,6 +408,13 @@ url, branches = hg.parseurl(remotepath) ui.status(_('comparing with %s\n') % util.hidepassword(url)) remote = hg.peer(repo, opts, url) + +# check narrow support before doing anything if widening needs to be +# performed. In future we should also abort if client is ellipses and +# server does not support ellipses +if widening and wireprotoserver.NARROWCAP not in remote.capabilities(): +raise error.Abort(_("server does not support narrow clones")) + commoninc = discovery.findcommonincoming(repo, remote) oldincludes, oldexcludes = repo.narrowpats To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4812: narrow: pass old includes and excludes to _widen()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1a4c1a3cc3f5: narrow: pass old includes and excludes to _widen() (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4812?vs=11519=11570 REVISION DETAIL https://phab.mercurial-scm.org/D4812 AFFECTED FILES hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -248,7 +248,8 @@ repo.destroyed() -def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): +def _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes, + newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) # for now we assume that if a server has ellipses enabled, we will be @@ -433,6 +434,7 @@ if widening: newincludes = oldincludes | addedincludes newexcludes = oldexcludes - removedexcludes -_widen(ui, repo, remote, commoninc, newincludes, newexcludes) +_widen(ui, repo, remote, commoninc, oldincludes, oldexcludes, +newincludes, newexcludes) return 0 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
This revision was automatically updated to reflect the committed changes. Closed by commit rHG693dda764efe: narrow: dont do the dirstate dance if ellipses is not enabled (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4788?vs=11517=11568 REVISION DETAIL https://phab.mercurial-scm.org/D4788 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -88,6 +88,9 @@ added upstream revisions. $ cd narrow + $ hg id -n + 2 + $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) @@ -127,6 +130,9 @@ $ cat widest/f widest + $ hg id -n + 2 + Pull down the newly added upstream revision. $ hg pull diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -251,6 +251,14 @@ def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) +# for now we assume that if a server has ellipses enabled, we will be +# exchanging ellipses nodes. In future we should add ellipses as a client +# side requirement (maybe) to distinguish a client is shallow or not and +# then send that information to server whether we want ellipses or not. +# Theoretically a non-ellipses repo should be able to use narrow +# functionality from an ellipses enabled server +ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities() + def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -269,15 +277,21 @@ overrides = {('devel', 'all-warnings'): False} with ui.uninterruptable(): -ds = repo.dirstate -p1, p2 = ds.p1(), ds.p2() -with ds.parentchange(): -ds.setparents(node.nullid, node.nullid) common = commoninc[0] -with wrappedextraprepare, repo.ui.configoverride(overrides, 'widen'): -exchange.pull(repo, remote, heads=common) -with ds.parentchange(): -ds.setparents(p1, p2) +if ellipsesremote: +ds = repo.dirstate +p1, p2 = ds.p1(), ds.p2() +with ds.parentchange(): +ds.setparents(node.nullid, node.nullid) +with wrappedextraprepare,\ + repo.ui.configoverride(overrides, 'widen'): +exchange.pull(repo, remote, heads=common) +with ds.parentchange(): +ds.setparents(p1, p2) +else: +with wrappedextraprepare,\ + repo.ui.configoverride(overrides, 'widen'): +exchange.pull(repo, remote, heads=common) repo.setnewnarrowpats() actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4787: narrow: pass 'narrow_widen' as source while generating changegroup
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfa2395659828: narrow: pass narrow_widen as source while generating changegroup (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4787?vs=11560=11567 REVISION DETAIL https://phab.mercurial-scm.org/D4787 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,16 +51,15 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_bundle(repo, diffmatcher, common, known, cgversion, source, ellipses): +def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): """generates changegroup for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - (oldincludes, oldexcludes)' common is set of common revs between server and client known is a set of revs known on the client side (used in ellipses) cgversion is the changegroup version to send -source is the command which called this codepath ellipses is boolean value telling whether to send ellipses data or not returns changegroup data of the changegroup built or return None if there @@ -80,7 +79,7 @@ filematcher=diffmatcher, fullnodes=commonnodes) cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) + 'narrow_widen', changelog=False) return cgdata @@ -114,8 +113,7 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -cgdata = widen_bundle(repo, diffmatch, common, [], version, - source, False) +cgdata = widen_bundle(repo, diffmatch, common, [], version, False) if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -194,7 +192,7 @@ shallow=depth is not None, ellipsisroots=newellipsis, fullnodes=newfull) -cgdata = packer.generate(common, newvisit, False, source) +cgdata = packer.generate(common, newvisit, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -212,7 +210,7 @@ shallow=depth is not None, ellipsisroots=ellipsisroots, fullnodes=relevant_nodes) -cgdata = packer.generate(common, visitnodes, False, source) +cgdata = packer.generate(common, visitnodes, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
This revision was automatically updated to reflect the committed changes. Closed by commit rHGad9ca365738b: narrow: factor out logic to create cg while widening into separate fn (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4786?vs=11559=11566 REVISION DETAIL https://phab.mercurial-scm.org/D4786 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,6 +51,41 @@ caps[NARROWCAP] = ['v0'] return caps +def widen_bundle(repo, diffmatcher, common, known, cgversion, source, ellipses): +"""generates changegroup for widening a narrow clone + +repo is the localrepository instance +diffmatcher is a differencemacther of '(newincludes, newexcludes) - +(oldincludes, oldexcludes)' +common is set of common revs between server and client +known is a set of revs known on the client side (used in ellipses) +cgversion is the changegroup version to send +source is the command which called this codepath +ellipses is boolean value telling whether to send ellipses data or not + +returns changegroup data of the changegroup built or return None if there +are no common revs +""" +# XXX: This patch will start sending bundle2 after couple of patches when +# called from the wireprotocol command +common = repo.revs("::%ln", common) +commonnodes = set() +cl = repo.changelog +for c in common: +commonnodes.add(cl.node(c)) +if commonnodes: +# XXX: we should only send the filelogs (and treemanifest). user +# already has the changelog and manifest +packer = changegroup.getbundler(cgversion, repo, +filematcher=diffmatcher, +fullnodes=commonnodes) +cgdata = packer.generate(set([nullid]), list(commonnodes), False, + source, changelog=False) + +return cgdata + +return None + def getbundlechangegrouppart_widen(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, common=None, **kwargs): @@ -79,20 +114,9 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -common = repo.revs("::%ln", common) -commonnodes = set() -cl = repo.changelog -for c in common: -commonnodes.add(cl.node(c)) -if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest -packer = changegroup.getbundler(version, repo, -filematcher=diffmatch, -fullnodes=commonnodes) -cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) - +cgdata = widen_bundle(repo, diffmatch, common, [], version, + source, False) +if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) if 'treemanifest' in repo.requirements: To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
pulkit added a comment. I have not changed this patch much, just added a XXX, saying we should return a bundle from here. I changed https://phab.mercurial-scm.org/D4813 to return a bundle2 instead of just sending the changegroup and added a patch on top of it for returning a bundle2 from the new function introduced in this patch. INLINE COMMENTS > martinvonz wrote in narrowbundle2.py:54 > > Since ellipses case will require sending a bundle not a changegroup > > I'm not sure it will require that. The point of the "known" set was initially > just to make sure that the server included all nodes that the client may have > local commits based off of (see [1] and [2]). But then we realized that it > would make more sense for widening and narrowing not to add or remove any > ellipsis nodes. When interacting with our Google-internal server, that's how > it actually works. I don't think I got around to making the core server > completely trust the "known" set (or just the "common" set when not using > ellipses), but I still think that's the right direction. > > Maybe we should still wrap the returned changegroup in a bundle so we have > more flexibility? It may be useful at least for letting the server include > messages for the client. It's hard to say what else we may want to include in > the bundle later. > > [1] > https://bitbucket.org/Google/narrowhg/commits/8c6dba960138b2758d6a37147d8338f751a7a05c > [2] > https://bitbucket.org/Google/narrowhg/commits/ba65a969df547df0ccf26901bb3c5bd4e21445f2 > since ellipses case will require sending a bundle not a changegroup I said that because there is a 'narrow:changespec' part being send from the server. I still need to understand the ellipses case more in detail but I agree that "known" set can be helpful. > Maybe we should still wrap the returned changegroup in a bundle so we have > more flexibility? It may be useful at least for letting the server include > messages for the client. It's hard to say what else we may want to include in > the bundle later. This was a very good suggestion, thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4786 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: [RFC] narrow: the first version of narrow_widen wireprotocol command
pulkit added inline comments. INLINE COMMENTS > indygreg wrote in narrowwirepeer.py:71-78 > Do we need to call `narrowspec.restrictpatterns()` anywhere in here? I am not sure, @martinvonz what do you think? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4813 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: [RFC] narrow: the first version of narrow_widen wireprotocol command
pulkit updated this revision to Diff 11561. pulkit edited the summary of this revision. Herald added a reviewer: martinvonz. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4813?vs=11520=11561 REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,8 +104,7 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command + sending narrow_widen command bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) adding changesets @@ -115,12 +114,7 @@ adding widest/f revisions (tree !) added 0 changesets with 1 changes to 1 files bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published + bundle2-input-bundle: 0 parts total widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +137,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +174,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +277,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +367,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,22 @@ from __future__ import absolute_import from mercurial import ( +bundle2, extensions, hg, +match as matchmod, +narrowspec, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" @@ -37,3 +45,64 @@ return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, '_calltwowaystream', wrapped) hg.wirepeersetupfuncs.append(wirereposetup) + +@wireprotov1server.wireprotocommand('narrow_widen', '*', permission='pull') +def narrow_widen(repo, proto, args): +"""wireprotocol command to send data when a narrow clone is widen. We will +be sending a changegroup here. + +The current set of arguments which are required: +oldincludes: the old includes of the narrow copy +oldexcludes: the old excludes of the narrow copy +newincludes: the new includes of the narrow copy +newexcludes: the new excludes of the narrow copy +common: list of nodes which are common between the server and client +cgversion(maybe): the changegroup version to produce +known: list of nodes which are known on the client (used in ellipses cases) +ellipses: whether to send ellipses data or not +""" + +oldincludes = wireprototypes.decodelist(args.get('oldincludes')) +newincludes = wireprototypes.decodelist(args.get('newincludes')) +oldexcludes = wireprototypes.decodelist(args.get('oldexcludes')) +newexcludes = wireprototypes.decodelist(args.get('newexcludes')) +# validate the patterns +narrowspec.validatepatterns(set(oldincludes)) +narrowspec.validatepatterns(set(newincludes)) +
D4838: narrow: start returning bundle2 from widen_bundle()
pulkit 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4838 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -86,13 +86,8 @@ bundler = bundle2.bundle20(repo.ui) # get changegroup data -cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, cgversion, -ellipses) -if cg is not None: -part = bundler.newpart('changegroup', data=cg) -part.addparam('version', cgversion) -if 'treemanifest' in repo.requirements: -part.addparam('treemanifest', '1') +bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) chunks = bundler.getchunks() prefercompressed = True return wireprototypes.streamres(gen=chunks, diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -52,7 +52,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): -"""generates changegroup for widening a narrow clone +"""generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -62,11 +62,10 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not -returns changegroup data of the changegroup built or return None if there -are no common revs +returns bundle2 of the data required for extending """ -# XXX: This patch will start sending bundle2 after couple of patches when -# called from the wireprotocol command +bundler = bundle2.bundle20(repo.ui) + common = repo.revs("::%ln", common) commonnodes = set() cl = repo.changelog @@ -81,9 +80,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) -return cgdata +part = bundler.newpart('changegroup', data=cgdata) +part.addparam('version', cgversion) +if 'treemanifest' in repo.requirements: +part.addparam('treemanifest', '1') -return None +return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4787: narrow: pass 'narrow_widen' as source while generating changegroup
pulkit updated this revision to Diff 11560. Herald added a reviewer: martinvonz. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4787?vs=11470=11560 REVISION DETAIL https://phab.mercurial-scm.org/D4787 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,16 +51,15 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_bundle(repo, diffmatcher, common, known, cgversion, source, ellipses): +def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): """generates changegroup for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - (oldincludes, oldexcludes)' common is set of common revs between server and client known is a set of revs known on the client side (used in ellipses) cgversion is the changegroup version to send -source is the command which called this codepath ellipses is boolean value telling whether to send ellipses data or not returns changegroup data of the changegroup built or return None if there @@ -80,7 +79,7 @@ filematcher=diffmatcher, fullnodes=commonnodes) cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) + 'narrow_widen', changelog=False) return cgdata @@ -114,8 +113,7 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -cgdata = widen_bundle(repo, diffmatch, common, [], version, - source, False) +cgdata = widen_bundle(repo, diffmatch, common, [], version, False) if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -194,7 +192,7 @@ shallow=depth is not None, ellipsisroots=newellipsis, fullnodes=newfull) -cgdata = packer.generate(common, newvisit, False, source) +cgdata = packer.generate(common, newvisit, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -212,7 +210,7 @@ shallow=depth is not None, ellipsisroots=ellipsisroots, fullnodes=relevant_nodes) -cgdata = packer.generate(common, visitnodes, False, source) +cgdata = packer.generate(common, visitnodes, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
pulkit updated this revision to Diff 11559. pulkit edited the summary of this revision. Herald added a reviewer: martinvonz. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4786?vs=11469=11559 REVISION DETAIL https://phab.mercurial-scm.org/D4786 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,6 +51,41 @@ caps[NARROWCAP] = ['v0'] return caps +def widen_bundle(repo, diffmatcher, common, known, cgversion, source, ellipses): +"""generates changegroup for widening a narrow clone + +repo is the localrepository instance +diffmatcher is a differencemacther of '(newincludes, newexcludes) - +(oldincludes, oldexcludes)' +common is set of common revs between server and client +known is a set of revs known on the client side (used in ellipses) +cgversion is the changegroup version to send +source is the command which called this codepath +ellipses is boolean value telling whether to send ellipses data or not + +returns changegroup data of the changegroup built or return None if there +are no common revs +""" +# XXX: This patch will start sending bundle2 after couple of patches when +# called from the wireprotocol command +common = repo.revs("::%ln", common) +commonnodes = set() +cl = repo.changelog +for c in common: +commonnodes.add(cl.node(c)) +if commonnodes: +# XXX: we should only send the filelogs (and treemanifest). user +# already has the changelog and manifest +packer = changegroup.getbundler(cgversion, repo, +filematcher=diffmatcher, +fullnodes=commonnodes) +cgdata = packer.generate(set([nullid]), list(commonnodes), False, + source, changelog=False) + +return cgdata + +return None + def getbundlechangegrouppart_widen(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, common=None, **kwargs): @@ -79,20 +114,9 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -common = repo.revs("::%ln", common) -commonnodes = set() -cl = repo.changelog -for c in common: -commonnodes.add(cl.node(c)) -if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest -packer = changegroup.getbundler(version, repo, -filematcher=diffmatch, -fullnodes=commonnodes) -cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) - +cgdata = widen_bundle(repo, diffmatch, common, [], version, + source, False) +if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) if 'treemanifest' in repo.requirements: To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4837: narrow: remove narrowpatch instead of narrowcopies
This revision was automatically updated to reflect the committed changes. Closed by commit rHG813eb942ca0a: narrow: remove narrowpatch instead of narrowcopies (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4837?vs=11549=11550 REVISION DETAIL https://phab.mercurial-scm.org/D4837 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -23,7 +23,7 @@ from . import ( narrowbundle2, narrowcommands, -narrowpatch, +narrowcopies, narrowrepo, narrowtemplates, narrowwirepeer, @@ -65,7 +65,7 @@ if repository.NARROW_REQUIREMENT in repo.requirements: narrowrepo.wraprepo(repo) -narrowpatch.setup(repo) +narrowcopies.setup(repo) narrowwirepeer.reposetup(repo) templatekeyword = narrowtemplates.templatekeyword To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4837: narrow: remove narrowpatch instead of narrowcopies
pulkit 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 https://phab.mercurial-scm.org/rHG84092edd5c88bbb3c2a5de377cfd9ca79019fa39 removed narrowpatch.py and wanted to drop narrowpatch from __init__.py but mistakenly removed narrowcopies. This will make buildbots green again. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4837 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -23,7 +23,7 @@ from . import ( narrowbundle2, narrowcommands, -narrowpatch, +narrowcopies, narrowrepo, narrowtemplates, narrowwirepeer, @@ -65,7 +65,7 @@ if repository.NARROW_REQUIREMENT in repo.requirements: narrowrepo.wraprepo(repo) -narrowpatch.setup(repo) +narrowcopies.setup(repo) narrowwirepeer.reposetup(repo) templatekeyword = narrowtemplates.templatekeyword To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4823: narrow: drop unnecessary overrides of patch
pulkit added inline comments. INLINE COMMENTS > __init__.py:71 > narrowrepo.wraprepo(repo) > -narrowcopies.setup(repo) > narrowpatch.setup(repo) I think you want to delete narrowpatch here, not narrowcopies. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4823 To: martinvonz, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa24f4638d6c1: narrow: move the ellipses server capability to core (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4809?vs=11516=11524 REVISION DETAIL https://phab.mercurial-scm.org/D4809 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -39,6 +39,7 @@ HGERRTYPE = 'application/hg-error' NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -14,17 +14,15 @@ wireprotov1server, ) -ELLIPSESCAP = 'exp-ellipses-1' - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(ELLIPSESCAP) +caps.append(wireprotoserver.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -13,7 +13,6 @@ from . import ( narrowdirstate, -narrowwirepeer, ) def wraprepo(repo): @@ -28,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(narrowwirepeer.ELLIPSESCAP) +peer._caps.add(wireprotoserver.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -32,10 +32,6 @@ wireprotoserver, ) -from . import ( -narrowwirepeer, -) - table = {} command = registrar.command(table) @@ -148,7 +144,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] To: pulkit, durin42, #hg-reviewers, indygreg Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4808: narrow: move the wireprotocol narrow capability name to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd5498db5f86a: narrow: move the wireprotocol narrow capability name to core (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4808?vs=11499=11523 REVISION DETAIL https://phab.mercurial-scm.org/D4808 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -38,6 +38,8 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' +NARROWCAP = 'exp-narrow-1' + SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -10,19 +10,19 @@ from mercurial import ( extensions, hg, +wireprotoserver, wireprotov1server, ) -NARROWCAP = 'exp-narrow-1' ELLIPSESCAP = 'exp-ellipses-1' def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) -caps.append(NARROWCAP) +caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): caps.append(ELLIPSESCAP) return caps diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -7,6 +7,10 @@ from __future__ import absolute_import +from mercurial import ( +wireprotoserver, +) + from . import ( narrowdirstate, narrowwirepeer, @@ -23,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() -peer._caps.add(narrowwirepeer.NARROWCAP) +peer._caps.add(wireprotoserver.NARROWCAP) peer._caps.add(narrowwirepeer.ELLIPSESCAP) return peer diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -29,6 +29,7 @@ repoview, sparse, util, +wireprotoserver, ) from . import ( @@ -136,7 +137,7 @@ if repository.NARROW_REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) -if narrowwirepeer.NARROWCAP not in pullop.remote.capabilities(): +if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): raise error.Abort(_("server doesn't support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True To: pulkit, durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
pulkit added a comment. @martinvonz I have removed the logic of adding a new ellipses requirement from current series as coupling that and this series for review turned out to be a bad idea. This series now only tries to do some cleanup and introduce a new wireprotocol command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4809 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4789: narrow: check for servers' narrow support before doing anything (BC)
pulkit added a comment. In https://phab.mercurial-scm.org/D4789#72717, @martinvonz wrote: > > This is BC because new clients won't be able to extend from old narrow-enabled servers. > > I think your previous patch was also BC in that sense since it started requiring the server to have the ellipses wire capability when widening with ellipsis nodes. It's not a problem for us to add that capability (we already have), but you may want to mention it there for consistency :), if I understood that right. I am not whether that patch stands as a BC but yes, the whole rework and refactoring during this cycle make big BC's in how narrow extension work and I doubt that a client with hg-4.8 will be able to use narrow with server which is at hg-4.7. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4789 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4810: repository: introduce an ellipses repo requirement
pulkit planned changes to this revision. pulkit added a comment. Let's do this step by step and get the wireprotocol command reviewed first. Once that is done, I will resend this one. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4810 To: pulkit, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: [RFC] narrow: the first version of narrow_widen wireprotocol command
pulkit updated this revision to Diff 11520. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4813?vs=11505=11520 REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,23 +104,13 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command - bundle2-input-bundle: with-transaction - bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) + sending narrow_widen command adding changesets adding manifests adding widest/ revisions (tree !) adding file changes - adding widest/f revisions (tree !) + adding widest/f revisions added 0 changesets with 1 changes to 1 files - bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +133,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +170,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +273,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +363,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,23 @@ from __future__ import absolute_import from mercurial import ( +changegroup, extensions, hg, +match as matchmod, +narrowspec, +util, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" @@ -37,3 +46,44 @@ return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, '_calltwowaystream', wrapped) hg.wirepeersetupfuncs.append(wirereposetup) + +@wireprotov1server.wireprotocommand('narrow_widen', '*', permission='pull') +def narrow_widen(repo, proto, args): +"""wireprotocol command to send data when a narrow clone is widen. We will +be sending a changegroup here. + +The current set of arguments which are required: +oldincludes: the old includes of the narrow copy +oldexcludes: the old excludes of the narrow copy +newincludes: the new includes of the narrow copy +newexcludes: the new excludes of the narrow copy +common: set of nodes which are common between the server and client +cgversion(maybe): the changegroup version to produce +known: set of nodes which are known on the client (used in ellipses cases) +""" + +oldincludes = wireprototypes.decodelist(args.get('oldincludes')) +newincludes = wireprototypes.decodelist(args.get('newincludes')) +oldexcludes = wireprototypes.decodelist(args.get('oldexcludes')) +newexcludes = wireprototypes.decodelist(args.get('newexcludes')) +common = wireprototypes.decodelist(args.get('common')) +cgversion = args.get('cgversion') +newmatch = narrowspec.match(repo.root, include=newincludes, +exclude=newexcludes) +oldmatch = narrowspec.match(repo.root,
D4789: narrow: check for servers' narrow support before doing anything (BC)
pulkit updated this revision to Diff 11518. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4789?vs=11503=11518 REVISION DETAIL https://phab.mercurial-scm.org/D4789 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-clone-non-narrow-server.t tests/test-narrow-clone.t CHANGE DETAILS diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -65,7 +65,7 @@ $ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" requesting all changes - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] $ hg tracked -R narrow-via-localpeer abort: repository narrow-via-localpeer not found! diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -39,7 +39,7 @@ $ hg clone --narrow --include f1 http://localhost:$HGPORT1/ narrowclone requesting all changes - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] Make a narrow clone (via HGPORT2), then try to narrow and widen @@ -60,7 +60,5 @@ looking for local changes to affected paths $ hg tracked --addinclude f1 http://localhost:$HGPORT1/ comparing with http://localhost:$HGPORT1/ - searching for changes - no changes found - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -134,7 +134,7 @@ return orig(pullop, kwargs) if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): -raise error.Abort(_("server doesn't support narrow clones")) +raise error.Abort(_("server does not support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True include, exclude = repo.narrowpats @@ -408,6 +408,13 @@ url, branches = hg.parseurl(remotepath) ui.status(_('comparing with %s\n') % util.hidepassword(url)) remote = hg.peer(repo, opts, url) + +# check narrow support before doing anything if widening needs to be +# performed. In future we should also abort if client is ellipses and +# server does not support ellipses +if widening and wireprotoserver.NARROWCAP not in remote.capabilities(): +raise error.Abort(_("server does not support narrow clones")) + commoninc = discovery.findcommonincoming(repo, remote) oldincludes, oldexcludes = repo.narrowpats To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4812: narrow: pass old includes and excludes to _widen()
pulkit updated this revision to Diff 11519. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4812?vs=11504=11519 REVISION DETAIL https://phab.mercurial-scm.org/D4812 AFFECTED FILES hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -248,7 +248,8 @@ repo.destroyed() -def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): +def _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes, + newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) # for now we assume that if a server has ellipses enabled, we will be @@ -433,6 +434,7 @@ if widening: newincludes = oldincludes | addedincludes newexcludes = oldexcludes - removedexcludes -_widen(ui, repo, remote, commoninc, newincludes, newexcludes) +_widen(ui, repo, remote, commoninc, oldincludes, oldexcludes, +newincludes, newexcludes) return 0 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit updated this revision to Diff 11517. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4788?vs=11502=11517 REVISION DETAIL https://phab.mercurial-scm.org/D4788 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -88,6 +88,9 @@ added upstream revisions. $ cd narrow + $ hg id -n + 2 + $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) @@ -127,6 +130,9 @@ $ cat widest/f widest + $ hg id -n + 2 + Pull down the newly added upstream revision. $ hg pull diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -251,6 +251,14 @@ def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) +# for now we assume that if a server has ellipses enabled, we will be +# exchanging ellipses nodes. In future we should add ellipses as a client +# side requirement (maybe) to distinguish a client is shallow or not and +# then send that information to server whether we want ellipses or not. +# Theoretically a non-ellipses repo should be able to use narrow +# functionality from an ellipses enabled server +ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities() + def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -269,15 +277,21 @@ overrides = {('devel', 'all-warnings'): False} with ui.uninterruptable(): -ds = repo.dirstate -p1, p2 = ds.p1(), ds.p2() -with ds.parentchange(): -ds.setparents(node.nullid, node.nullid) common = commoninc[0] -with wrappedextraprepare, repo.ui.configoverride(overrides, 'widen'): -exchange.pull(repo, remote, heads=common) -with ds.parentchange(): -ds.setparents(p1, p2) +if ellipsesremote: +ds = repo.dirstate +p1, p2 = ds.p1(), ds.p2() +with ds.parentchange(): +ds.setparents(node.nullid, node.nullid) +with wrappedextraprepare,\ + repo.ui.configoverride(overrides, 'widen'): +exchange.pull(repo, remote, heads=common) +with ds.parentchange(): +ds.setparents(p1, p2) +else: +with wrappedextraprepare,\ + repo.ui.configoverride(overrides, 'widen'): +exchange.pull(repo, remote, heads=common) repo.setnewnarrowpats() actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
pulkit updated this revision to Diff 11516. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4809?vs=11500=11516 REVISION DETAIL https://phab.mercurial-scm.org/D4809 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -39,6 +39,7 @@ HGERRTYPE = 'application/hg-error' NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -14,17 +14,15 @@ wireprotov1server, ) -ELLIPSESCAP = 'exp-ellipses-1' - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(ELLIPSESCAP) +caps.append(wireprotoserver.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -13,7 +13,6 @@ from . import ( narrowdirstate, -narrowwirepeer, ) def wraprepo(repo): @@ -28,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(narrowwirepeer.ELLIPSESCAP) +peer._caps.add(wireprotoserver.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -32,10 +32,6 @@ wireprotoserver, ) -from . import ( -narrowwirepeer, -) - table = {} command = registrar.command(table) @@ -148,7 +144,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit added a comment. In https://phab.mercurial-scm.org/D4788#72714, @martinvonz wrote: > In https://phab.mercurial-scm.org/D4788#72444, @pulkit wrote: > > > I am not sure about this one. I was unable to think of a reason why we need to do this dirstate dance in non-ellipses cases. @martinvonz @durin42 do you know why we do this? > > > What I usually do when I can't understand why something is needed: remove the code and run tests :) That will often tell you there there was in fact a reason for the code and give you some hints what that reason is. Of course, in some cases it won't tell you that and then you'll have to figure out if it's just untested or actually useless. Do you mean lines 279-280 of `hgext/narrow/narrowcommands.py` before this patch? If you remove those lines, you will see that `test-narrow{,patterns,widen,widen-no-ellipsis}.t` fail. You were right about the reason for the first `setparent()` call, btw. The reason for the code is so we move back to the old commit once we've restored the temporarily stripped commits. And in non-ellipses cases, we are not stripping commits, so we can easily make this only execute when ellipses is enabled. INLINE COMMENTS > martinvonz wrote in narrowcommands.py:254-260 > You have add the requirement earlier in the series, so you can just use that > here? (I suspect this is a leftover from an earlier version of this patch.) I think it's getting confusing for me and suspect bit hard for you too as the series tries to do two quite different yet related things. I will drop the ellipses requirement patch from this series and will first concentrate on the introducing wireprotocol command and the ellipses requirement thing as a seperate series when the wireprotocol one is reviewed and pushed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4788 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4787: narrow: pass 'narrow_widen' as source while generating changegroup
pulkit added a comment. In https://phab.mercurial-scm.org/D4787#72712, @martinvonz wrote: > > Although this is called as a part of exchange.pull(), we don't want other > > extensions to wrap this pull call because it's not a normal pull and it's > > widening. > > I don't follow this. How does this prevent extensions from wrapping the pull? Do you mean that extensions that inspect the `source` parameter should not treat it like a normal pull? The `source` parameter also seems to be passed to hooks, btw (it probably makes sense to differentiate widening from pulling there too). Yes, I looked into the code where `source` parameter is used and it says the extension requires it. I think wrapping pull sounds to generic, I will improve the commit description. Thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4787 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in narrowbundle2.py:54 > Do you plan to add support for ellipses to this too? I don't know if you need > that feature, but I think the coming wire protocol command should eventually > gain support for ellipsis nodes. Do you think a TODO about that makes sense? > (I imagine it requires including the "known" set if the local repo has the > ellipses requirement.) I do plan to support ellipses with the wireprotocol command. Since ellipses case will require sending a bundle not a changegroup, I plan to make that as a seperate function and call the required functions depending on ellipses is enabled or not. Yeah the "known" set is needed. I also forgot to include that in wireprotocol command. Thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4786 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4817: py3: whitelist two additional tests
pulkit added a comment. I removed the duplicate entry of `test-debugcommands.t` and amended the commit message to say one test and queued, many thanks! INLINE COMMENTS > python3-whitelist:107 > test-debugcommands.t > +test-debugcommands.t > test-debugextensions.t This already exists on the above line. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4817 To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4814: py3: add one more passing test to whitelist caught by buildbot
This revision was automatically updated to reflect the committed changes. Closed by commit rHGeca452fa99b5: py3: add one more passing test to whitelist caught by buildbot (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4814?vs=11506=11509 REVISION DETAIL https://phab.mercurial-scm.org/D4814 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -103,6 +103,7 @@ test-copytrace-heuristics.t test-debugbuilddag.t test-debugbundle.t +test-debugcommands.t test-debugextensions.t test-debugindexdot.t test-debugrename.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4810: repository: introduce an ellipses repo requirement
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in repository.py:22-24 > I'm not sure I understand what this says. > > The first sentence sounds too obvious to mention (kind of like "when it's > done, it should be working well"), but I suspect you mean something else. Do > you mean that that's the criteria for dropping the "exp-" prefix (much like > the comment for narrow says above)? > > I don't know what the second sentence says either. Isn't it already > generalized to shallow and ellipses? Yeah, the intent was to say the same thing as the comment about NARROW_REQUIREMENT says but re-reading myself, looks like I messed up. I will update this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4810 To: pulkit, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in test-narrow-clone.t:48 > This doesn't look right. I suspect it was done by a mistaken `run-tests.py -i` I just ran `run-tests.py -i` and it popped up and I accepted it. I will check if the test pass without this change or not. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4809 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4664: mergecommit: add a new extension to merge in-memory and create a commit
pulkit added a comment. Thinking about this more, I think I have not done a good job writing commit message. The extension is very useful when you have automation around merges or you do merges because of the following reasons: - The merge is done in-memory and is very fast if you disable the path conflicts auditing - You can specify a merge destination using --dest flag, which means you don't need to update to merge. You can merge two changesets from anywhere - You can parallelize multiple merges - This can be used as --dry-run for hg merge as it can tell whether a merge will result in conflicts or not without applying anything That said, I am not sure if this looks like a good candidate for in-core extension. However, we want to share the work we have done on speeding up merge internally so that it can help other companies which uses merges. So, feel free to pick this up from here if you need this. :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4664 To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4814: py3: add one more passing test to whitelist caught by buildbot
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Thanks to Matt Harbison who fixed the remaining failures of this test. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4814 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -103,6 +103,7 @@ test-copytrace-heuristics.t test-debugbuilddag.t test-debugbundle.t +test-debugcommands.t test-debugextensions.t test-debugindexdot.t test-debugrename.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4813: [RFC] narrow: the first version of narrow_widen wireprotocol command
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch introduces a wireprotocol command narrow_widen() which will be used to widen a narrow copy using `hg tracked` command provided by narrow extension. The wireprotocol command takes the old and new includes and excludes, common heads, changegroup version and generates a changegroup of the required data and send it. The clients receives the changegroup and applies that. I am not sure whether we need changegroup version as an argument to the command as I *think* narrow needs changegroup3. This is my first working attempt on having a wireprotocol command, I have mostly copied code from existing commands. I need to specify the arguments instead of just specifying "*". I think one more argument which will be required is ellipses which will tell whether the widening request is ellipses based or not. This will help in ellipses enabled server to serve request to non-ellipses based clients. The tests shows that we don't exchange phase data now while widening which is nice. I think porting this command to ellipses cases will still require exchanging bundle2 or we need to refactor how KILLS are send. Any suggestion on that will be greatly loved. This is an RFC because it's working but I don't have strong understanding of some parts how they work like having a cgunpacker both on server and client sides. All the tests passes except pyflakes because we are not using the value of ret after applying changegorup in narrowcommands.py REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4813 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowwirepeer.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -104,23 +104,13 @@ sending batch command searching for changes all local heads known remotely - no changes found - sending getbundle command - bundle2-input-bundle: with-transaction - bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) + sending narrow_widen command adding changesets adding manifests adding widest/ revisions (tree !) adding file changes - adding widest/f revisions (tree !) + adding widest/f revisions added 0 changesets with 1 changes to 1 files - bundle2-input-part: total payload size * (glob) - bundle2-input-part: "listkeys" (params: 1 mandatory) supported - bundle2-input-part: "phase-heads" supported - bundle2-input-part: total payload size 24 - bundle2-input-bundle: 2 parts total - checking for updated bookmarks - 3 local changesets published widest/f: add from widened narrow clone -> g getting widest/f $ hg tracked @@ -143,6 +133,7 @@ adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) + 3 local changesets published (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -179,12 +170,10 @@ $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 5 local changesets published $ hg tracked I path:inside I path:wider @@ -284,12 +273,10 @@ $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg tracked I path:d0 I path:d1 @@ -376,12 +363,10 @@ $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes - no changes found adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files - 11 local changesets published $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -8,14 +8,23 @@ from __future__ import absolute_import from mercurial import ( +changegroup, extensions, hg, +match as matchmod, +narrowspec, +util, wireprotoserver, +wireprototypes, +wireprotov1peer, wireprotov1server, ) +from . import narrowbundle2 + def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) +wireprotov1peer.wirepeer.narrow_widen =
D4812: narrow: pass old includes and excludes to _widen()
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In future patches we will need to pass them in the widen wireprotocol command which we are building. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4812 AFFECTED FILES hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -248,7 +248,8 @@ repo.destroyed() -def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): +def _widen(ui, repo, remote, commoninc, newincludes, newexcludes, + oldincludes, oldexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) # for now we assume that if a server has ellipses enabled, we will be @@ -431,6 +432,7 @@ if widening: newincludes = oldincludes | addedincludes newexcludes = oldexcludes - removedexcludes -_widen(ui, repo, remote, commoninc, newincludes, newexcludes) +_widen(ui, repo, remote, commoninc, newincludes, newexcludes, +oldincludes, oldexcludes) return 0 To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4789: narrow: check for servers' narrow support before doing anything (BC)
pulkit updated this revision to Diff 11503. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4789?vs=11472=11503 REVISION DETAIL https://phab.mercurial-scm.org/D4789 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -60,7 +60,5 @@ looking for local changes to affected paths $ hg tracked --addinclude f1 http://localhost:$HGPORT1/ comparing with http://localhost:$HGPORT1/ - searching for changes - no changes found - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -406,6 +406,13 @@ url, branches = hg.parseurl(remotepath) ui.status(_('comparing with %s\n') % util.hidepassword(url)) remote = hg.peer(repo, opts, url) + +# check narrow support before doing anything if widening needs to be +# performed. In future we should also abort if client is ellipses and +# server does not support ellipses +if widening and wireprotoserver.NARROWCAP not in remote.capabilities(): +raise error.Abort(_("server does not support narrow clones")) + commoninc = discovery.findcommonincoming(repo, remote) oldincludes, oldexcludes = repo.narrowpats To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit updated this revision to Diff 11502. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4788?vs=11471=11502 REVISION DETAIL https://phab.mercurial-scm.org/D4788 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -88,6 +88,9 @@ added upstream revisions. $ cd narrow + $ hg id -n + 2 + $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) @@ -127,6 +130,9 @@ $ cat widest/f widest + $ hg id -n + 2 + Pull down the newly added upstream revision. $ hg pull diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -251,6 +251,14 @@ def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) +# for now we assume that if a server has ellipses enabled, we will be +# exchanging ellipses nodes. In future we should add ellipses as a client +# side requirement (maybe) to distinguish a client is shallow or not and +# then send that information to server whether we want ellipses or not. +# Theoretically a non-ellipses repo should be able to use narrow +# functionality from an ellipses enabled server +ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities() + def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -268,16 +276,20 @@ # silence the devel-warning of applying an empty changegroup overrides = {('devel', 'all-warnings'): False} -with ui.uninterruptable(): -ds = repo.dirstate -p1, p2 = ds.p1(), ds.p2() -with ds.parentchange(): -ds.setparents(node.nullid, node.nullid) +with ui.uninterruptable(), repo.ui.configoverride(overrides, 'widen'): common = commoninc[0] -with wrappedextraprepare, repo.ui.configoverride(overrides, 'widen'): -exchange.pull(repo, remote, heads=common) -with ds.parentchange(): -ds.setparents(p1, p2) +if ellipsesremote: +ds = repo.dirstate +p1, p2 = ds.p1(), ds.p2() +with ds.parentchange(): +ds.setparents(node.nullid, node.nullid) +with wrappedextraprepare: +exchange.pull(repo, remote, heads=common) +with ds.parentchange(): +ds.setparents(p1, p2) +else: +with wrappedextraprepare: +exchange.pull(repo, remote, heads=common) repo.setnewnarrowpats() actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
pulkit updated this revision to Diff 11500. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4809?vs=11492=11500 REVISION DETAIL https://phab.mercurial-scm.org/D4809 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/hg.py mercurial/localrepo.py mercurial/wireprotoserver.py tests/test-narrow-clone.t CHANGE DETAILS diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -40,11 +40,12 @@ $ cd narrow $ cat .hg/requires | grep -v generaldelta dotencode + exp-ellipses fncache narrowhg-experimental revlogv1 + testonly-simplestore (reposimplestore !) store - testonly-simplestore (reposimplestore !) $ hg tracked I path:dir/src/f10 diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -39,6 +39,7 @@ HGERRTYPE = 'application/hg-error' NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2807,6 +2807,9 @@ if createopts.get('narrowfiles'): requirements.add(repository.NARROW_REQUIREMENT) +if createopts.get('ellipses'): +requirements.add(repository.ELLIPSES_REQUIREMENT) + return requirements def filterknowncreateopts(ui, createopts): @@ -2824,6 +2827,7 @@ they know how to handle. """ known = { +'ellipses', 'narrowfiles', 'sharedrepo', 'sharedrelative', diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -47,6 +47,7 @@ util, verify as verifymod, vfs as vfsmod, +wireprotoserver, ) release = lock.release @@ -578,6 +579,9 @@ createopts['narrowfiles'] = True +if srcpeer.capable(wireprotoserver.ELLIPSESCAP): +createopts['ellipses'] = True + shareopts = shareopts or {} sharepool = shareopts.get('pool') sharenamemode = shareopts.get('mode') diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -14,17 +14,15 @@ wireprotov1server, ) -ELLIPSESCAP = 'exp-ellipses-1' - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(ELLIPSESCAP) +caps.append(wireprotoserver.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -13,7 +13,6 @@ from . import ( narrowdirstate, -narrowwirepeer, ) def wraprepo(repo): @@ -28,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(narrowwirepeer.ELLIPSESCAP) +peer._caps.add(wireprotoserver.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -32,10 +32,6 @@ wireprotoserver, ) -from . import ( -narrowwirepeer, -) - table = {} command = registrar.command(table) @@ -148,7 +144,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -53,6 +53,7 @@ def featuresetup(ui, features): features.add(repository.NARROW_REQUIREMENT) +features.add(repository.ELLIPSES_REQUIREMENT) def uisetup(ui): """Wraps user-facing mercurial commands with narrow-aware versions.""" To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4810: repository: introduce an ellipses repo requirement
pulkit updated this revision to Diff 11501. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4810?vs=11493=11501 REVISION DETAIL https://phab.mercurial-scm.org/D4810 AFFECTED FILES mercurial/repository.py CHANGE DETAILS diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -19,6 +19,11 @@ # we should move this to just "narrow" or similar. NARROW_REQUIREMENT = 'narrowhg-experimental' +# When ellipses and shallowing is finalized and the UI is done, there are no +# more edge cases where things don't work. This should be generalised to shallow +# or ellipses +ELLIPSES_REQUIREMENT = 'exp-ellipses' + # Local repository feature string. # Revlogs are being used for file storage. To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4808: narrow: move the wireprotocol narrow capability name to core
pulkit updated this revision to Diff 11499. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4808?vs=11491=11499 REVISION DETAIL https://phab.mercurial-scm.org/D4808 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -38,6 +38,8 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' +NARROWCAP = 'exp-narrow-1' + SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -10,19 +10,19 @@ from mercurial import ( extensions, hg, +wireprotoserver, wireprotov1server, ) -NARROWCAP = 'exp-narrow-1' ELLIPSESCAP = 'exp-ellipses-1' def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) -caps.append(NARROWCAP) +caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): caps.append(ELLIPSESCAP) return caps diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -7,6 +7,10 @@ from __future__ import absolute_import +from mercurial import ( +wireprotoserver, +) + from . import ( narrowdirstate, narrowwirepeer, @@ -23,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() -peer._caps.add(narrowwirepeer.NARROWCAP) +peer._caps.add(wireprotoserver.NARROWCAP) peer._caps.add(narrowwirepeer.ELLIPSESCAP) return peer diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -29,6 +29,7 @@ repoview, sparse, util, +wireprotoserver, ) from . import ( @@ -136,7 +137,7 @@ if repository.NARROW_REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) -if narrowwirepeer.NARROWCAP not in pullop.remote.capabilities(): +if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): raise error.Abort(_("server doesn't support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4811: py3: use util.forcebytestr() to convert error messages to bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7eb937f598d1: py3: use util.forcebytestr() to convert error messages to bytes (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4811?vs=11495=11498 REVISION DETAIL https://phab.mercurial-scm.org/D4811 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2669,7 +2669,8 @@ state['skipread'].add(node) except Exception as e: yield revlogproblem( -error=_('unpacking %s: %s') % (short(node), e), +error=_('unpacking %s: %s') % (short(node), + stringutil.forcebytestr(e)), node=node) state['skipread'].add(node) To: pulkit, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4811: py3: use util.forcebytestr() to convert error messages to bytes
pulkit created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This makes the python 3 buildbot green again. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4811 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2669,7 +2669,8 @@ state['skipread'].add(node) except Exception as e: yield revlogproblem( -error=_('unpacking %s: %s') % (short(node), e), +error=_('unpacking %s: %s') % (short(node), + stringutil.forcebytestr(e)), node=node) state['skipread'].add(node) To: pulkit, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4809: narrow: move the ellipses server capability to core
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will be used in core logic to determining whether a server is ellipses enabled or not. And also this will ease moving narrow related things to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4809 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/hg.py mercurial/localrepo.py mercurial/wireprotoserver.py tests/test-narrow-clone.t CHANGE DETAILS diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -40,11 +40,12 @@ $ cd narrow $ cat .hg/requires | grep -v generaldelta dotencode + exp-ellipses fncache narrowhg-experimental revlogv1 + testonly-simplestore (reposimplestore !) store - testonly-simplestore (reposimplestore !) $ hg tracked I path:dir/src/f10 diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -39,6 +39,7 @@ HGERRTYPE = 'application/hg-error' NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2807,6 +2807,9 @@ if createopts.get('narrowfiles'): requirements.add(repository.NARROW_REQUIREMENT) +if createopts.get('ellipses'): +requirements.add(repository.ELLIPSES_REQUIREMENT) + return requirements def filterknowncreateopts(ui, createopts): @@ -2824,6 +2827,7 @@ they know how to handle. """ known = { +'ellipses', 'narrowfiles', 'sharedrepo', 'sharedrelative', diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -47,6 +47,7 @@ util, verify as verifymod, vfs as vfsmod, +wireprotoserver, ) release = lock.release @@ -578,6 +579,9 @@ createopts['narrowfiles'] = True +if srcpeer.capable(wireprotoserver.ELLIPSESCAP): +createopts['ellipses'] = True + shareopts = shareopts or {} sharepool = shareopts.get('pool') sharenamemode = shareopts.get('mode') diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -14,17 +14,15 @@ wireprotov1server, ) -ELLIPSESCAP = 'exp-ellipses-1' - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): -caps.append(ELLIPSESCAP) +caps.append(wireprotoserver.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -13,7 +13,6 @@ from . import ( narrowdirstate, -narrowwirepeer, ) def wraprepo(repo): @@ -28,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() peer._caps.add(wireprotoserver.NARROWCAP) -peer._caps.add(narrowwirepeer.ELLIPSESCAP) +peer._caps.add(wireprotoserver.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -32,10 +32,6 @@ wireprotoserver, ) -from . import ( -narrowwirepeer, -) - table = {} command = registrar.command(table) @@ -148,7 +144,7 @@ kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes -if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities(): +if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -53,6 +53,7 @@ def featuresetup(ui, features): features.add(repository.NARROW_REQUIREMENT) +features.add(repository.ELLIPSES_REQUIREMENT) def uisetup(ui): """Wraps user-facing mercurial commands with narrow-aware versions.""" To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel
D4810: repository: introduce an ellipses repo requirement
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Right now there is no good way to check whether a repo is ellipses enabled or not. This patch introduces a ellipses repo requirement which will be used in upcoming patches. I have purposefully not included narrow in the requirement name because now they are looking different concepts to me. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4810 AFFECTED FILES mercurial/repository.py CHANGE DETAILS diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -19,6 +19,11 @@ # we should move this to just "narrow" or similar. NARROW_REQUIREMENT = 'narrowhg-experimental' +# When ellipses and shallowing is finalized and the UI is done, there are no +# more edge cases where things don't work. This should be generalised to shallow +# or ellipses +ELLIPSES_REQUIREMENT = 'exp-ellipses' + # Local repository feature string. # Revlogs are being used for file storage. To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4808: narrow: move the wireprotocol narrow capability name to core
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We are trying to integrate the whole of narrow logic into core and it will be helpful for upcoming patches to have these capability names in core. The next patch will move the ellipses capability to core also. The exact motivation is to know whether we are cloning a ellipses repo or not and adding an ellipses repo requirement. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4808 AFFECTED FILES hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -38,6 +38,8 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' +NARROWCAP = 'exp-narrow-1' + SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2 diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -10,19 +10,19 @@ from mercurial import ( extensions, hg, +wireprotoserver, wireprotov1server, ) -NARROWCAP = 'exp-narrow-1' ELLIPSESCAP = 'exp-ellipses-1' def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): """add the narrow capability to the server""" caps = orig(repo, proto) -caps.append(NARROWCAP) +caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): caps.append(ELLIPSESCAP) return caps diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -7,6 +7,10 @@ from __future__ import absolute_import +from mercurial import ( +wireprotoserver, +) + from . import ( narrowdirstate, narrowwirepeer, @@ -23,7 +27,7 @@ def peer(self): peer = super(narrowrepository, self).peer() -peer._caps.add(narrowwirepeer.NARROWCAP) +peer._caps.add(wireprotoserver.NARROWCAP) peer._caps.add(narrowwirepeer.ELLIPSESCAP) return peer diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -29,6 +29,7 @@ repoview, sparse, util, +wireprotoserver, ) from . import ( @@ -136,7 +137,7 @@ if repository.NARROW_REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) -if narrowwirepeer.NARROWCAP not in pullop.remote.capabilities(): +if wireprotoserver.NARROWCAP not in pullop.remote.capabilities(): raise error.Abort(_("server doesn't support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit added a subscriber: martinvonz. pulkit added a comment. I am not sure about this one. I was unable to think of a reason why we need to do this dirstate dance in non-ellipses cases. @martinvonz @durin42 do you know why we do this? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4788 To: pulkit, durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4789: narrow: check for servers' narrow support before doing anything (BC)
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Recently we introduced narrow capabilities for the server. So we can check whether a server has narrow clone support or not before doing anything. This is BC because new clients won't be able to extend from old narrow-enabled servers. I *think* narrow is not used much (maybe just inside Google), also it's experimental so I think we can change this. We will need to this someday anyway. The "doesn't" in error is changed to "does not" because I think that's we do in core and also thats what I typed while writing the error message. I am fine with that being dropped too. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4789 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -60,7 +60,5 @@ looking for local changes to affected paths $ hg tracked --addinclude f1 http://localhost:$HGPORT1/ comparing with http://localhost:$HGPORT1/ - searching for changes - no changes found - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255] diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -407,6 +407,13 @@ url, branches = hg.parseurl(remotepath) ui.status(_('comparing with %s\n') % util.hidepassword(url)) remote = hg.peer(repo, opts, url) + +# check narrow support before doing anything if widening needs to be +# performed. In future we should also abort if client is ellipses and +# server does not support ellipses +if widening and narrowwirepeer.NARROWCAP not in remote.capabilities(): +raise error.Abort(_("server does not support narrow clones")) + commoninc = discovery.findcommonincoming(repo, remote) oldincludes, oldexcludes = repo.narrowpats To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4788: narrow: don't do the dirstate dance if ellipses is not enabled
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I believe we set dirstate parents to nullid before widening pull because in ellipses cases, the parent might be stripped off with a new changeset. However the second ds.setparents() call invalidate my assumption. I am not sure why we do this. So here is a patch. This patch also adds tests showing we break nothing in non-ellipses cases. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4788 AFFECTED FILES hgext/narrow/narrowcommands.py tests/test-narrow-widen-no-ellipsis.t CHANGE DETAILS diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t --- a/tests/test-narrow-widen-no-ellipsis.t +++ b/tests/test-narrow-widen-no-ellipsis.t @@ -88,6 +88,9 @@ added upstream revisions. $ cd narrow + $ hg id -n + 2 + $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) @@ -127,6 +130,9 @@ $ cat widest/f widest + $ hg id -n + 2 + Pull down the newly added upstream revision. $ hg pull diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -254,6 +254,14 @@ def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) +# for now we assume that if a server has ellipses enabled, we will be +# exchanging ellipses nodes. In future we should add ellipses as a client +# side requirement (maybe) to distinguish a client is shallow or not and +# then send that information to server whether we want ellipses or not. +# Theoretically a non-ellipses repo should be able to use narrow +# functionality from an ellipses enabled server +ellipsesremote = narrowwirepeer.ELLIPSESCAP in remote.capabilities() + def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -272,15 +280,17 @@ overrides = {('devel', 'all-warnings'): False} with ui.uninterruptable(): -ds = repo.dirstate -p1, p2 = ds.p1(), ds.p2() -with ds.parentchange(): -ds.setparents(node.nullid, node.nullid) +if ellipsesremote: +ds = repo.dirstate +p1, p2 = ds.p1(), ds.p2() +with ds.parentchange(): +ds.setparents(node.nullid, node.nullid) common = commoninc[0] with wrappedextraprepare, repo.ui.configoverride(overrides, 'widen'): exchange.pull(repo, remote, heads=common) -with ds.parentchange(): -ds.setparents(p1, p2) +if ellipsesremote: +with ds.parentchange(): +ds.setparents(p1, p2) repo.setnewnarrowpats() actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4787: narrow: pass 'narrow_widen' as source while generating changegroup
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Although this is called as a part of exchange.pull(), we don't want other extensions to wrap this pull call because it's not a normal pull and it's widening. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4787 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,15 +51,14 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_changegroup(repo, diffmatcher, common, cgversion, source): +def widen_changegroup(repo, diffmatcher, common, cgversion): """generates changegroup for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - (oldincludes, oldexcludes)' common is set of common revs between server and client cgversion is the changegroup version to send -source is the command which called this codepath returns changegroup data of the changegroup built or return None if there are no common revs @@ -76,7 +75,7 @@ filematcher=diffmatcher, fullnodes=commonnodes) cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) + 'narrow_widen', changelog=False) return cgdata @@ -110,7 +109,7 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -cgdata = widen_changegroup(repo, diffmatch, common, version, source) +cgdata = widen_changegroup(repo, diffmatch, common, version) if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -189,7 +188,7 @@ shallow=depth is not None, ellipsisroots=newellipsis, fullnodes=newfull) -cgdata = packer.generate(common, newvisit, False, source) +cgdata = packer.generate(common, newvisit, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) @@ -207,7 +206,7 @@ shallow=depth is not None, ellipsisroots=ellipsisroots, fullnodes=relevant_nodes) -cgdata = packer.generate(common, visitnodes, False, source) +cgdata = packer.generate(common, visitnodes, False, 'narrow_widen') part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4786: narrow: factor out logic to create cg while widening into separate fn
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch takes out the logic which generates a changegroup for widening a narrow clone when ellipses are disabled. This is done because future patches will introduce a narrow_widen() wireprotocol command which will send a changegroup and will use this function. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4786 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -51,6 +51,37 @@ caps[NARROWCAP] = ['v0'] return caps +def widen_changegroup(repo, diffmatcher, common, cgversion, source): +"""generates changegroup for widening a narrow clone + +repo is the localrepository instance +diffmatcher is a differencemacther of '(newincludes, newexcludes) - +(oldincludes, oldexcludes)' +common is set of common revs between server and client +cgversion is the changegroup version to send +source is the command which called this codepath + +returns changegroup data of the changegroup built or return None if there +are no common revs +""" +common = repo.revs("::%ln", common) +commonnodes = set() +cl = repo.changelog +for c in common: +commonnodes.add(cl.node(c)) +if commonnodes: +# XXX: we should only send the filelogs (and treemanifest). user +# already has the changelog and manifest +packer = changegroup.getbundler(cgversion, repo, +filematcher=diffmatcher, +fullnodes=commonnodes) +cgdata = packer.generate(set([nullid]), list(commonnodes), False, + source, changelog=False) + +return cgdata + +return None + def getbundlechangegrouppart_widen(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, common=None, **kwargs): @@ -79,20 +110,8 @@ common = set(common or [nullid]) if (oldinclude != include or oldexclude != exclude): -common = repo.revs("::%ln", common) -commonnodes = set() -cl = repo.changelog -for c in common: -commonnodes.add(cl.node(c)) -if commonnodes: -# XXX: we should only send the filelogs (and treemanifest). user -# already has the changelog and manifest -packer = changegroup.getbundler(version, repo, -filematcher=diffmatch, -fullnodes=commonnodes) -cgdata = packer.generate(set([nullid]), list(commonnodes), False, - source, changelog=False) - +cgdata = widen_changegroup(repo, diffmatch, common, version, source) +if cgdata is not None: part = bundler.newpart('changegroup', data=cgdata) part.addparam('version', version) if 'treemanifest' in repo.requirements: To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel