Re: [PATCH remotefilelog-ext] cdatapack: include sys/types.h for off_t
Pushed. Thanks! Excerpts from Augie Fackler's message of 2016-11-28 17:27:05 -0500: > # HG changeset patch > # User Augie Fackler > # Date 1480371885 18000 > # Mon Nov 28 17:24:45 2016 -0500 > # Node ID 26bc28cb6f435212bf1a3a120e21175754a7af5e > # Parent 214ac612b5f1555c52ed2c3c4f70551bce880346 > cdatapack: include sys/types.h for off_t > > This isn't required on all systems, but I ran into one where it > was. Sigh. I've struggled a bit to find proper documentation of this, > and this is the best I could do: > http://pubs.opengroup.org/onlinepubs/009696799/basedefs/sys/types.h.html > > diff --git a/cdatapack/cdatapack.h b/cdatapack/cdatapack.h > --- a/cdatapack/cdatapack.h > +++ b/cdatapack/cdatapack.h > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #define NODE_SZ 20 > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH shelve-ext] shelve: fix use of unexpected working dirs in test-shelve.t
# HG changeset patch # User Kostia Balytskyi # Date 1480421465 28800 # Tue Nov 29 04:11:05 2016 -0800 # Node ID b4e28d31201c6af4c677c53b42c140b3cfb3d352 # Parent 6d69c3708cf3b9a70403c3d3cb3c44ff1e8faf53 shelve: fix use of unexpected working dirs in test-shelve.t Fixing some clowniness where we created ~four levels of nested repos and once (my test case :( ) did not even cd into a created repo. diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1383,6 +1383,7 @@ We expect that bare-shelve will not keep 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg branch default + $ cd .. When i shelve commit on newly created branch i expect that after unshelve newly created branch will be preserved. @@ -1416,6 +1417,7 @@ that after unshelve newly created branch ? b $ hg branch test + $ cd .. When i shelve commit on newly created branch, make some changes, unshelve it and running into merge @@ -1489,6 +1491,7 @@ test branch. A b $ hg branch default + $ cd .. When i unshelve resulting in merge conflicts and makes saved file shelvedstate looks like in previous versions in @@ -1551,6 +1554,7 @@ in previous versions) and running unshel M a $ hg branch default + $ cd .. On non bare shelve the branch information shouldn't be restored @@ -1624,7 +1628,7 @@ progress $ cd .. Unshelve respects --keep even if user intervention is needed - $ hg init unshelvekeep + $ hg init unshelvekeep && cd unshelvekeep $ echo 1 > file && hg ci -Am 1 adding file $ echo 2 >> file @@ -1637,7 +1641,7 @@ Unshelve respects --keep even if user in $ hg unshelve --keep unshelving change 'default' rebasing shelved changes - rebasing 3:1d24e58054c8 "changes to: 1" (tip) + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) merging file warning: conflicts while merging file! (edit, then use 'hg resolve --mark') unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') @@ -1646,7 +1650,7 @@ Unshelve respects --keep even if user in (no more unresolved files) continue: hg unshelve --continue $ hg unshelve --continue - rebasing 3:1d24e58054c8 "changes to: 1" (tip) + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) unshelve of 'default' complete $ hg shelve --list - default (1s ago)changes to: 1 + default (*s ago)changes to: 1 (glob) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH shelve-ext] shelve: fix use of unexpected working dirs in test-shelve.t
This looks good to me. Excerpts from Kostia Balytskyi's message of 2016-11-29 04:14:32 -0800: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480421465 28800 > # Tue Nov 29 04:11:05 2016 -0800 > # Node ID b4e28d31201c6af4c677c53b42c140b3cfb3d352 > # Parent 6d69c3708cf3b9a70403c3d3cb3c44ff1e8faf53 > shelve: fix use of unexpected working dirs in test-shelve.t > > Fixing some clowniness where we created ~four levels of nested repos > and once (my test case :( ) did not even cd into a created repo. > > diff --git a/tests/test-shelve.t b/tests/test-shelve.t > --- a/tests/test-shelve.t > +++ b/tests/test-shelve.t > @@ -1383,6 +1383,7 @@ We expect that bare-shelve will not keep >0 files updated, 0 files merged, 1 files removed, 0 files unresolved >$ hg branch >default > + $ cd .. > > When i shelve commit on newly created branch i expect > that after unshelve newly created branch will be preserved. > @@ -1416,6 +1417,7 @@ that after unshelve newly created branch >? b >$ hg branch >test > + $ cd .. > > When i shelve commit on newly created branch, make > some changes, unshelve it and running into merge > @@ -1489,6 +1491,7 @@ test branch. >A b >$ hg branch >default > + $ cd .. > > When i unshelve resulting in merge conflicts and makes saved > file shelvedstate looks like in previous versions in > @@ -1551,6 +1554,7 @@ in previous versions) and running unshel >M a >$ hg branch >default > + $ cd .. > > On non bare shelve the branch information shouldn't be restored > > @@ -1624,7 +1628,7 @@ progress >$ cd .. > > Unshelve respects --keep even if user intervention is needed > - $ hg init unshelvekeep > + $ hg init unshelvekeep && cd unshelvekeep >$ echo 1 > file && hg ci -Am 1 >adding file >$ echo 2 >> file > @@ -1637,7 +1641,7 @@ Unshelve respects --keep even if user in >$ hg unshelve --keep >unshelving change 'default' >rebasing shelved changes > - rebasing 3:1d24e58054c8 "changes to: 1" (tip) > + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) >merging file >warning: conflicts while merging file! (edit, then use 'hg resolve --mark') >unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') > @@ -1646,7 +1650,7 @@ Unshelve respects --keep even if user in >(no more unresolved files) >continue: hg unshelve --continue >$ hg unshelve --continue > - rebasing 3:1d24e58054c8 "changes to: 1" (tip) > + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) >unshelve of 'default' complete >$ hg shelve --list > - default (1s ago)changes to: 1 > + default (*s ago)changes to: 1 (glob) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH v2] revlog: ensure that flags do not overflow 2 bytes
On Mon, 28 Nov 2016 04:43:41 -0800, Cotizo Sima wrote: > # HG changeset patch > # User Cotizo Sima > # Date 1480336441 28800 > # Mon Nov 28 04:34:01 2016 -0800 > # Node ID bfbb27dffad7ae41e5238087b4e7ff5a26b030b5 > # Parent a3163433647108b7bec8fc45896db1c20b18ab21 > revlog: ensure that flags do not overflow 2 bytes Queued, thanks. > --- a/mercurial/revlog.py > +++ b/mercurial/revlog.py > @@ -72,6 +72,8 @@ > return int(q & 0x) > > def offset_type(offset, type): > +if (type & ~REVIDX_KNOWN_FLAGS) != 0: > +raise ValueError(_('unknown revlog index flags')) I've dropped _() since it is the check for developers. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5434] New: graphlog should not allow users to use a single character for the an entire edge
https://bz.mercurial-scm.org/show_bug.cgi?id=5434 Bug ID: 5434 Summary: graphlog should not allow users to use a single character for the an entire edge Product: Mercurial Version: default branch Hardware: All OS: Windows Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@selenic.com Reporter: arcppzju+hg...@gmail.com CC: mercurial-de...@selenic.com Using drawdag.py to create a repo: G H | | D F | | C E |/ B | A Run hg log -r B+A+C+D+G+F -G -T '{desc}' --config experimental.graphstyle.grandparent=: o G | | o F | : o : D | : o : C :/ o B | o A The edge between C and B should be "|" instead of ":" because C is a direct child of B. This is actually because two edges share a same path and their style cannot be consistent. I think a clean solution would be to disallow changing the style for the whole edge, instead, allow *insert* some characters for the grand parent edge. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] crecord: move status window text calculation to a separate method
On Mon, 28 Nov 2016 23:52:05 +, Jun Wu wrote: > # HG changeset patch > # User Jun Wu > # Date 1480374774 0 > # Mon Nov 28 23:12:54 2016 + > # Node ID e48c90823ca48725263c5cc2040827c31d6e447b > # Parent 64b55bffc1c059eb4c11ca195b561ca8a287f59e > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r > e48c90823ca4 > crecord: move status window text calculation to a separate method Looks good. Queued the series, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH shelve-ext] shelve: fix use of unexpected working dirs in test-shelve.t
On Tue, 29 Nov 2016 04:14:32 -0800, Kostia Balytskyi wrote: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480421465 28800 > # Tue Nov 29 04:11:05 2016 -0800 > # Node ID b4e28d31201c6af4c677c53b42c140b3cfb3d352 > # Parent 6d69c3708cf3b9a70403c3d3cb3c44ff1e8faf53 > shelve: fix use of unexpected working dirs in test-shelve.t Queued, thanks. > Unshelve respects --keep even if user intervention is needed > - $ hg init unshelvekeep > + $ hg init unshelvekeep && cd unshelvekeep >$ echo 1 > file && hg ci -Am 1 >adding file >$ echo 2 >> file > @@ -1637,7 +1641,7 @@ Unshelve respects --keep even if user in >$ hg unshelve --keep >unshelving change 'default' >rebasing shelved changes > - rebasing 3:1d24e58054c8 "changes to: 1" (tip) > + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) >merging file >warning: conflicts while merging file! (edit, then use 'hg resolve --mark') >unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') > @@ -1646,7 +1650,7 @@ Unshelve respects --keep even if user in >(no more unresolved files) >continue: hg unshelve --continue >$ hg unshelve --continue > - rebasing 3:1d24e58054c8 "changes to: 1" (tip) > + rebasing 2:3fbe6fbb0bef "changes to: 1" (tip) >unshelve of 'default' complete >$ hg shelve --list > - default (1s ago)changes to: 1 > + default (*s ago)changes to: 1 (glob) I've added '$ cd ..' here so future tests won't have the same issue. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30542: new changeset
New changeset in mercurial: http://selenic.com/repo/hg//rev/64b55bffc1c0 changeset: 30542:64b55bffc1c0 bookmark:@ tag: tip parent: 30541:342d0cb4f446 parent: 30419:819f96b82fa4 user:Augie Fackler date:Sun Nov 27 20:44:52 2016 -0500 summary: merge with stable -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 09 of 10 shelve-ext] shelve: add obs-based unshelve functionality
# HG changeset patch # User Kostia Balytskyi # Date 1480431173 28800 # Tue Nov 29 06:52:53 2016 -0800 # Node ID 533d99eca3bf11c4aac869674e0abb16b74ed670 # Parent 85c9c651887915733feb3d385866955741f28ec0 shelve: add obs-based unshelve functionality Obsolescense-based unshelve works as follows: 1. Instead of stripping temporary nodes, markers are created to obsolete them. 2. Restoring commit is just finding it in an unfiltered repo. 3. '--keep' is only passed to rebase on traditional unshelves (and thus traditional rebases), becuase we want markers to be created fro obsolete-based rebases. 4. 'hg unshelve' uses unfiltered repo to perform rebases because we want rebase to be able to create markers between original and new commits. 'rebaseskipobsolete' is disabled to make rebase not skip the commit altogether. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -26,6 +26,7 @@ import collections import errno import itertools import json +import time from mercurial.i18n import _ from mercurial import ( @@ -264,8 +265,13 @@ class shelvedstate(object): def prunenodes(self): """Cleanup temporary nodes from the repo""" -repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, - topic='shelve') +if self.obsshelve: +unfi = self.repo.unfiltered() +relations = [(unfi[n], ()) for n in self.nodestoprune] +obsolete.createmarkers(self.repo, relations) +else: +repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, + topic='shelve') def cleanupoldbackups(repo): vfs = scmutil.vfs(repo.join(backupdir)) @@ -670,9 +676,14 @@ def unshelvecontinue(ui, repo, state, op util.rename(repo.join('unshelverebasestate'), repo.join('rebasestate')) try: -rebase.rebase(ui, repo, **{ -'continue' : True -}) +# if shelve is obs-based, we want rebase to be able +# to create markers to already-obsoleted commits +_repo = repo.unfiltered() if state.obsshelve else repo +with ui.configoverride({('experimental', 'rebaseskipobsolete'): +'off'}, 'unshelve'): +rebase.rebase(ui, _repo, **{ +'continue' : True, +}) except Exception: util.rename(repo.join('rebasestate'), repo.join('unshelverebasestate')) @@ -712,30 +723,54 @@ def _commitworkingcopychanges(ui, repo, with ui.configoverride({('ui', 'quiet'): True}): node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) tmpwctx = repo[node] +ui.debug("temporary working copy commit: %s:%s\n" % + (tmpwctx.rev(), nodemod.short(node))) return tmpwctx, addedbefore -def _unshelverestorecommit(ui, repo, basename): +def _unshelverestorecommit(ui, repo, basename, obsshelve, shfile): """Recreate commit in the repository during the unshelve""" with ui.configoverride({('ui', 'quiet'): True}): -shelvedfile(repo, basename, 'hg').applybundle() -shelvectx = repo['tip'] +if obsshelve: +md = shfile.readjson() +shelvenode = nodemod.bin(md['node']) +repo = repo.unfiltered() +shelvectx = repo[shelvenode] +else: +shelvedfile(repo, basename, 'hg').applybundle() +shelvectx = repo['tip'] return repo, shelvectx def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx, - tmpwctx, shelvectx, branchtorestore): + tmpwctx, shelvectx, branchtorestore, obsshelve): """Rebase restored commit from its original location to a destination""" # If the shelve is not immediately on top of the commit # we'll be merging with, rebase it to be on top. if tmpwctx.node() == shelvectx.parents()[0].node(): +# shelvectx is immediately on top of the tmpwctx return shelvectx +# we need a new commit extra every time we perform a rebase to ensure +# that "nothing to rebase" does not happen with obs-based shelve +# "nothing to rebase" means that tip does not point to a "successor" +# commit after a rebase and we have no way to learn which commit +# should be a "shelvectx". this is a dirty hack until we implement +# some way to learn the results of rebase operation, other than +# text output and return code +def extrafn(ctx, extra): +extra['unshelve_time'] = str(time.time()) + ui.status(_('rebasing shelved changes\n')) try: +# we only want keep to be true if shelve is traditional, since +# for obs-based shelve, rebase will also be obs-based and +# markers created help us track the relationship between shelvectx +# and its new version reba
[PATCH 04 of 10 shelve-ext] shelve: move node-pruning functionality to be member of shelvedstate
# HG changeset patch # User Kostia Balytskyi # Date 1480425731 28800 # Tue Nov 29 05:22:11 2016 -0800 # Node ID 4166a4cfdc14629e169f12e83607b065887594b7 # Parent 93bb69fa1f1abbe0a42455ad8df691fdf29b2e3a shelve: move node-pruning functionality to be member of shelvedstate Node-pruning can be node stripping or marker creation, depending on whether shelve is traditional or obs-based. Thus it makes sense to move it to a separate function. Also, since we already have shelvedstate object and this functionality operates on that object, it makes sense to make it a method. Having shelvedstate object contain repo and ui as members allows for calling 'state.prunenodes()' instead of 'state.prunenodes(repo, ui)' which is better IMO. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -185,8 +185,12 @@ class shelvedstate(object): _keep = 'keep' _nokeep = 'nokeep' +def __init__(self, ui, repo): +self.ui = ui +self.repo = repo + @classmethod -def load(cls, repo): +def load(cls, ui, repo): fp = repo.vfs(cls._filename) try: version = int(fp.readline().strip()) @@ -207,7 +211,7 @@ class shelvedstate(object): fp.close() try: -obj = cls() +obj = cls(ui, repo) obj.name = name obj.wctx = repo[wctx] obj.pendingctx = repo[pendingctx] @@ -240,6 +244,11 @@ class shelvedstate(object): def clear(cls, repo): util.unlinkpath(repo.join(cls._filename), ignoremissing=True) +def prunenodes(self): +"""Cleanup temporary nodes from the repo""" +repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, + topic='shelve') + def cleanupoldbackups(repo): vfs = scmutil.vfs(repo.join(backupdir)) maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) @@ -576,8 +585,7 @@ def unshelveabort(ui, repo, state, opts) raise mergefiles(ui, repo, state.wctx, state.pendingctx) -repair.strip(ui, repo, state.nodestoprune, backup=False, - topic='shelve') +state.prunenodes() finally: shelvedstate.clear(repo) ui.warn(_("unshelve of '%s' aborted\n") % state.name) @@ -654,7 +662,7 @@ def unshelvecontinue(ui, repo, state, op mergefiles(ui, repo, state.wctx, shelvectx) restorebranch(ui, repo, state.branchtorestore) -repair.strip(ui, repo, state.nodestoprune, backup=False, topic='shelve') +state.prunenodes() shelvedstate.clear(repo) unshelvecleanup(ui, repo, state.name, opts) ui.status(_("unshelve of '%s' complete\n") % state.name) @@ -810,7 +818,7 @@ def _dounshelve(ui, repo, *shelved, **op ui.warn(_('tool option will be ignored\n')) try: -state = shelvedstate.load(repo) +state = shelvedstate.load(ui, repo) if opts.get('keep') is None: opts['keep'] = state.keep except IOError as err: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 05 of 10 shelve-ext] shelve: add a function to check whether obs-based shelve is enabled
# HG changeset patch # User Kostia Balytskyi # Date 1480426659 28800 # Tue Nov 29 05:37:39 2016 -0800 # Node ID 7f225df4c58b4f62a7883f95349cdb9e9c86e15e # Parent 4166a4cfdc14629e169f12e83607b065887594b7 shelve: add a function to check whether obs-based shelve is enabled A central place to check whether code should use traditional or obsolescense-based shelve behavior. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -41,6 +41,7 @@ from mercurial import ( mdiff, merge, node as nodemod, +obsolete, patch, phases, repair, @@ -71,6 +72,18 @@ patchextension = 'patch' # generic user for all shelve operations shelveuser = 'shelve@localhost' +def isobsshelve(repo, ui): +"""Check whether obsolescense-based shelve is enabled""" +obsshelve = ui.configbool('experimental', 'obsshelve') +if not obsshelve: +return False +if not obsolete.isenabled(repo, obsolete.createmarkersopt): +w = _('ignoring experimental.obsshelve because createmarkers option ' + 'is disabled') +ui.warn(w) +return False +return True + class shelvedfile(object): """Helper for the file storing a single shelve ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 02 of 10 shelve-ext] shelve: add an ability to write json to a new type of shelve files
# HG changeset patch # User Kostia Balytskyi # Date 1480426193 28800 # Tue Nov 29 05:29:53 2016 -0800 # Node ID 37119e028c699d9fabd220086e08c754827e709f # Parent f6f0ab3f7b0ea0e05cfdcd7afd4994ea21988fd9 shelve: add an ability to write json to a new type of shelve files Obsolescense-based shelve only needs metadata stored in .hg/shelved and I think that this metadata should be stored in json for potential extensibility purposes. JSON is not critical here, but I want to avoid storing it in an unstructured text file where order of lines determines their semantical meanings (as now happens in .hg/shelvedstate. .hg/rebasestate and I suspect other state files as well). If we want, we can refactor it to something else later. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -25,6 +25,7 @@ from __future__ import absolute_import import collections import errno import itertools +import json from mercurial.i18n import _ from mercurial import ( @@ -62,7 +63,7 @@ testedwith = 'ships-with-hg-core' backupdir = 'shelve-backup' shelvedir = 'shelved' -shelvefileextensions = ['hg', 'patch'] +shelvefileextensions = ['hg', 'patch', 'oshelve'] # universal extension is present in all types of shelves patchextension = 'patch' @@ -153,6 +154,26 @@ class shelvedfile(object): bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs, compression=compression) +def writejson(self, jsn): +fp = self.opener('wb') +try: +fp.write(json.dumps(jsn)) +finally: +fp.close() + +def readjson(self): +fp = self.opener() +contents = None +try: +contents = fp.read() +finally: +fp.close() +try: +jsn = json.loads(contents) +except (TypeError, ValueError): +raise error.abort(_('could not read obsolescense-based shelve')) +return jsn + class shelvedstate(object): """Handle persistence during unshelving operations. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 08 of 10 shelve-ext] shelve: migrate config overrides to ui.configoverride
# HG changeset patch # User Kostia Balytskyi # Date 1480427488 28800 # Tue Nov 29 05:51:28 2016 -0800 # Node ID 85c9c651887915733feb3d385866955741f28ec0 # Parent bcf8d603cc8b678f875ceca24dd2b14eda09bce7 shelve: migrate config overrides to ui.configoverride This patch also makes ui.quiet manipulations much more explicit and readable, addressing previous Yuya's concerns. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -355,17 +355,16 @@ def getcommitfunc(extra, interactive, ed hasmq = util.safehasattr(repo, 'mq') if hasmq: saved, repo.mq.checkapplied = repo.mq.checkapplied, False -backup = repo.ui.backupconfig('phases', 'new-commit') try: -repo.ui.setconfig('phases', 'new-commit', phases.secret) -editor_ = False -if editor: -editor_ = cmdutil.getcommiteditor(editform='shelve.shelve', - **opts) -return repo.commit(message, shelveuser, opts.get('date'), match, - editor=editor_, extra=extra) +overrides = {('phases', 'new-commit'): phases.secret} +with repo.ui.configoverride(overrides): +editor_ = False +if editor: +editor_ = cmdutil.getcommiteditor(editform='shelve.shelve', + **opts) +return repo.commit(message, shelveuser, opts.get('date'), + match, editor=editor_, extra=extra) finally: -repo.ui.restoreconfig(backup) if hasmq: repo.mq.checkapplied = saved @@ -625,9 +624,7 @@ def unshelveabort(ui, repo, state, opts) def mergefiles(ui, repo, wctx, shelvectx): """updates to wctx and merges the changes from shelvectx into the dirstate.""" -oldquiet = ui.quiet -try: -ui.quiet = True +with ui.configoverride({('ui', 'quiet'): True}): hg.update(repo, wctx.node()) files = [] files.extend(shelvectx.files()) @@ -642,8 +639,6 @@ def mergefiles(ui, repo, wctx, shelvectx *pathtofiles(repo, files), **{'no_backup': True}) ui.popbuffer() -finally: -ui.quiet = oldquiet def restorebranch(ui, repo, branchtorestore): if branchtorestore and branchtorestore != repo.dirstate.branch(): @@ -714,17 +709,16 @@ def _commitworkingcopychanges(ui, repo, tempopts = {} tempopts['message'] = "pending changes temporary commit" tempopts['date'] = opts.get('date') -ui.quiet = True -node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) +with ui.configoverride({('ui', 'quiet'): True}): +node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) tmpwctx = repo[node] return tmpwctx, addedbefore -def _unshelverestorecommit(ui, repo, basename, oldquiet): +def _unshelverestorecommit(ui, repo, basename): """Recreate commit in the repository during the unshelve""" -ui.quiet = True -shelvedfile(repo, basename, 'hg').applybundle() -shelvectx = repo['tip'] -ui.quiet = oldquiet +with ui.configoverride({('ui', 'quiet'): True}): +shelvedfile(repo, basename, 'hg').applybundle() +shelvectx = repo['tip'] return repo, shelvectx def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx, @@ -890,13 +884,9 @@ def _dounshelve(ui, repo, *shelved, **op if not shelvedfile(repo, basename, patchextension).exists(): raise error.Abort(_("shelved change '%s' not found") % basename) -oldquiet = ui.quiet lock = tr = None -forcemerge = ui.backupconfig('ui', 'forcemerge') try: -ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'unshelve') lock = repo.lock() - tr = repo.transaction('unshelve', report=lambda x: None) oldtiprev = len(repo) @@ -911,16 +901,18 @@ def _dounshelve(ui, repo, *shelved, **op tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts, tmpwctx) -repo, shelvectx = _unshelverestorecommit(ui, repo, basename, oldquiet) +repo, shelvectx = _unshelverestorecommit(ui, repo, basename) branchtorestore = '' if shelvectx.branch() != shelvectx.p1().branch(): branchtorestore = shelvectx.branch() -shelvectx = _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, - basename, pctx, tmpwctx, shelvectx, - branchtorestore) -mergefiles(ui, repo, pctx, shelvectx) +with ui.configoverride({('ui', 'forcemerge'): opts.get('tool', '')}, + 'unshelve'): +shelvectx = _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, +
[PATCH 01 of 10 shelve-ext] shelve: move patch extension to a string constant
# HG changeset patch # User Kostia Balytskyi # Date 1480432803 28800 # Tue Nov 29 07:20:03 2016 -0800 # Node ID f6f0ab3f7b0ea0e05cfdcd7afd4994ea21988fd9 # Parent 64b55bffc1c059eb4c11ca195b561ca8a287f59e shelve: move patch extension to a string constant We are using 'name + ".patch"' pattern throughout the shelve code to identify the existence of a shelve with a particular name. In two cases however we use 'name + ".hg"' instead. This commit makes 'patch' be used in all places and "emphasizes" it by moving 'patch' to live in a constant. Also, this allows to extract file name without extension like this: f[:-(1 + len(patchextension))] instead of: f[:-6] which is good IMO. This is a first patch from this initial "obsshelve" series. This series does not include tests, although locally I have all of test-shelve.t ported to test obs-shelve as well. I will send tests later as a separate series. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -63,6 +63,8 @@ testedwith = 'ships-with-hg-core' backupdir = 'shelve-backup' shelvedir = 'shelved' shelvefileextensions = ['hg', 'patch'] +# universal extension is present in all types of shelves +patchextension = 'patch' # we never need the user, so we use a # generic user for all shelve operations @@ -220,7 +222,8 @@ class shelvedstate(object): def cleanupoldbackups(repo): vfs = scmutil.vfs(repo.join(backupdir)) maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) -hgfiles = [f for f in vfs.listdir() if f.endswith('.hg')] +hgfiles = [f for f in vfs.listdir() + if f.endswith('.' + patchextension)] hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles]) if 0 < maxbackups and maxbackups < len(hgfiles): bordermtime = hgfiles[-maxbackups][0] @@ -230,7 +233,7 @@ def cleanupoldbackups(repo): if mtime == bordermtime: # keep it, because timestamp can't decide exact order of backups continue -base = f[:-3] +base = f[:-(1 + len(patchextension))] for ext in shelvefileextensions: try: vfs.unlink(base + '.' + ext) @@ -264,12 +267,12 @@ def getshelvename(repo, parent, opts): label = label.replace('/', '_') if name: -if shelvedfile(repo, name, 'hg').exists(): +if shelvedfile(repo, name, patchextension).exists(): e = _("a shelved change named '%s' already exists") % name raise error.Abort(e) else: for n in gennames(): -if not shelvedfile(repo, n, 'hg').exists(): +if not shelvedfile(repo, n, patchextension).exists(): name = n break else: @@ -337,7 +340,7 @@ def _shelvecreatedcommit(repo, node, nam bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) cmdutil.export(repo, [node], - fp=shelvedfile(repo, name, 'patch').opener('wb'), + fp=shelvedfile(repo, name, patchextension).opener('wb'), opts=mdiff.diffopts(git=True)) def _includeunknownfiles(repo, pats, opts, extra): @@ -444,7 +447,7 @@ def deletecmd(ui, repo, pats): # but the .hg file is optional as in future we # will add obsolete shelve with does not create a # bundle -if shfile.exists() or suffix == 'patch': +if shfile.exists() or suffix == patchextension: shfile.movetobackup() cleanupoldbackups(repo) except OSError as err: @@ -463,7 +466,7 @@ def listshelves(repo): info = [] for (name, _type) in names: pfx, sfx = name.rsplit('.', 1) -if not pfx or sfx != 'patch': +if not pfx or sfx != patchextension: continue st = shelvedfile(repo, name).stat() info.append((st.st_mtime, shelvedfile(repo, pfx).filename())) @@ -491,7 +494,7 @@ def listcmd(ui, repo, pats, opts): ui.write(age, label='shelve.age') ui.write(' ' * (12 - len(age))) used += 12 -with open(name + '.patch', 'rb') as fp: +with open(name + '.' + patchextension, 'rb') as fp: while True: line = fp.readline() if not line: @@ -519,7 +522,7 @@ def singlepatchcmds(ui, repo, pats, opts raise error.Abort(_("--%s expects a single shelf") % subcommand) shelfname = pats[0] -if not shelvedfile(repo, shelfname, 'patch').exists(): +if not shelvedfile(repo, shelfname, patchextension).exists(): raise error.Abort(_("cannot find shelf %s") % shelfname) listcmd(ui, repo, pats, opts) @@ -823,7 +826,7 @@ def _dounshelve(ui, repo, *shelved, **op else: basename = shelved[0] -if not shelvedfile(repo, basename, 'patch').exists(): +if not shelvedfile(repo, basename, patchexte
[PATCH 03 of 10 shelve-ext] shelve: rename stripnodes to nodestoprune
# HG changeset patch # User Kostia Balytskyi # Date 1480425731 28800 # Tue Nov 29 05:22:11 2016 -0800 # Node ID 93bb69fa1f1abbe0a42455ad8df691fdf29b2e3a # Parent 37119e028c699d9fabd220086e08c754827e709f shelve: rename stripnodes to nodestoprune Since we are introducing obs-based shelve, we are no longer stripping temporary nodes, we are obsoleting them. Therefore it looks like stipnodes would be a misleading name, while prune has a connotaion of "strip but with obsolescense", so nodestoprune seems like a good rename. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -198,7 +198,7 @@ class shelvedstate(object): wctx = nodemod.bin(fp.readline().strip()) pendingctx = nodemod.bin(fp.readline().strip()) parents = [nodemod.bin(h) for h in fp.readline().split()] -stripnodes = [nodemod.bin(h) for h in fp.readline().split()] +nodestoprune = [nodemod.bin(h) for h in fp.readline().split()] branchtorestore = fp.readline().strip() keep = fp.readline().strip() == cls._keep except (ValueError, TypeError) as err: @@ -212,7 +212,7 @@ class shelvedstate(object): obj.wctx = repo[wctx] obj.pendingctx = repo[pendingctx] obj.parents = parents -obj.stripnodes = stripnodes +obj.nodestoprune = nodestoprune obj.branchtorestore = branchtorestore obj.keep = keep except error.RepoLookupError as err: @@ -221,7 +221,7 @@ class shelvedstate(object): return obj @classmethod -def save(cls, repo, name, originalwctx, pendingctx, stripnodes, +def save(cls, repo, name, originalwctx, pendingctx, nodestoprune, branchtorestore, keep=False): fp = repo.vfs(cls._filename, 'wb') fp.write('%i\n' % cls._version) @@ -231,7 +231,7 @@ class shelvedstate(object): fp.write('%s\n' % ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()])) fp.write('%s\n' % - ' '.join([nodemod.hex(n) for n in stripnodes])) + ' '.join([nodemod.hex(n) for n in nodestoprune])) fp.write('%s\n' % branchtorestore) fp.write('%s\n' % (cls._keep if keep else cls._nokeep)) fp.close() @@ -576,7 +576,7 @@ def unshelveabort(ui, repo, state, opts) raise mergefiles(ui, repo, state.wctx, state.pendingctx) -repair.strip(ui, repo, state.stripnodes, backup=False, +repair.strip(ui, repo, state.nodestoprune, backup=False, topic='shelve') finally: shelvedstate.clear(repo) @@ -649,12 +649,12 @@ def unshelvecontinue(ui, repo, state, op shelvectx = state.pendingctx else: # only strip the shelvectx if the rebase produced it -state.stripnodes.append(shelvectx.node()) +state.nodestoprune.append(shelvectx.node()) mergefiles(ui, repo, state.wctx, shelvectx) restorebranch(ui, repo, state.branchtorestore) -repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') +repair.strip(ui, repo, state.nodestoprune, backup=False, topic='shelve') shelvedstate.clear(repo) unshelvecleanup(ui, repo, state.name, opts) ui.status(_("unshelve of '%s' complete\n") % state.name) @@ -706,9 +706,9 @@ def _rebaserestoredcommit(ui, repo, opts except error.InterventionRequired: tr.close() -stripnodes = [repo.changelog.node(rev) - for rev in xrange(oldtiprev, len(repo))] -shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes, +nodestoprune = [repo.changelog.node(rev) +for rev in xrange(oldtiprev, len(repo))] +shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoprune, branchtorestore, opts.get('keep')) util.rename(repo.join('rebasestate'), ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 06 of 10 shelve-ext] shelve: add obs-based shelve functionality
# HG changeset patch # User Kostia Balytskyi # Date 1480427179 28800 # Tue Nov 29 05:46:19 2016 -0800 # Node ID d1356cbb72cfe91a2b427098c66bc00937912d79 # Parent 7f225df4c58b4f62a7883f95349cdb9e9c86e15e shelve: add obs-based shelve functionality Obsolescense-based shelve works in a following way: 1. In order to shelve some changes, it creates a commit, records its node into a .oshelve file and prunes created commit. 2. In order to finish a shelve operation, transaction is just closed and not aborted. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -379,9 +379,16 @@ def _nothingtoshelvemessaging(ui, repo, else: ui.status(_("nothing changed\n")) -def _shelvecreatedcommit(repo, node, name): -bases = list(mutableancestors(repo[node])) -shelvedfile(repo, name, 'hg').writebundle(bases, node) +def _shelvecreatedcommit(ui, repo, node, name, tr): +if isobsshelve(repo, ui): +unfi = repo.unfiltered() +obsolete.createmarkers(repo, [(unfi[node], ())]) +shelvedfile(repo, name, 'oshelve').writejson({ +'node': nodemod.hex(node) +}) +else: +bases = list(mutableancestors(repo[node])) +shelvedfile(repo, name, 'hg').writebundle(bases, node) cmdutil.export(repo, [node], fp=shelvedfile(repo, name, patchextension).opener('wb'), opts=mdiff.diffopts(git=True)) @@ -393,8 +400,12 @@ def _includeunknownfiles(repo, pats, opt extra['shelve_unknown'] = '\0'.join(s.unknown) repo[None].add(s.unknown) -def _finishshelve(repo): -_aborttransaction(repo) +def _finishshelve(ui, repo, tr): +if isobsshelve(repo, ui): +tr.close() +tr.release() +else: +_aborttransaction(repo) def _docreatecmd(ui, repo, pats, opts): wctx = repo[None] @@ -416,9 +427,12 @@ def _docreatecmd(ui, repo, pats, opts): try: lock = repo.lock() -# use an uncommitted transaction to generate the bundle to avoid -# pull races. ensure we don't print the abort message to stderr. -tr = repo.transaction('commit', report=lambda x: None) +# depending on whether shelve is traditional or +# obsolescense-based, we either abort or commit this +# transaction in the end. If we abort it, we don't +# want to print anything to stderr +report = None if isobsshelve(repo, ui) else (lambda x: None) +tr = repo.transaction('commit', report=report) interactive = opts.get('interactive', False) includeunknown = (opts.get('unknown', False) and @@ -444,7 +458,7 @@ def _docreatecmd(ui, repo, pats, opts): _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 -_shelvecreatedcommit(repo, node, name) +_shelvecreatedcommit(ui, repo, node, name, tr) if ui.formatted(): desc = util.ellipsis(desc, ui.termwidth()) @@ -453,7 +467,7 @@ def _docreatecmd(ui, repo, pats, opts): if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): repo.dirstate.setbranch(origbranch) -_finishshelve(repo) +_finishshelve(ui, repo, tr) finally: lockmod.release(tr, lock) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 07 of 10 shelve-ext] shelve: add shelve type saving and loading
# HG changeset patch # User Kostia Balytskyi # Date 1480425731 28800 # Tue Nov 29 05:22:11 2016 -0800 # Node ID bcf8d603cc8b678f875ceca24dd2b14eda09bce7 # Parent d1356cbb72cfe91a2b427098c66bc00937912d79 shelve: add shelve type saving and loading We need shelve type to be stored in .hg/shelvedstate in order to be able to run abort or continue action properly. If the shelve is obsbased, those actions should create markes, if it is traditional, the actions should strip commits. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -197,6 +197,8 @@ class shelvedstate(object): _filename = 'shelvedstate' _keep = 'keep' _nokeep = 'nokeep' +_obsbased = 'obsbased' +_traditional = 'traditional' def __init__(self, ui, repo): self.ui = ui @@ -218,6 +220,7 @@ class shelvedstate(object): nodestoprune = [nodemod.bin(h) for h in fp.readline().split()] branchtorestore = fp.readline().strip() keep = fp.readline().strip() == cls._keep +obsshelve = fp.readline().strip() == cls._obsbased except (ValueError, TypeError) as err: raise error.CorruptedState(str(err)) finally: @@ -232,6 +235,7 @@ class shelvedstate(object): obj.nodestoprune = nodestoprune obj.branchtorestore = branchtorestore obj.keep = keep +obj.obsshelve = obsshelve except error.RepoLookupError as err: raise error.CorruptedState(str(err)) @@ -239,7 +243,7 @@ class shelvedstate(object): @classmethod def save(cls, repo, name, originalwctx, pendingctx, nodestoprune, - branchtorestore, keep=False): + branchtorestore, keep=False, obsshelve=False): fp = repo.vfs(cls._filename, 'wb') fp.write('%i\n' % cls._version) fp.write('%s\n' % name) @@ -251,6 +255,7 @@ class shelvedstate(object): ' '.join([nodemod.hex(n) for n in nodestoprune])) fp.write('%s\n' % branchtorestore) fp.write('%s\n' % (cls._keep if keep else cls._nokeep)) +fp.write('%s\n' % (cls._obsbased if obsshelve else cls._traditional)) fp.close() @classmethod ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 10 of 10 shelve-ext] shelve: add logic to preserve active bookmarks
# HG changeset patch # User Kostia Balytskyi # Date 1480431519 28800 # Tue Nov 29 06:58:39 2016 -0800 # Node ID 5c55e23c067998adf36b9a2c6eb028ba1a7fc643 # Parent 533d99eca3bf11c4aac869674e0abb16b74ed670 shelve: add logic to preserve active bookmarks This adds an explicit active-bookmark-handling logic to *both* traditional and obs-based shelve. Although it is possible to only add it to obs-based, I think it would be ugly and I see no harm in explicitly handling bookmarks in addition to reliance on trasnactions. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -30,6 +30,7 @@ import time from mercurial.i18n import _ from mercurial import ( +bookmarks, bundle2, bundlerepo, changegroup, @@ -200,6 +201,8 @@ class shelvedstate(object): _nokeep = 'nokeep' _obsbased = 'obsbased' _traditional = 'traditional' +# colon is essential to differentiate from a real bookmark name +_noactivebook = ':no-active-bookmark' def __init__(self, ui, repo): self.ui = ui @@ -222,6 +225,7 @@ class shelvedstate(object): branchtorestore = fp.readline().strip() keep = fp.readline().strip() == cls._keep obsshelve = fp.readline().strip() == cls._obsbased +activebook = fp.readline().strip() except (ValueError, TypeError) as err: raise error.CorruptedState(str(err)) finally: @@ -237,6 +241,9 @@ class shelvedstate(object): obj.branchtorestore = branchtorestore obj.keep = keep obj.obsshelve = obsshelve +obj.activebookmark = '' +if activebook != cls._noactivebook: +obj.activebookmark = activebook except error.RepoLookupError as err: raise error.CorruptedState(str(err)) @@ -244,7 +251,7 @@ class shelvedstate(object): @classmethod def save(cls, repo, name, originalwctx, pendingctx, nodestoprune, - branchtorestore, keep=False, obsshelve=False): + branchtorestore, keep=False, obsshelve=False, activebook=''): fp = repo.vfs(cls._filename, 'wb') fp.write('%i\n' % cls._version) fp.write('%s\n' % name) @@ -257,6 +264,7 @@ class shelvedstate(object): fp.write('%s\n' % branchtorestore) fp.write('%s\n' % (cls._keep if keep else cls._nokeep)) fp.write('%s\n' % (cls._obsbased if obsshelve else cls._traditional)) +fp.write('%s\n' % (activebook or cls._noactivebook)) fp.close() @classmethod @@ -295,6 +303,16 @@ def cleanupoldbackups(repo): if err.errno != errno.ENOENT: raise +def _backupactivebookmark(repo): +activebookmark = repo._activebookmark +if activebookmark: +bookmarks.deactivate(repo) +return activebookmark + +def _restoreactivebookmark(repo, mark): +if mark: +bookmarks.activate(repo, mark) + def _aborttransaction(repo): '''Abort current transaction for shelve/unshelve, but keep dirstate ''' @@ -410,7 +428,7 @@ def _includeunknownfiles(repo, pats, opt extra['shelve_unknown'] = '\0'.join(s.unknown) repo[None].add(s.unknown) -def _finishshelve(ui, repo, tr): +def _finishshelve(ui, repo, tr, activebookmark): if isobsshelve(repo, ui): tr.close() tr.release() @@ -433,7 +451,7 @@ def _docreatecmd(ui, repo, pats, opts): if not opts.get('message'): opts['message'] = desc -lock = tr = None +lock = tr = activebookmark = None try: lock = repo.lock() @@ -449,6 +467,7 @@ def _docreatecmd(ui, repo, pats, opts): not opts.get('addremove', False)) name = getshelvename(repo, parent, opts) +activebookmark = _backupactivebookmark(repo) extra = {} if includeunknown: _includeunknownfiles(repo, pats, opts, extra) @@ -463,7 +482,8 @@ def _docreatecmd(ui, repo, pats, opts): node = cmdutil.commit(ui, repo, commitfunc, pats, opts) else: node = cmdutil.dorecord(ui, repo, commitfunc, None, -False, cmdutil.recordfilter, *pats, **opts) +False, cmdutil.recordfilter, *pats, +**opts) if not node: _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 @@ -477,8 +497,9 @@ def _docreatecmd(ui, repo, pats, opts): if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): repo.dirstate.setbranch(origbranch) -_finishshelve(ui, repo, tr) +_finishshelve(ui, repo, tr, activebookmark) finally: +_restoreactivebookmark(repo, activebookmark) lockmod.release(tr, lock) def _isbareshelve(pats, opts): @@ -701,6 +722,7 @@ def unshelvecontinue(ui, repo, state, op restorebranch(ui, repo, state.bran
Re: mercurial@30541: 92 new changesets
On 11/28/16, 12:16 AM, "Mercurial-devel on behalf of Mercurial Commits" wrote: 92 new changesets in mercurial: http://selenic.com/repo/hg//rev/0acf3fd718f1 changeset: 30450:0acf3fd718f1 user:Gregory Szorc date:Thu Nov 17 20:09:10 2016 -0800 summary: setup: add flag to build_ext to control building zstd http://selenic.com/repo/hg//rev/94ca0e13d1fc changeset: 30451:94ca0e13d1fc user:Gregory Szorc date:Thu Nov 17 20:17:51 2016 -0800 summary: perf: add command for measuring revlog chunk operations http://selenic.com/repo/hg//rev/932b18c95e11 changeset: 30452:932b18c95e11 user:Gregory Szorc date:Thu Nov 17 20:30:00 2016 -0800 summary: commands: print chunk type in debugrevlog http://selenic.com/repo/hg//rev/2e736f01a710 changeset: 30453:2e736f01a710 user:Kostia Balytskyi date:Sun Nov 13 03:35:52 2016 -0800 summary: shelve: move temporary commit creation to a separate function http://selenic.com/repo/hg//rev/672026aece64 changeset: 30454:672026aece64 user:Kostia Balytskyi date:Thu Nov 10 10:51:06 2016 -0800 summary: shelve: move commit restoration logic to a separate function http://selenic.com/repo/hg//rev/10684a298973 changeset: 30455:10684a298973 user:Kostia Balytskyi date:Thu Nov 10 10:57:10 2016 -0800 summary: shelve: move rebasing logic to a separate function http://selenic.com/repo/hg//rev/b924375cce3a changeset: 30456:b924375cce3a user:Kostia Balytskyi date:Thu Nov 10 11:02:39 2016 -0800 summary: shelve: move file-forgetting logic to a separate function http://selenic.com/repo/hg//rev/893be22cdb38 changeset: 30457:893be22cdb38 user:Kostia Balytskyi date:Fri Nov 11 07:01:27 2016 -0800 summary: shelve: move unshelve-finishing logic to a separate function http://selenic.com/repo/hg//rev/0df215fba6cf changeset: 30458:0df215fba6cf user:Gábor Stefanik date:Fri Oct 28 17:44:28 2016 +0200 summary: setup: include a dummy $PATH in the custom environment used by build.py http://selenic.com/repo/hg//rev/bccd89b46cbf changeset: 30459:bccd89b46cbf user:Durham Goode date:Thu Nov 10 09:21:41 2016 -0800 summary: rebase: move bookmark update to before rebase clearing http://selenic.com/repo/hg//rev/ce3a133f71b3 changeset: 30460:ce3a133f71b3 user:Kostia Balytskyi date:Sat Nov 19 15:41:37 2016 -0800 summary: conflicts: make spacing consistent in conflict markers http://selenic.com/repo/hg//rev/d195fa651b51 changeset: 30461:d195fa651b51 user:Gregory Szorc date:Sun Nov 20 16:56:21 2016 -0800 summary: bdiff: don't check border condition in loop http://selenic.com/repo/hg//rev/356406ac454f changeset: 30462:356406ac454f user:Gregory Szorc date:Sat Nov 19 10:54:21 2016 -0800 summary: debuginstall: print compression engine support http://selenic.com/repo/hg//rev/bc0def54c17d changeset: 30463:bc0def54c17d user:Gregory Szorc date:Sat Nov 19 17:11:12 2016 -0800 summary: keepalive: reorder header precedence http://selenic.com/repo/hg//rev/e16e234b9ca3 changeset: 30464:e16e234b9ca3 user:Gregory Szorc date:Sat Nov 19 18:31:40 2016 -0800 summary: httppeer: do decompression inside _callstream http://selenic.com/repo/hg//rev/40a1871eea5e changeset: 30465:40a1871eea5e user:Gregory Szorc date:Sun Nov 20 13:55:53 2016 -0800 summary: httppeer: use compression engine API for decompressing responses http://selenic.com/repo/hg//rev/2add671bf55b changeset: 30466:2add671bf55b user:Gregory Szorc date:Sun Nov 20 13:50:45 2016 -0800 summary: wireproto: perform chunking and compression at protocol layer (API) http://selenic.com/repo/hg//rev/5b0baa9f3362 changeset: 30467:5b0baa9f3362 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Nov 21 15:26:47 2016 +0530 summary: py3: use pycompat.sysargv in scmposix.systemrcpath() http://selenic.com/repo/hg//rev/7f2b18c34c02 changeset: 30468:7f2b18c34c02 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Nov 21 15:35:22 2016 +0530 summary: py3: use pycompat.sysargv in dispatch.run() http://selenic.com/repo/hg//rev/8b3ad0252344 changeset: 30469:8b3ad0252344 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Nov 21 15:38:56 2016 +0530 summary: py3: update test-check-py
Re: [PATCH 02 of 10 shelve-ext] shelve: add an ability to write json to a new type of shelve files
Excerpts from Kostia Balytskyi's message of 2016-11-29 07:22:56 -0800: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480426193 28800 > # Tue Nov 29 05:29:53 2016 -0800 > # Node ID 37119e028c699d9fabd220086e08c754827e709f > # Parent f6f0ab3f7b0ea0e05cfdcd7afd4994ea21988fd9 > shelve: add an ability to write json to a new type of shelve files > > Obsolescense-based shelve only needs metadata stored in .hg/shelved > and I think that this metadata should be stored in json for > potential extensibility purposes. JSON is not critical here, but > I want to avoid storing it in an unstructured text file where > order of lines determines their semantical meanings (as now > happens in .hg/shelvedstate. .hg/rebasestate and I suspect other > state files as well). > > If we want, we can refactor it to something else later. > > diff --git a/hgext/shelve.py b/hgext/shelve.py > --- a/hgext/shelve.py > +++ b/hgext/shelve.py > @@ -25,6 +25,7 @@ from __future__ import absolute_import > import collections > import errno > import itertools > +import json I think we avoid using "import json" for some reason (encoding?). There is no "import json" in the code base yet. > from mercurial.i18n import _ > from mercurial import ( > @@ -62,7 +63,7 @@ testedwith = 'ships-with-hg-core' > > backupdir = 'shelve-backup' > shelvedir = 'shelved' > -shelvefileextensions = ['hg', 'patch'] > +shelvefileextensions = ['hg', 'patch', 'oshelve'] > # universal extension is present in all types of shelves > patchextension = 'patch' > > @@ -153,6 +154,26 @@ class shelvedfile(object): > bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs, > compression=compression) > > +def writejson(self, jsn): > +fp = self.opener('wb') > +try: > +fp.write(json.dumps(jsn)) > +finally: > +fp.close() > + > +def readjson(self): > +fp = self.opener() > +contents = None > +try: > +contents = fp.read() > +finally: > +fp.close() > +try: > +jsn = json.loads(contents) > +except (TypeError, ValueError): > +raise error.abort(_('could not read obsolescense-based shelve')) error.Abort The method does not seem to be related to "obsolescense" just from the name and logic. So the error message would be inaccurate if callers use "writejson" to write other things. Given the fact "json" is a too generic name and we may replace it using other (lightweight) format in the future, it may be better to rename those methods to something more specific, and avoid exposing the "json" format to the caller, like: def writeobsinfo(self, node): def readobsinfo(self): > +return jsn > + > class shelvedstate(object): > """Handle persistence during unshelving operations. > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: mercurial@30541: 92 new changesets
Excerpts from Kostia Balytskyi's message of 2016-11-29 15:52:51 +: > http://selenic.com/repo/hg//rev/22683f2f8100 > changeset: 30528:22683f2f8100 > user:Gregory Szorc > date:Wed Aug 17 21:00:11 2016 -0700 > summary: debugcommands: move 'debugindex' and 'debugindexdot' in the > new module > > Commit above breaks every command invocation in hg: > /data/users/ikostia/hgcommitted$ ./hg summary > hg: unknown command 'debugindex' > (did you mean one of bundle, debugdirstate, debuginstall, debugpvec, > debugrename, debugwireargs?) > > (Or am I missing something obvious?) I think this is remotefilelog.__init__ wrapping debugindex. You are affected because you have remotefilelog enabled. Nothing is broken for non-remotefilelog users. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH evolve-ext] wireproto: chunking and compression is forthwith to be handled by hgweb
# HG changeset patch # User Martijn Pieters # Date 1480435818 0 # Tue Nov 29 16:10:18 2016 + # Node ID 28a092ed406e930894c59eb88d645221abddc307 # Parent cb2bac3253fbd52894ffcb4719a148fe6a3da38b wireproto: chunking and compression is forthwith to be handled by hgweb Various functions disappeared in the process. Use the new streamres API but fall back to the old way if the keyword arguments are not accepted. See https://www.mercurial-scm.org/repo/hg/rev/2add671bf55b diff --git a/hgext/evolve.py b/hgext/evolve.py --- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -3848,7 +3848,12 @@ finaldata.write('%20i' % len(obsdata)) finaldata.write(obsdata) finaldata.seek(0) -return wireproto.streamres(proto.groupchunks(finaldata)) +try: +return wireproto.streamres(reader=finaldata, v1compressible=True) +except TypeError: +# older mercurial version, expected to do our own compression +return wireproto.streamres(proto.groupchunks(finaldata)) + def _obsrelsethashtreefm0(repo): return _obsrelsethashtree(repo, obsolete._fm0encodeonemarker) diff --git a/hgext/simple4server.py b/hgext/simple4server.py --- a/hgext/simple4server.py +++ b/hgext/simple4server.py @@ -175,7 +175,11 @@ finaldata.write('%20i' % len(obsdata)) finaldata.write(obsdata) finaldata.seek(0) -return wireproto.streamres(proto.groupchunks(finaldata)) +try: +return wireproto.streamres(reader=finaldata, v1compressible=True) +except TypeError: +# older mercurial version, expected to do our own compression +return wireproto.streamres(proto.groupchunks(finaldata)) # from evolve extension: 3249814dabd1 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 09 of 10 shelve-ext] shelve: add obs-based unshelve functionality
Excerpts from Kostia Balytskyi's message of 2016-11-29 07:23:03 -0800: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480431173 28800 > # Tue Nov 29 06:52:53 2016 -0800 > # Node ID 533d99eca3bf11c4aac869674e0abb16b74ed670 > # Parent 85c9c651887915733feb3d385866955741f28ec0 > shelve: add obs-based unshelve functionality > > Obsolescense-based unshelve works as follows: > 1. Instead of stripping temporary nodes, markers are created to > obsolete them. > 2. Restoring commit is just finding it in an unfiltered repo. > 3. '--keep' is only passed to rebase on traditional unshelves > (and thus traditional rebases), becuase we want markers to be > created fro obsolete-based rebases. > 4. 'hg unshelve' uses unfiltered repo to perform rebases > because we want rebase to be able to create markers between original > and new commits. 'rebaseskipobsolete' is disabled to make rebase not > skip the commit altogether. > > diff --git a/hgext/shelve.py b/hgext/shelve.py > --- a/hgext/shelve.py > +++ b/hgext/shelve.py > @@ -26,6 +26,7 @@ import collections > import errno > import itertools > import json > +import time > > from mercurial.i18n import _ > from mercurial import ( > @@ -264,8 +265,13 @@ class shelvedstate(object): > > def prunenodes(self): > """Cleanup temporary nodes from the repo""" > -repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, > - topic='shelve') > +if self.obsshelve: > +unfi = self.repo.unfiltered() > +relations = [(unfi[n], ()) for n in self.nodestoprune] > +obsolete.createmarkers(self.repo, relations) > +else: > +repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, > + topic='shelve') > > def cleanupoldbackups(repo): > vfs = scmutil.vfs(repo.join(backupdir)) > @@ -670,9 +676,14 @@ def unshelvecontinue(ui, repo, state, op > util.rename(repo.join('unshelverebasestate'), > repo.join('rebasestate')) > try: > -rebase.rebase(ui, repo, **{ > -'continue' : True > -}) > +# if shelve is obs-based, we want rebase to be able > +# to create markers to already-obsoleted commits > +_repo = repo.unfiltered() if state.obsshelve else repo > +with ui.configoverride({('experimental', 'rebaseskipobsolete'): > +'off'}, 'unshelve'): > +rebase.rebase(ui, _repo, **{ > +'continue' : True, > +}) > except Exception: > util.rename(repo.join('rebasestate'), > repo.join('unshelverebasestate')) > @@ -712,30 +723,54 @@ def _commitworkingcopychanges(ui, repo, > with ui.configoverride({('ui', 'quiet'): True}): > node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) > tmpwctx = repo[node] > +ui.debug("temporary working copy commit: %s:%s\n" % > + (tmpwctx.rev(), nodemod.short(node))) > return tmpwctx, addedbefore > > -def _unshelverestorecommit(ui, repo, basename): > +def _unshelverestorecommit(ui, repo, basename, obsshelve, shfile): "basename" and "shfile" looks duplicated. Maybe just keep one of them. (pass "file=shelvedfile(repo, basename, 'hg')", or just pass basename) > """Recreate commit in the repository during the unshelve""" > with ui.configoverride({('ui', 'quiet'): True}): > -shelvedfile(repo, basename, 'hg').applybundle() > -shelvectx = repo['tip'] > +if obsshelve: > +md = shfile.readjson() > +shelvenode = nodemod.bin(md['node']) > +repo = repo.unfiltered() > +shelvectx = repo[shelvenode] > +else: > +shelvedfile(repo, basename, 'hg').applybundle() > +shelvectx = repo['tip'] > return repo, shelvectx > > def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx, > - tmpwctx, shelvectx, branchtorestore): > + tmpwctx, shelvectx, branchtorestore, obsshelve): > """Rebase restored commit from its original location to a destination""" > # If the shelve is not immediately on top of the commit > # we'll be merging with, rebase it to be on top. > if tmpwctx.node() == shelvectx.parents()[0].node(): > +# shelvectx is immediately on top of the tmpwctx > return shelvectx > > +# we need a new commit extra every time we perform a rebase to ensure > +# that "nothing to rebase" does not happen with obs-based shelve > +# "nothing to rebase" means that tip does not point to a "successor" > +# commit after a rebase and we have no way to learn which commit > +# should be a "shelvectx". this is a dirty hack until we implement > +# some way to learn the results of rebase operation, other than > +# t
Re: [PATCH 2 of 2] worker: use os._exit for posix worker in all cases
On Wed, Nov 23, 2016 at 5:17 PM, Jun Wu wrote: > worker: use os._exit for posix worker in all cases > This looks good to me. Thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 10 of 10 shelve-ext] shelve: add logic to preserve active bookmarks
General direction looks good to me. I have a quick scan and commented on some nits. It seems the unshelve process is a different from the traditional one so a lot of methods were changed to accept new "obsshelve" (bool), "tr", "shfile" parameters. In this case, it may be cleaner to have two different "unshelver" classes that implement different approaches and keep internal states like "shfile" etc. That said, the above is only a suggestion, not a request-change. We can always do refactoring later. Excerpts from Kostia Balytskyi's message of 2016-11-29 07:23:04 -0800: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480431519 28800 > # Tue Nov 29 06:58:39 2016 -0800 > # Node ID 5c55e23c067998adf36b9a2c6eb028ba1a7fc643 > # Parent 533d99eca3bf11c4aac869674e0abb16b74ed670 > shelve: add logic to preserve active bookmarks > > This adds an explicit active-bookmark-handling logic > to *both* traditional and obs-based shelve. Although it > is possible to only add it to obs-based, I think it would > be ugly and I see no harm in explicitly handling bookmarks > in addition to reliance on trasnactions. > > diff --git a/hgext/shelve.py b/hgext/shelve.py > --- a/hgext/shelve.py > +++ b/hgext/shelve.py > @@ -30,6 +30,7 @@ import time > > from mercurial.i18n import _ > from mercurial import ( > +bookmarks, > bundle2, > bundlerepo, > changegroup, > @@ -200,6 +201,8 @@ class shelvedstate(object): > _nokeep = 'nokeep' > _obsbased = 'obsbased' > _traditional = 'traditional' > +# colon is essential to differentiate from a real bookmark name > +_noactivebook = ':no-active-bookmark' > > def __init__(self, ui, repo): > self.ui = ui > @@ -222,6 +225,7 @@ class shelvedstate(object): > branchtorestore = fp.readline().strip() > keep = fp.readline().strip() == cls._keep > obsshelve = fp.readline().strip() == cls._obsbased > +activebook = fp.readline().strip() > except (ValueError, TypeError) as err: > raise error.CorruptedState(str(err)) > finally: > @@ -237,6 +241,9 @@ class shelvedstate(object): > obj.branchtorestore = branchtorestore > obj.keep = keep > obj.obsshelve = obsshelve > +obj.activebookmark = '' > +if activebook != cls._noactivebook: > +obj.activebookmark = activebook > except error.RepoLookupError as err: > raise error.CorruptedState(str(err)) > > @@ -244,7 +251,7 @@ class shelvedstate(object): > > @classmethod > def save(cls, repo, name, originalwctx, pendingctx, nodestoprune, > - branchtorestore, keep=False, obsshelve=False): > + branchtorestore, keep=False, obsshelve=False, activebook=''): > fp = repo.vfs(cls._filename, 'wb') > fp.write('%i\n' % cls._version) > fp.write('%s\n' % name) > @@ -257,6 +264,7 @@ class shelvedstate(object): > fp.write('%s\n' % branchtorestore) > fp.write('%s\n' % (cls._keep if keep else cls._nokeep)) > fp.write('%s\n' % (cls._obsbased if obsshelve else cls._traditional)) > +fp.write('%s\n' % (activebook or cls._noactivebook)) > fp.close() > > @classmethod > @@ -295,6 +303,16 @@ def cleanupoldbackups(repo): > if err.errno != errno.ENOENT: > raise > > +def _backupactivebookmark(repo): > +activebookmark = repo._activebookmark > +if activebookmark: > +bookmarks.deactivate(repo) > +return activebookmark > + > +def _restoreactivebookmark(repo, mark): > +if mark: > +bookmarks.activate(repo, mark) > + > def _aborttransaction(repo): > '''Abort current transaction for shelve/unshelve, but keep dirstate > ''' > @@ -410,7 +428,7 @@ def _includeunknownfiles(repo, pats, opt > extra['shelve_unknown'] = '\0'.join(s.unknown) > repo[None].add(s.unknown) > > -def _finishshelve(ui, repo, tr): > +def _finishshelve(ui, repo, tr, activebookmark): > if isobsshelve(repo, ui): > tr.close() > tr.release() > @@ -433,7 +451,7 @@ def _docreatecmd(ui, repo, pats, opts): > if not opts.get('message'): > opts['message'] = desc > > -lock = tr = None > +lock = tr = activebookmark = None > try: > lock = repo.lock() > > @@ -449,6 +467,7 @@ def _docreatecmd(ui, repo, pats, opts): >not opts.get('addremove', False)) > > name = getshelvename(repo, parent, opts) > +activebookmark = _backupactivebookmark(repo) > extra = {} > if includeunknown: > _includeunknownfiles(repo, pats, opts, extra) > @@ -463,7 +482,8 @@ def _docreatecmd(ui, repo, pats, opts): > node = cmdutil.commit(ui, repo, commitfunc, pats, opts) > else: > node = cmdutil.dorecord(ui, repo, commitfunc, None, > -
[PATCH] keepalive: drop check for unsupported version of Python
# HG changeset patch # User Bryan O'Sullivan # Date 1480437473 28800 # Tue Nov 29 08:37:53 2016 -0800 # Node ID 540fa940cd226021726c27475d4754cbf70246e4 # Parent 6a8aff737a17ada068b8ce4501184eacc66e827f keepalive: drop check for unsupported version of Python diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -333,8 +333,7 @@ class KeepAliveHandler(object): # What follows mostly reimplements HTTPConnection.request() # except it adds self.parent.addheaders in the mix. headers = req.headers.copy() -if sys.version_info >= (2, 4): -headers.update(req.unredirected_hdrs) +headers.update(req.unredirected_hdrs) headers.update(self.parent.addheaders) headers = dict((n.lower(), v) for n, v in headers.items()) skipheaders = {} ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] keepalive: drop check for unsupported version of Python
Marked as Pre-reviewed. Thanks for the cleaning up! Excerpts from Bryan O'Sullivan's message of 2016-11-29 08:38:54 -0800: > # HG changeset patch > # User Bryan O'Sullivan > # Date 1480437473 28800 > # Tue Nov 29 08:37:53 2016 -0800 > # Node ID 540fa940cd226021726c27475d4754cbf70246e4 > # Parent 6a8aff737a17ada068b8ce4501184eacc66e827f > keepalive: drop check for unsupported version of Python > > diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py > --- a/mercurial/keepalive.py > +++ b/mercurial/keepalive.py > @@ -333,8 +333,7 @@ class KeepAliveHandler(object): > # What follows mostly reimplements HTTPConnection.request() > # except it adds self.parent.addheaders in the mix. > headers = req.headers.copy() > -if sys.version_info >= (2, 4): > -headers.update(req.unredirected_hdrs) > +headers.update(req.unredirected_hdrs) > headers.update(self.parent.addheaders) > headers = dict((n.lower(), v) for n, v in headers.items()) > skipheaders = {} ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 5 v4] revlog: REVIDX_ISLARGEFILE flag
On Tue, 29 Nov 2016 at 06:59 Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > > > On 11/23/2016 06:39 PM, Remi Chaintron wrote: > > # HG changeset patch > > # User Remi Chaintron > > # Date 1479922644 0 > > # Wed Nov 23 17:37:24 2016 + > > # Branch stable > > # Node ID 75ee4746c198f039a39400e855e9335afc34f1dd > > # Parent da91f91e979d6bf807912e956cf2f29573ede56f > > revlog: REVIDX_ISLARGEFILE flag > > > > Add the REVIDX_ISLARGEFILE flag for the `lfs` extension to interact with > > revisions by registering transforms in the flagprocessor. > > small naming question: Should we actually call this 'lfs'/'LARGEFILE'. > Of courses. the extension using it is intended for large file. However, > the core semantic of this 'flag' seems to be "the content is stored > outsided of revlog". This external storage could be applied to any use > cases (eg, fetching sensitive content from a secure server on update). > > What do you think about adapting the name to reflect this? > That's a good point, and it depends on what we want to do with these flags. My understanding was that we wanted them to represent extension flags (at least a few of them). One aspect to consider is that if we were to rename this flag to something more generic (such as "REVIDX_EXTERNAL_STORAGE" for example), we might end up in a situation where this is used by different extensions with different behaviors, that might then become incompatible. One solution moving forward might be to allow extensions to register several transforms on a single flag, but this will make handling non-commutative operations more doable. This might be something worth iterating over, though. One aspect Augie and I discussed was to keep a few placeholder flags for home brewed extensions to register transforms on. -- Rémi -- Rémi ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 5 v4] revlog: add flagprocessor
Thanks for the awesome review. I included the changes in my current version and will update the stack once I'm done with all required changes. The approach I'm currently following relies on getting rid of the flagprocessor object, instead relying on a single revlog.processflags() method and an OrderedDict containing the flags and their associated transforms. The hybrid "no flags" design is going away too, which makes the code really simpler. On Tue, 29 Nov 2016 at 06:59 Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > > # max size of revlog with inline data > _maxinline = 131072 > @@ -76,6 +80,76 @@ > > _nullhash = hashlib.sha1(nullid) > > +class flagprocessor(object): > +"""process revlog objects contents based on flags > + > +flagprocessor objects are the interface between revlog objects and > +subclasses/extensions needing to change or update the contents of revlog > +objects, based on flags. > + > +The role of the flagprocessor is to apply transforms registered by > +extensions and revlog subclasses in the order defined by > +REVIDX_FLAGS_PROCESSING_ORDER and the type (read or write) of operation. > +This allows the flag processor to modify the contents of revlog objects and > +handle the composition of non-commutative operations. > +""" > + > +def __init__(self, revlogobject): > +self.transformmap = {} > +self.revlogobject = revlogobject I'm not sure why we need a full object here, it seems like we just need a dictionary mapping 'flag' to 'processors' and a function running them. In the Mercurial code base we try to avoid creating too much new class. It seems like we could do without the class here (unless I'm missing something). In addition to this local custom: * an individual flagprocessor object is created for each revlog. I'm not sure why? Can't we just use one mapping (as we do for ordering?) * having a the revlog referencing the flagprocessor which itself reference the revlog create a reference cycle. We avoid creating reference cycle in Mercurial (both for design purpose and because python is not great with them) Good point, I have now removed the flagprocessor altogether, which looks much nicer! > + > +def register(self, transformmap): > +"""Register transforms to be applied for flags. > + > +``transformmap`` - a map of flag to transform > +""" > +for flag in transformmap: > +if flag in REVIDX_FLAGS_PROCESSING_ORDER: > +self.transformmap[flag] = transformmap[flag] * unknown flag seems to be silently ignored. It would be better to just fail here. * we have a mechanism to load extra elements (like flag processors are). Have a look at 'mercurial.dispatch.extraloaders' (or use a registrar API, but that one is probably overkill here) * we do not handle collision at all, if multiple extensions try to register a process for the same flag, we should not let the last one just overwrite the other one. (Abort is the simplest handling). As part of moving the flagprocessor out, I now have a single 'processflags(self, text, flags, reverse=True)' method in revlog, which I updated to take care of unknown flags (which was previously done in 'revlog.revision()'). Collisions were explicitly not handled, as we were until now relying on a flag per extension, but this is something I'm happy to discuss. The current updated version I'm working on simply relies on the following constant: REVIDX_FLAGS_TRANSFORMS = collections.OrderedDict({ REVIDX_ISCENSORED: None, REVIDX_ISLFS: None, }) This takes care of both the ordering and a way to register transforms, but this enforces using only one transform per flag. > + > +def unregister(self, transformmap): > +"""Unregister transforms for flags.""" > +for flag in transformmap: > +if flag in REVIDX_FLAGS_PROCESSING_ORDER: > +self.transformmap[flag] = None What is the usecase for unregistering? Since we do not call the process if the flag is not set, I can't think of a case were we need to unregister. Am I missing something? I will get rid of this, as we're moving away from non-flag based transforms (cf. below). > +def processflags(self, node, text, revisionflags, reverse=False): > +"""Process flags and apply registered transforms. > + > +``node`` - the noideid of revision > +``text`` - the revision data to process > +``revisionflags`` - the flags applied to the revision > +``reverse`` - an optional argument describing whether the flags should > + be processed in order according to the ``flagprocessor`` flag > + priority. The flags should be processed in order of priority when > + reading revisions, and in reverse order when writing revisions. > + > +Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the > +processed text and ``validatehash`` is a bool indicati
Re: [PATCH 5 of 5 v4] changegroup3: enable on 'lfs' repo requirements
On Tue, 29 Nov 2016 at 06:59 Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > It seems like the commit message needs to be updated too. (Y) > > diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py > > --- a/mercurial/changegroup.py > > +++ b/mercurial/changegroup.py > > @@ -879,14 +879,16 @@ > > # Changegroup versions that can be applied to the repo > > def supportedincomingversions(repo): > > versions = allsupportedversions(repo.ui) > > -if 'treemanifest' in repo.requirements: > > +if ('treemanifest' in repo.requirements or > > +'lfs' in repo.requirements): > > versions.add('03') > > I've not seen 'lfs' used anywhere yet so this changeset seems a bit > premature. Given the code in this series I would expect the next step to > be a minimal usage of the new code (either by porting some of censor or > by using a test extension). Then we can start working on exchanging > these flagged changesets. > > In addition, this piece of code is suspicious. If we have a changelog > '03' available, we should be using it. I'm not sure why we only consider > it when treemanifest is used. Martin: is this the remain of a period > where the '03' format was experimental? Did we actually tested the new > format now? Can we drop this special case? > The original patch included an example composition of the `lfs` current implementation with a `dummy` extension that also provide a non-commutative (but reversible) operation on the filelog. censor is actually a really awkward extension for me to prototype the current implementation: - The operation it provides is non-reversible and do not allow to demonstrate composing non-commutative operations. - I've been hacking on moving censor to the new design for modifying filelog contents with mixed results: while this allowed me to completely clean filelog of the censor related code, I've had trouble completely getting revlog rid of it. Some changes and improvements in our design might actually allow me to move forward on this now, I'll take a look at it tomorrow. I'll make sure to re-send the RFC patches for lfs + composition with the 'dummy' extension that provide a good example of how easy it is to write these extensions and how they rely on the flag transforms. > > > return versions > > > > # Changegroup versions that can be created from the repo > > def supportedoutgoingversions(repo): > > versions = allsupportedversions(repo.ui) > > -if 'treemanifest' in repo.requirements: > > +if ('treemanifest' in repo.requirements or > > +'lfs' in repo.requirements): > > # Versions 01 and 02 support only flat manifests and it's just > too > > # expensive to convert between the flat manifest and tree > manifest on > > # the fly. Since tree manifests are hashed differently, all of > history > > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > > --- a/mercurial/localrepo.py > > +++ b/mercurial/localrepo.py > > @@ -238,7 +238,7 @@ > > class localrepository(object): > > > > supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest', > > -'manifestv2')) > > +'manifestv2', 'lfs')) > > _basesupported = supportedformats | set(('store', 'fncache', > 'shared', > > 'dotencode')) > > openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', > 'manifestv2')) > > ___ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > -- > Pierre-Yves David > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- Rémi ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 5 of 5 v4] changegroup3: enable on 'lfs' repo requirements
On Tue, Nov 29, 2016 at 07:59:11AM +0100, Pierre-Yves David wrote: > [cc martin because I've a question about some code mentioning 'treemanifest' > > On 11/23/2016 06:39 PM, Remi Chaintron wrote: > ># HG changeset patch > ># User Remi Chaintron > ># Date 1479916365 0 > ># Wed Nov 23 15:52:45 2016 + > ># Branch stable > ># Node ID b421c16161aed491fec20b600df5f1278b07bc1a > ># Parent 75ee4746c198f039a39400e855e9335afc34f1dd > >changegroup3: enable on 'lfs' repo requirements > > > >`changegroup3` is required by the `lfs` extension in order to send flags for > >revlog objects over the wire. > > It seems like the commit message needs to be updated too. > > >diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py > >--- a/mercurial/changegroup.py > >+++ b/mercurial/changegroup.py > >@@ -879,14 +879,16 @@ > > # Changegroup versions that can be applied to the repo > > def supportedincomingversions(repo): > > versions = allsupportedversions(repo.ui) > >-if 'treemanifest' in repo.requirements: > >+if ('treemanifest' in repo.requirements or > >+'lfs' in repo.requirements): > > versions.add('03') > > I've not seen 'lfs' used anywhere yet so this changeset seems a bit > premature. Given the code in this series I would expect the next step to be > a minimal usage of the new code (either by porting some of censor or by > using a test extension). Then we can start working on exchanging these > flagged changesets. > > In addition, this piece of code is suspicious. If we have a changelog '03' > available, we should be using it. I'm not sure why we only consider it when > treemanifest is used. Martin: is this the remain of a period where the '03' > format was experimental? Did we actually tested the new format now? Can we > drop this special case? Martin is on vacation (and you didn't add him to CC?), but we've been using changegroup3 extensively, and I think we're happy with it. Added spectral to confirm. > > > > return versions > > > > # Changegroup versions that can be created from the repo > > def supportedoutgoingversions(repo): > > versions = allsupportedversions(repo.ui) > >-if 'treemanifest' in repo.requirements: > >+if ('treemanifest' in repo.requirements or > >+'lfs' in repo.requirements): > > # Versions 01 and 02 support only flat manifests and it's just too > > # expensive to convert between the flat manifest and tree manifest > > on > > # the fly. Since tree manifests are hashed differently, all of > > history > >diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > >--- a/mercurial/localrepo.py > >+++ b/mercurial/localrepo.py > >@@ -238,7 +238,7 @@ > > class localrepository(object): > > > > supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest', > >-'manifestv2')) > >+'manifestv2', 'lfs')) > > _basesupported = supportedformats | set(('store', 'fncache', 'shared', > > 'dotencode')) > > openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', > > 'manifestv2')) > >___ > >Mercurial-devel mailing list > >Mercurial-devel@mercurial-scm.org > >https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > -- > Pierre-Yves David > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] keepalive: drop check for unsupported version of Python
On Tue, Nov 29, 2016 at 04:50:10PM +, Jun Wu wrote: > Marked as Pre-reviewed. Thanks for the cleaning up! indygreg already got to this conditional in bc0def54c17d, so this rebased away to nothing when I queued it. Thanks though! > > Excerpts from Bryan O'Sullivan's message of 2016-11-29 08:38:54 -0800: > > # HG changeset patch > > # User Bryan O'Sullivan > > # Date 1480437473 28800 > > # Tue Nov 29 08:37:53 2016 -0800 > > # Node ID 540fa940cd226021726c27475d4754cbf70246e4 > > # Parent 6a8aff737a17ada068b8ce4501184eacc66e827f > > keepalive: drop check for unsupported version of Python > > > > diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py > > --- a/mercurial/keepalive.py > > +++ b/mercurial/keepalive.py > > @@ -333,8 +333,7 @@ class KeepAliveHandler(object): > > # What follows mostly reimplements HTTPConnection.request() > > # except it adds self.parent.addheaders in the mix. > > headers = req.headers.copy() > > -if sys.version_info >= (2, 4): > > -headers.update(req.unredirected_hdrs) > > +headers.update(req.unredirected_hdrs) > > headers.update(self.parent.addheaders) > > headers = dict((n.lower(), v) for n, v in headers.items()) > > skipheaders = {} > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30549: 7 new changesets
7 new changesets in mercurial: http://selenic.com/repo/hg//rev/03fae9048fa1 changeset: 30543:03fae9048fa1 user:Cotizo Sima date:Mon Nov 28 04:34:01 2016 -0800 summary: revlog: ensure that flags do not overflow 2 bytes http://selenic.com/repo/hg//rev/d4035372db8d changeset: 30544:d4035372db8d user:Jun Wu date:Mon Nov 28 23:12:54 2016 + summary: crecord: move status window text calculation to a separate method http://selenic.com/repo/hg//rev/f3cff00c7a00 changeset: 30545:f3cff00c7a00 user:Jun Wu date:Wed Nov 23 22:23:15 2016 + summary: crecord: make _getstatuslines update numstatuslines http://selenic.com/repo/hg//rev/9b674957e2e4 changeset: 30546:9b674957e2e4 user:Jun Wu date:Mon Nov 28 23:33:02 2016 + summary: crecord: rewrite status line text (BC) http://selenic.com/repo/hg//rev/5129ed3c2548 changeset: 30547:5129ed3c2548 user:Jun Wu date:Mon Nov 28 23:37:29 2016 + summary: crecord: change help text for the space key dynamically http://selenic.com/repo/hg//rev/8d9745ff1e62 changeset: 30548:8d9745ff1e62 user:Jun Wu date:Mon Nov 28 23:38:46 2016 + summary: crecord: change the verb according to the operation http://selenic.com/repo/hg//rev/9e29d4e4e08b changeset: 30549:9e29d4e4e08b bookmark:@ tag: tip user:Kostia Balytskyi date:Tue Nov 29 04:11:05 2016 -0800 summary: shelve: fix use of unexpected working dirs in test-shelve.t -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 5 of 5] posix: give checklink a fast path that cache the check file and is read only
On 17 November 2016 at 18:44, Mads Kiilerich wrote: > > # HG changeset patch > # User Mads Kiilerich > # Date 1421194526 -3600 > # Wed Jan 14 01:15:26 2015 +0100 > # Node ID 73b671fbed41d82a5dd46e485c61ddb8afe42faf > # Parent 5409e0c5e6c0764e802360a3912f7719885ba2b5 > posix: give checklink a fast path that cache the check file and is read only Unfortunately, this patch broke tests on OS X: --- test-subrepo.t +++ test-subrepo.t.err @@ -1519,7 +1519,13 @@ (issue3781) $ cp -r main issue3781 + cp: main/.hg/cache/checklink: No such file or directory + cp: main/s/.hg/cache/checklink: No such file or directory + [1] $ cp -r main issue3781-dest + cp: main/.hg/cache/checklink: No such file or directory + cp: main/s/.hg/cache/checklink: No such file or directory + [1] $ cd issue3781-dest/s $ hg phase tip # show we have draft changeset 5: draft ERROR: test-subrepo.t output changed !.sss.s..!s... --- test-revert.t +++ test-revert.t.err @@ -785,6 +785,8 @@ (setup from reference repo) $ cp -r revert-ref revert-parent-all + cp: revert-ref/.hg/cache/checklink: No such file or directory + [1] $ cd revert-parent-all check revert output @@ -842,6 +844,8 @@ (setup from reference repo) $ cp -r revert-ref revert-base-all + cp: revert-ref/.hg/cache/checklink: No such file or directory + [1] $ cd revert-base-all check revert output @@ -897,6 +901,8 @@ (setup from reference repo) $ cp -r revert-ref revert-parent-explicit + cp: revert-ref/.hg/cache/checklink: No such file or directory + [1] $ cd revert-parent-explicit revert all files individually and check the output @@ -990,6 +996,8 @@ (setup from reference repo) $ cp -r revert-ref revert-base-explicit + cp: revert-ref/.hg/cache/checklink: No such file or directory + [1] $ cd revert-base-explicit revert all files individually and check the output ERROR: test-revert.t output changed !.s...s. --- test-bookmarks.t +++ test-bookmarks.t.err @@ -573,7 +573,11 @@ $ hg bookmark -r3 Y moving bookmark 'Y' forward from db815d6d32e6 $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update + cp: ../cloned-bookmarks-update/.hg/cache/checklink: No such file or directory + [1] $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence + cp: ../cloned-bookmarks-update/.hg/cache/checklink: No such file or directory + [1] (manual version) ERROR: test-bookmarks.t output changed !s. --- test-histedit-obsolete.t +++ test-histedit-obsolete.t.err @@ -340,6 +340,8 @@ New-commit as draft (default) $ cp -r base simple-draft + cp: base/.hg/cache/checklink: No such file or directory + [1] $ cd simple-draft $ hg histedit -r 'b449568bf7fc' --commands - << EOF > edit b449568bf7fc 11 f @@ -379,6 +381,8 @@ New-commit as secret (config) $ cp -r base simple-secret + cp: base/.hg/cache/checklink: No such file or directory + [1] $ cd simple-secret $ cat >> .hg/hgrc << EOF > [phases] @@ -426,6 +430,8 @@ It seems more important to present the secret phase. $ cp -r base reorder + cp: base/.hg/cache/checklink: No such file or directory + [1] $ cd reorder $ hg histedit -r 'b449568bf7fc' --commands - << EOF > pick b449568bf7fc 11 f @@ -463,6 +469,8 @@ Note that there is a few reordering in this series for more extensive test $ cp -r base folding + cp: base/.hg/cache/checklink: No such file or directory + [1] $ cd folding $ cat >> .hg/hgrc << EOF > [phases] ERROR: test-histedit-obsolete.t output changed !..s...s... --- test-hardlinks.t +++ test-hardlinks.t.err @@ -204,6 +204,23 @@ Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'): $ linkcp r3 r4 + Traceback (most recent call last): +File "$TESTTMP/linkcp.py", line 3, in + util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True) +File "/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py", line 1110, in copyfiles + hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog) +File "/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py", line 1110, in copyfiles + hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog) +File "/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py", line 1110, in copyfiles + hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog) +File "/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py", line 1118, in copyfiles + shutil.copy(src, dst) +File "/opt/homebrew/Cellar/python27/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy + copyfile(src, dst) +File "/opt/homeb
Re: [PATCH 5 of 5 v4] changegroup3: enable on 'lfs' repo requirements
On Tue, Nov 29, 2016 at 9:37 AM, Augie Fackler wrote: > On Tue, Nov 29, 2016 at 07:59:11AM +0100, Pierre-Yves David wrote: > > [cc martin because I've a question about some code mentioning > 'treemanifest' > > > > On 11/23/2016 06:39 PM, Remi Chaintron wrote: > > ># HG changeset patch > > ># User Remi Chaintron > > ># Date 1479916365 0 > > ># Wed Nov 23 15:52:45 2016 + > > ># Branch stable > > ># Node ID b421c16161aed491fec20b600df5f1278b07bc1a > > ># Parent 75ee4746c198f039a39400e855e9335afc34f1dd > > >changegroup3: enable on 'lfs' repo requirements > > > > > >`changegroup3` is required by the `lfs` extension in order to send > flags for > > >revlog objects over the wire. > > > > It seems like the commit message needs to be updated too. > > > > >diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py > > >--- a/mercurial/changegroup.py > > >+++ b/mercurial/changegroup.py > > >@@ -879,14 +879,16 @@ > > > # Changegroup versions that can be applied to the repo > > > def supportedincomingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > versions.add('03') > > > > I've not seen 'lfs' used anywhere yet so this changeset seems a bit > > premature. Given the code in this series I would expect the next step to > be > > a minimal usage of the new code (either by porting some of censor or by > > using a test extension). Then we can start working on exchanging these > > flagged changesets. > > > > In addition, this piece of code is suspicious. If we have a changelog > '03' > > available, we should be using it. I'm not sure why we only consider it > when > > treemanifest is used. Martin: is this the remain of a period where the > '03' > > format was experimental? Did we actually tested the new format now? Can > we > > drop this special case? > > Martin is on vacation (and you didn't add him to CC?), but we've been > using changegroup3 extensively, and I think we're happy with it. Added > spectral to confirm. > Yes, we've been using changegroup3 internally without issues for a while now. It's required for treemanifests and I'm pretty sure is required by recent versions of narrowhg. I'm fine with freezing it and making it non-experimental. > > > > > > > > return versions > > > > > > # Changegroup versions that can be created from the repo > > > def supportedoutgoingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > # Versions 01 and 02 support only flat manifests and it's just > too > > > # expensive to convert between the flat manifest and tree > manifest on > > > # the fly. Since tree manifests are hashed differently, all of > history > > >diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > > >--- a/mercurial/localrepo.py > > >+++ b/mercurial/localrepo.py > > >@@ -238,7 +238,7 @@ > > > class localrepository(object): > > > > > > supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest', > > >-'manifestv2')) > > >+'manifestv2', 'lfs')) > > > _basesupported = supportedformats | set(('store', 'fncache', > 'shared', > > > 'dotencode')) > > > openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', > 'manifestv2')) > > >___ > > >Mercurial-devel mailing list > > >Mercurial-devel@mercurial-scm.org > > >https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > > > > -- > > Pierre-Yves David > > ___ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- --Kyle Note: If I've asked a question, and you're responding to me, please use *respond all*, so that other people can read any solutions we come to! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 5 of 5] posix: give checklink a fast path that cache the check file and is read only
On 29 November 2016 at 20:43, Martijn Pieters wrote: > On 17 November 2016 at 18:44, Mads Kiilerich wrote: > > > > # HG changeset patch > > # User Mads Kiilerich > > # Date 1421194526 -3600 > > # Wed Jan 14 01:15:26 2015 +0100 > > # Node ID 73b671fbed41d82a5dd46e485c61ddb8afe42faf > > # Parent 5409e0c5e6c0764e802360a3912f7719885ba2b5 > > posix: give checklink a fast path that cache the check file and is read > only > > Unfortunately, this patch broke tests on OS X: > and I'm way behind the times, it appears. I see that this also broke Solaris, and that a patch is in the works. Any ETA on that Mads, or is it now stuck in limbo? Can I help? -- Martijn Pieters ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] posix: move checkexec test file to .hg/cache
On 11/17/16 10:44, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich # Date 1479383976 -3600 # Thu Nov 17 12:59:36 2016 +0100 # Node ID 1b5e959ebd859c27b3369124c926a512e222545c # Parent 854190becacb8abecbf5c18a777b02bbc045 posix: move checkexec test file to .hg/cache This avoids unnecessary churn in the working directory. It is not necessarily a fully valid assumption that .hg/cache is on the same filesystem as the working directory, but I think it is an acceptable approximation. I remember Matt talking about this exact issue and saying that this is not a reasonable assumption. - Siddharth It could also be the case that different parts of the working directory is on different mount points so checking in the root folder could also be wrong. diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -160,7 +160,10 @@ def checkexec(path): try: EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH -fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') +cachedir = os.path.join(path, '.hg', 'cache') +if not os.path.isdir(cachedir): +cachedir = path +fh, fn = tempfile.mkstemp(dir=cachedir, prefix='hg-checkexec-') try: os.close(fh) m = os.stat(fn).st_mode & 0o777 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH evolve-ext] wireproto: chunking and compression is forthwith to be handled by hgweb
This looks good to me, although I would maybe perform a more thorough check than just catching a TypeError. For example, something like check: if “v1compressible” in wireproto.streamres.__init__.__code__.co_varnames: pass this arg else: don’t pass it On 11/29/16, 4:10 PM, "Mercurial-devel on behalf of Martijn Pieters" wrote: # HG changeset patch # User Martijn Pieters # Date 1480435818 0 # Tue Nov 29 16:10:18 2016 + # Node ID 28a092ed406e930894c59eb88d645221abddc307 # Parent cb2bac3253fbd52894ffcb4719a148fe6a3da38b wireproto: chunking and compression is forthwith to be handled by hgweb Various functions disappeared in the process. Use the new streamres API but fall back to the old way if the keyword arguments are not accepted. See https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_repo_hg_rev_2add671bf55b&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Pp-gQYFgs4tKlSFPF5kfCw&m=itsfqjECZoIFxlvcK1F6-xHmasBtG5DrNpHJ5crQ8Qk&s=L9z5Oyy5EDFtbdleAKmWKcYdz4ScmzGLZznUUuk5k_8&e= diff --git a/hgext/evolve.py b/hgext/evolve.py --- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -3848,7 +3848,12 @@ finaldata.write('%20i' % len(obsdata)) finaldata.write(obsdata) finaldata.seek(0) -return wireproto.streamres(proto.groupchunks(finaldata)) +try: +return wireproto.streamres(reader=finaldata, v1compressible=True) +except TypeError: +# older mercurial version, expected to do our own compression +return wireproto.streamres(proto.groupchunks(finaldata)) + def _obsrelsethashtreefm0(repo): return _obsrelsethashtree(repo, obsolete._fm0encodeonemarker) diff --git a/hgext/simple4server.py b/hgext/simple4server.py --- a/hgext/simple4server.py +++ b/hgext/simple4server.py @@ -175,7 +175,11 @@ finaldata.write('%20i' % len(obsdata)) finaldata.write(obsdata) finaldata.seek(0) -return wireproto.streamres(proto.groupchunks(finaldata)) +try: +return wireproto.streamres(reader=finaldata, v1compressible=True) +except TypeError: +# older mercurial version, expected to do our own compression +return wireproto.streamres(proto.groupchunks(finaldata)) # from evolve extension: 3249814dabd1 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Pp-gQYFgs4tKlSFPF5kfCw&m=itsfqjECZoIFxlvcK1F6-xHmasBtG5DrNpHJ5crQ8Qk&s=Ja50nSg2ysFrAQC62ZhOs8UsS5w1-omMglM6HYBbfjg&e= ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 02 of 10 shelve-ext] shelve: add an ability to write json to a new type of shelve files
On 11/29/16, 3:55 PM, "Jun Wu" wrote: Excerpts from Kostia Balytskyi's message of 2016-11-29 07:22:56 -0800: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480426193 28800 > # Tue Nov 29 05:29:53 2016 -0800 > # Node ID 37119e028c699d9fabd220086e08c754827e709f > # Parent f6f0ab3f7b0ea0e05cfdcd7afd4994ea21988fd9 > shelve: add an ability to write json to a new type of shelve files > > Obsolescense-based shelve only needs metadata stored in .hg/shelved > and I think that this metadata should be stored in json for > potential extensibility purposes. JSON is not critical here, but > I want to avoid storing it in an unstructured text file where > order of lines determines their semantical meanings (as now > happens in .hg/shelvedstate. .hg/rebasestate and I suspect other > state files as well). > > If we want, we can refactor it to something else later. > > diff --git a/hgext/shelve.py b/hgext/shelve.py > --- a/hgext/shelve.py > +++ b/hgext/shelve.py > @@ -25,6 +25,7 @@ from __future__ import absolute_import > import collections > import errno > import itertools > +import json I think we avoid using "import json" for some reason (encoding?). There is no "import json" in the code base yet. > from mercurial.i18n import _ > from mercurial import ( > @@ -62,7 +63,7 @@ testedwith = 'ships-with-hg-core' > > backupdir = 'shelve-backup' > shelvedir = 'shelved' > -shelvefileextensions = ['hg', 'patch'] > +shelvefileextensions = ['hg', 'patch', 'oshelve'] > # universal extension is present in all types of shelves > patchextension = 'patch' > > @@ -153,6 +154,26 @@ class shelvedfile(object): > bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs, > compression=compression) > > +def writejson(self, jsn): > +fp = self.opener('wb') > +try: > +fp.write(json.dumps(jsn)) > +finally: > +fp.close() > + > +def readjson(self): > +fp = self.opener() > +contents = None > +try: > +contents = fp.read() > +finally: > +fp.close() > +try: > +jsn = json.loads(contents) > +except (TypeError, ValueError): > +raise error.abort(_('could not read obsolescense-based shelve')) error.Abort The method does not seem to be related to "obsolescense" just from the name and logic. So the error message would be inaccurate if callers use "writejson" to write other things. Given the fact "json" is a too generic name and we may replace it using other (lightweight) format in the future, it may be better to rename those methods to something more specific, and avoid exposing the "json" format to the caller, like: def writeobsinfo(self, node): def readobsinfo(self): Renaming it makes sense, I will do that in a following patch. I did not get what to do with json though: should I try to replace it with some other format right away or is it fine to leave json for now? > +return jsn > + > class shelvedstate(object): > """Handle persistence during unshelving operations. > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] evolve: improve error message if unstable changes are disallowed
Shouldn’t we mention the config in a hint message? On 11/25/16, 12:28 PM, "Mercurial-devel on behalf of Mateusz Kwapich" wrote: LGTM, I suppose that timeless may also want to review it before it's queued. Excerpts from Pulkit Goyal's message of 2016-11-24 23:13:48 +0530: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1479915042 -19800 > # Wed Nov 23 21:00:42 2016 +0530 > # Node ID 920d5946d13339d9cf4828f678fb55063cd8 > # Parent cb2bac3253fbd52894ffcb4719a148fe6a3da38b > evolve: improve error message if unstable changes are disallowed > > I saw a question on stackoverflow why evolve reports something like cannot > fold chain not ending with head. Even I was confused the first time about the > behavior. The error message can be improved to avoid confusion to people who > are unaware about the config in future. > > diff -r cb2bac3253fb -r 920d5946d133 hgext/evolve.py > --- a/hgext/evolve.pyWed Nov 02 18:56:44 2016 +0100 > +++ b/hgext/evolve.pyWed Nov 23 21:00:42 2016 +0530 > @@ -2514,7 +2514,8 @@ > raise error.Abort('nothing to prune') > > if _disallowednewunstable(repo, revs): > -raise error.Abort(_("cannot prune in the middle of a stack")) > +raise error.Abort(_("cannot prune in the middle of a stack"), > +hint = _("new unstable changesets are not allowed")) > > # defines successors changesets > sucs = scmutil.revrange(repo, succs) > @@ -3234,8 +3235,9 @@ > newunstable = _disallowednewunstable(repo, revs) > if newunstable: > raise error.Abort( > -_('cannot edit commit information in the middle of a stack'), > -hint=_('%s will be affected') % repo[newunstable.first()]) > +_('cannot edit commit information in the middle of a '\ > +'stack'), hint=_('%s will become unstable and new unstable'\ > +' changes are not allowed') % repo[newunstable.first()]) > root = head = repo[revs.first()] > > wctx = repo[None] > @@ -3299,7 +3301,8 @@ > head = repo[heads.first()] > if _disallowednewunstable(repo, revs): > raise error.Abort(_("cannot fold chain not ending with a head "\ > -"or with branching")) > +"or with branching"), hint = _("new unstable"\ > +" changesets are not allowed")) > return root, head > > def _disallowednewunstable(repo, revs): > diff -r cb2bac3253fb -r 920d5946d133 tests/test-evolve.t > --- a/tests/test-evolve.tWed Nov 02 18:56:44 2016 +0100 > +++ b/tests/test-evolve.tWed Nov 23 21:00:42 2016 +0530 > @@ -1301,9 +1301,11 @@ >created new head >$ hg prune '26 + 27' >abort: cannot prune in the middle of a stack > + (new unstable changesets are not allowed) >[255] >$ hg prune '19::28' >abort: cannot prune in the middle of a stack > + (new unstable changesets are not allowed) >[255] >$ hg prune '26::' >3 changesets pruned > @@ -1338,9 +1340,11 @@ > >$ hg fold --exact "19 + 18" >abort: cannot fold chain not ending with a head or with branching > + (new unstable changesets are not allowed) >[255] >$ hg fold --exact "18::29" >abort: cannot fold chain not ending with a head or with branching > + (new unstable changesets are not allowed) >[255] >$ hg fold --exact "19::" >2 changesets folded > @@ -1483,10 +1487,11 @@ > check that metaedit respects allowunstable >$ hg metaedit '.^' --config 'experimental.evolution=createmarkers, allnewcommands' >abort: cannot edit commit information in the middle of a stack > - (c904da5245b0 will be affected) > + (c904da5245b0 will become unstable and new unstable changes are not allowed) >[255] >$ hg metaedit '18::20' --fold --config 'experimental.evolution=createmarkers, allnewcommands' >abort: cannot fold chain not ending with a head or with branching > + (new unstable changesets are not allowed) >[255] >$ hg metaedit --user foobar >0 files updated, 0 files merged, 0 files removed, 0 files unresolved -- ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DgIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Pp-gQYFgs4tKlSFPF5kfCw&m=QukFSh3cja_kc0KmG_KvCqtbq77q1UqiBomG5m3Nr5I&s=ywLFcN2fvyXbzsLQIBB1
Re: [PATCH 1 of 5] posix: move checkexec test file to .hg/cache
On Tue, Nov 29, 2016 at 2:52 PM, Siddharth Agarwal wrote: > On 11/17/16 10:44, Mads Kiilerich wrote: > >> # HG changeset patch >> # User Mads Kiilerich >> # Date 1479383976 -3600 >> # Thu Nov 17 12:59:36 2016 +0100 >> # Node ID 1b5e959ebd859c27b3369124c926a512e222545c >> # Parent 854190becacb8abecbf5c18a777b02bbc045 >> posix: move checkexec test file to .hg/cache >> >> This avoids unnecessary churn in the working directory. >> >> It is not necessarily a fully valid assumption that .hg/cache is on the >> same >> filesystem as the working directory, but I think it is an acceptable >> approximation. >> > > I remember Matt talking about this exact issue and saying that this is not > a reasonable assumption. > > Source? I could easily see: * .hg/cache being on a network/shared filesystem * .hg/cache being on a separate filesystem from .hg/store (due to shared repos) But the main .hg directory and .hg/cache /should/ be on the same filesystem as the working directory since we don't allow detaching the .hg directory. The only scenario I can think of is someone who has moved .hg to another filesystem and symlinked .hg in the working directory to it. I guess that's plausible. Ugh. > > It could also be the case that different parts of the working >> directory is on different mount points so checking in the root folder >> could >> also be wrong. >> >> diff --git a/mercurial/posix.py b/mercurial/posix.py >> --- a/mercurial/posix.py >> +++ b/mercurial/posix.py >> @@ -160,7 +160,10 @@ def checkexec(path): >> try: >> EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH >> -fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') >> +cachedir = os.path.join(path, '.hg', 'cache') >> +if not os.path.isdir(cachedir): >> +cachedir = path >> +fh, fn = tempfile.mkstemp(dir=cachedir, prefix='hg-checkexec-') >> try: >> os.close(fh) >> m = os.stat(fn).st_mode & 0o777 >> ___ >> Mercurial-devel mailing list >> Mercurial-devel@mercurial-scm.org >> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel >> > > > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: mercurial@30549: 7 new changesets
Anyone know what process sends these emails? It would be nice to see the URLs updated to point to https://www.mercurial-scm.org/repo/hg. On Tue, Nov 29, 2016 at 10:16 AM, Mercurial Commits wrote: > 7 new changesets in mercurial: > > http://selenic.com/repo/hg//rev/03fae9048fa1 > changeset: 30543:03fae9048fa1 > user:Cotizo Sima > date:Mon Nov 28 04:34:01 2016 -0800 > summary: revlog: ensure that flags do not overflow 2 bytes > > http://selenic.com/repo/hg//rev/d4035372db8d > changeset: 30544:d4035372db8d > user:Jun Wu > date:Mon Nov 28 23:12:54 2016 + > summary: crecord: move status window text calculation to a separate > method > > http://selenic.com/repo/hg//rev/f3cff00c7a00 > changeset: 30545:f3cff00c7a00 > user:Jun Wu > date:Wed Nov 23 22:23:15 2016 + > summary: crecord: make _getstatuslines update numstatuslines > > http://selenic.com/repo/hg//rev/9b674957e2e4 > changeset: 30546:9b674957e2e4 > user:Jun Wu > date:Mon Nov 28 23:33:02 2016 + > summary: crecord: rewrite status line text (BC) > > http://selenic.com/repo/hg//rev/5129ed3c2548 > changeset: 30547:5129ed3c2548 > user:Jun Wu > date:Mon Nov 28 23:37:29 2016 + > summary: crecord: change help text for the space key dynamically > > http://selenic.com/repo/hg//rev/8d9745ff1e62 > changeset: 30548:8d9745ff1e62 > user:Jun Wu > date:Mon Nov 28 23:38:46 2016 + > summary: crecord: change the verb according to the operation > > http://selenic.com/repo/hg//rev/9e29d4e4e08b > changeset: 30549:9e29d4e4e08b > bookmark:@ > tag: tip > user:Kostia Balytskyi > date:Tue Nov 29 04:11:05 2016 -0800 > summary: shelve: fix use of unexpected working dirs in test-shelve.t > > -- > Repository URL: http://selenic.com/repo/hg/ > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 8 V11] bookmarks: rename `compare()` to `comparebookmarks()` (API)
On Tue, Nov 22, 2016 at 2:17 AM, Stanislau Hlebik wrote: > # HG changeset patch > # User Stanislau Hlebik > # Date 1479807211 28800 > # Tue Nov 22 01:33:31 2016 -0800 > # Node ID 20e2f13b7a1083f8d44a7a9e554eb3d5735b80f2 > # Parent 8efced91de4d48478555d91c53e89cd1b4e3b78d > bookmarks: rename `compare()` to `comparebookmarks()` (API) > > Next commit will remove optional parameters from `compare()` function. > Let's rename `compare()` to `comparebookmarks()` to avoid ambiguity from > callers from external extensions. > The first 2 in this series LGTM. > > diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py > --- a/mercurial/bookmarks.py > +++ b/mercurial/bookmarks.py > @@ -391,8 +391,8 @@ > finally: > lockmod.release(tr, l, w) > > -def compare(repo, srcmarks, dstmarks, > -srchex=None, dsthex=None, targets=None): > +def comparebookmarks(repo, srcmarks, dstmarks, > + srchex=None, dsthex=None, targets=None): > '''Compare bookmarks between srcmarks and dstmarks > > This returns tuple "(addsrc, adddst, advsrc, advdst, diverge, > @@ -511,7 +511,7 @@ > ui.debug("checking for updated bookmarks\n") > localmarks = repo._bookmarks > (addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same > - ) = compare(repo, remotemarks, localmarks, dsthex=hex) > + ) = comparebookmarks(repo, remotemarks, localmarks, dsthex=hex) > > status = ui.status > warn = ui.warn > @@ -573,8 +573,8 @@ > ''' > ui.status(_("searching for changed bookmarks\n")) > > -r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks, > -dsthex=hex) > +r = comparebookmarks(repo, other.listkeys('bookmarks'), > repo._bookmarks, > + dsthex=hex) > addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r > > incomings = [] > @@ -615,8 +615,8 @@ > ''' > ui.status(_("searching for changed bookmarks\n")) > > -r = compare(repo, repo._bookmarks, other.listkeys('bookmarks'), > -srchex=hex) > +r = comparebookmarks(repo, repo._bookmarks, > other.listkeys('bookmarks'), > + srchex=hex) > addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r > > outgoings = [] > @@ -660,8 +660,8 @@ > > This returns "(# of incoming, # of outgoing)" tuple. > ''' > -r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks, > -dsthex=hex) > +r = comparebookmarks(repo, other.listkeys('bookmarks'), > repo._bookmarks, > + dsthex=hex) > addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r > return (len(addsrc), len(adddst)) > > diff --git a/mercurial/exchange.py b/mercurial/exchange.py > --- a/mercurial/exchange.py > +++ b/mercurial/exchange.py > @@ -603,7 +603,8 @@ > explicit = set([repo._bookmarks.expandname(bookmark) > for bookmark in pushop.bookmarks]) > > -comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, > srchex=hex) > +comp = bookmod.comparebookmarks(repo, repo._bookmarks, > +remotebookmark, srchex=hex) > addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp > for b, scid, dcid in advsrc: > if b in explicit: > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 8 V11] bookmarks: make bookmarks.compare accept binary nodes (API)
On Tue, Nov 22, 2016 at 2:17 AM, Stanislau Hlebik wrote: > # HG changeset patch > # User Stanislau Hlebik > # Date 1479807361 28800 > # Tue Nov 22 01:36:01 2016 -0800 > # Node ID 36d83269edc51168908c9b1160e22282ab6c5c04 > # Parent 20e2f13b7a1083f8d44a7a9e554eb3d5735b80f2 > bookmarks: make bookmarks.compare accept binary nodes (API) > Nit: commit message needs updating to reflect renamed function. > > New `bookmarks` bundle2 part will contain byte nodes, and since bookmarks > are > stored in binary format, it doesn't make sense to convert them from binary > to > hex and then back to binary again > > diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py > --- a/mercurial/bookmarks.py > +++ b/mercurial/bookmarks.py > @@ -391,8 +391,7 @@ > finally: > lockmod.release(tr, l, w) > > -def comparebookmarks(repo, srcmarks, dstmarks, > - srchex=None, dsthex=None, targets=None): > +def comparebookmarks(repo, srcmarks, dstmarks, targets=None): > '''Compare bookmarks between srcmarks and dstmarks > > This returns tuple "(addsrc, adddst, advsrc, advdst, diverge, > @@ -415,19 +414,9 @@ > Changeset IDs of tuples in "addsrc", "adddst", "differ" or > "invalid" list may be unknown for repo. > > -This function expects that "srcmarks" and "dstmarks" return > -changeset ID in 40 hexadecimal digit string for specified > -bookmark. If not so (e.g. bmstore "repo._bookmarks" returning > -binary value), "srchex" or "dsthex" should be specified to convert > -into such form. > - > If "targets" is specified, only bookmarks listed in it are > examined. > ''' > -if not srchex: > -srchex = lambda x: x > -if not dsthex: > -dsthex = lambda x: x > > if targets: > bset = set(targets) > @@ -449,14 +438,14 @@ > for b in sorted(bset): > if b not in srcmarks: > if b in dstmarks: > -adddst((b, None, dsthex(dstmarks[b]))) > +adddst((b, None, dstmarks[b])) > else: > invalid((b, None, None)) > elif b not in dstmarks: > -addsrc((b, srchex(srcmarks[b]), None)) > +addsrc((b, srcmarks[b], None)) > else: > -scid = srchex(srcmarks[b]) > -dcid = dsthex(dstmarks[b]) > +scid = srcmarks[b] > +dcid = dstmarks[b] > if scid == dcid: > same((b, scid, dcid)) > elif scid in repo and dcid in repo: > @@ -507,11 +496,17 @@ > > return None > > +def hexifybookmarks(marks): > +binremotemarks = {} > +for name, node in marks.items(): > +binremotemarks[name] = bin(node) > +return binremotemarks > + > "hexify" in a name that actually "unhexifies" is a bit confusing. "unhex" is not a word. But we use "unhexlify" already in the code base. So this should be "unhexlifybookmarks." I'm sorry to make you go through yet another iteration. This series is getting close though... > def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()): > ui.debug("checking for updated bookmarks\n") > localmarks = repo._bookmarks > (addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same > - ) = comparebookmarks(repo, remotemarks, localmarks, dsthex=hex) > +) = comparebookmarks(repo, remotemarks, localmarks) > > status = ui.status > warn = ui.warn > @@ -522,15 +517,15 @@ > changed = [] > for b, scid, dcid in addsrc: > if scid in repo: # add remote bookmarks for changes we already > have > -changed.append((b, bin(scid), status, > +changed.append((b, scid, status, > _("adding remote bookmark %s\n") % (b))) > elif b in explicit: > explicit.remove(b) > ui.warn(_("remote bookmark %s points to locally missing %s\n") > -% (b, scid[:12])) > +% (b, hex(scid)[:12])) > > for b, scid, dcid in advsrc: > -changed.append((b, bin(scid), status, > +changed.append((b, scid, status, > _("updating bookmark %s\n") % (b))) > # remove normal movement from explicit set > explicit.difference_update(d[0] for d in changed) > @@ -538,13 +533,12 @@ > for b, scid, dcid in diverge: > if b in explicit: > explicit.discard(b) > -changed.append((b, bin(scid), status, > +changed.append((b, scid, status, > _("importing bookmark %s\n") % (b))) > else: > -snode = bin(scid) > -db = _diverge(ui, b, path, localmarks, snode) > +db = _diverge(ui, b, path, localmarks, scid) > if db: > -changed.append((db, snode, warn, > +changed.append((db, scid, warn, > _("divergent bookmark %s stored as %s\n") > % >
Re: [PATCH 5 of 5 v4] changegroup3: enable on 'lfs' repo requirements
+cc:remi On Nov 29, 2016 13:51, "Kyle Lippincott via Mercurial-devel" < mercurial-devel@mercurial-scm.org> wrote: On Tue, Nov 29, 2016 at 9:37 AM, Augie Fackler wrote: > On Tue, Nov 29, 2016 at 07:59:11AM +0100, Pierre-Yves David wrote: > > [cc martin because I've a question about some code mentioning > 'treemanifest' > > > > On 11/23/2016 06:39 PM, Remi Chaintron wrote: > > ># HG changeset patch > > ># User Remi Chaintron > > ># Date 1479916365 0 > > ># Wed Nov 23 15:52:45 2016 + > > ># Branch stable > > ># Node ID b421c16161aed491fec20b600df5f1278b07bc1a > > ># Parent 75ee4746c198f039a39400e855e9335afc34f1dd > > >changegroup3: enable on 'lfs' repo requirements > > > > > >`changegroup3` is required by the `lfs` extension in order to send > flags for > > >revlog objects over the wire. > > > > It seems like the commit message needs to be updated too. > > > > >diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py > > >--- a/mercurial/changegroup.py > > >+++ b/mercurial/changegroup.py > > >@@ -879,14 +879,16 @@ > > > # Changegroup versions that can be applied to the repo > > > def supportedincomingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > versions.add('03') > > > > I've not seen 'lfs' used anywhere yet so this changeset seems a bit > > premature. Given the code in this series I would expect the next step to > be > > a minimal usage of the new code (either by porting some of censor or by > > using a test extension). Then we can start working on exchanging these > > flagged changesets. > > > > In addition, this piece of code is suspicious. If we have a changelog > '03' > > available, we should be using it. I'm not sure why we only consider it > when > > treemanifest is used. Martin: is this the remain of a period where the > '03' > > format was experimental? Did we actually tested the new format now? Can > we > > drop this special case? > > Martin is on vacation (and you didn't add him to CC?), but we've been > using changegroup3 extensively, and I think we're happy with it. Added > spectral to confirm. > Yes, we've been using changegroup3 internally without issues for a while now. It's required for treemanifests and I'm pretty sure is required by recent versions of narrowhg. I'm fine with freezing it and making it non-experimental. I agree, let's make it non-experimental. I assume that also means it's on by default and will be used be getbundle. IIRC, "hg bundle" will still produce a cg2 bundle, though, unless cg3 is forced by the presence of the treemanifest requirement. So, in the same way, you'll still need to force it to use cg3 when the lfs requirement is there. Looking at the patch, that seems to mean removing the first hunk (after the patch the makes cg3 on by default), but keeping the second hunk (and third). Or maybe I'm just confusing it with how there is no way to specify cg3 to "hg bundle", but once it's on by default, it will get picked up. On that case, there will instead be some BC concern in that people with a new hg can not share a bundle with people with an old (current) hg. As I said, I'm not sure which, so please check for yourself (I guess I'm talking to Remi here). > > > > > > > > return versions > > > > > > # Changegroup versions that can be created from the repo > > > def supportedoutgoingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > # Versions 01 and 02 support only flat manifests and it's just > too > > > # expensive to convert between the flat manifest and tree > manifest on > > > # the fly. Since tree manifests are hashed differently, all of > history > > >diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > > >--- a/mercurial/localrepo.py > > >+++ b/mercurial/localrepo.py > > >@@ -238,7 +238,7 @@ > > > class localrepository(object): > > > > > > supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest', > > >-'manifestv2')) > > >+'manifestv2', 'lfs')) > > > _basesupported = supportedformats | set(('store', 'fncache', > 'shared', > > > 'dotencode')) > > > openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', > 'manifestv2')) > > >___ > > >Mercurial-devel mailing list > > >Mercurial-devel@mercurial-scm.org > > >https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > > > > -- > > Pierre-Yves David > > ___ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial
Re: [PATCH 3 of 5 v4] revlog: pass flags to addrevision
On Nov 23, 2016 10:39, "Remi Chaintron" wrote: # HG changeset patch # User Remi Chaintron # Date 1479916365 0 # Wed Nov 23 15:52:45 2016 + # Branch stable # Node ID da91f91e979d6bf807912e956cf2f29573ede56f # Parent eb24cc60a279d614b3181a84464200bbcf5f6bb4 revlog: pass flags to addrevision I think narrowhg would be happy if the flags were passed all the way through to checkhash(). We (some Googler) will probably send a patch the does that later otherwise, but maybe you can squeeze it into this patch? Add the ability to pass known revision flags to `revlog.addrevision`. This allows to ensure present flags are propagated and usable by the extensions relying on the flagprocessor, such as `lfs`. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1401,7 +1401,7 @@ self._chunkclear() def addrevision(self, text, transaction, link, p1, p2, cachedelta=None, -node=None): +node=None, flags=REVIDX_DEFAULT_FLAGS): """add a revision to the log text - the revision data to add @@ -1412,6 +1412,7 @@ node - nodeid of revision; typically node is not specified, and it is computed by default as hash(text, p1, p2), however subclasses might use different hashing method (and override checkhash() in such case) +flags - the known flags to set on the revision """ if link == nullrev: raise RevlogError(_("attempted to add linkrev -1 to %s") @@ -1432,7 +1433,7 @@ ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig) try: return self._addrevision(node, text, transaction, link, p1, p2, - REVIDX_DEFAULT_FLAGS, cachedelta, ifh, dfh) + flags, cachedelta, ifh, dfh) finally: if dfh: dfh.close() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 09 of 10 shelve-ext] shelve: add obs-based unshelve functionality
On Tue, Nov 29, 2016, 08:23 Kostia Balytskyi wrote: > # HG changeset patch > # User Kostia Balytskyi > # Date 1480431173 28800 > # Tue Nov 29 06:52:53 2016 -0800 > # Node ID 533d99eca3bf11c4aac869674e0abb16b74ed670 > # Parent 85c9c651887915733feb3d385866955741f28ec0 > shelve: add obs-based unshelve functionality > > Obsolescense-based unshelve works as follows: > 1. Instead of stripping temporary nodes, markers are created to > obsolete them. > 2. Restoring commit is just finding it in an unfiltered repo. > What happens if it's been stripped? Speaking of that, I didn't see any tests added in this series. Seems like there should be some. Did I just miss them? 3. '--keep' is only passed to rebase on traditional unshelves > (and thus traditional rebases), becuase we want markers to be > created fro obsolete-based rebases. > 4. 'hg unshelve' uses unfiltered repo to perform rebases > because we want rebase to be able to create markers between original > and new commits. 'rebaseskipobsolete' is disabled to make rebase not > skip the commit altogether. > > diff --git a/hgext/shelve.py b/hgext/shelve.py > --- a/hgext/shelve.py > +++ b/hgext/shelve.py > @@ -26,6 +26,7 @@ import collections > import errno > import itertools > import json > +import time > > from mercurial.i18n import _ > from mercurial import ( > @@ -264,8 +265,13 @@ class shelvedstate(object): > > def prunenodes(self): > """Cleanup temporary nodes from the repo""" > -repair.strip(self.ui, self.repo, self.nodestoprune, backup=False, > - topic='shelve') > +if self.obsshelve: > +unfi = self.repo.unfiltered() > +relations = [(unfi[n], ()) for n in self.nodestoprune] > +obsolete.createmarkers(self.repo, relations) > +else: > +repair.strip(self.ui, self.repo, self.nodestoprune, > backup=False, > + topic='shelve') > > def cleanupoldbackups(repo): > vfs = scmutil.vfs(repo.join(backupdir)) > @@ -670,9 +676,14 @@ def unshelvecontinue(ui, repo, state, op > util.rename(repo.join('unshelverebasestate'), > repo.join('rebasestate')) > try: > -rebase.rebase(ui, repo, **{ > -'continue' : True > -}) > +# if shelve is obs-based, we want rebase to be able > +# to create markers to already-obsoleted commits > +_repo = repo.unfiltered() if state.obsshelve else repo > +with ui.configoverride({('experimental', > 'rebaseskipobsolete'): > +'off'}, 'unshelve'): > +rebase.rebase(ui, _repo, **{ > +'continue' : True, > +}) > except Exception: > util.rename(repo.join('rebasestate'), > repo.join('unshelverebasestate')) > @@ -712,30 +723,54 @@ def _commitworkingcopychanges(ui, repo, > with ui.configoverride({('ui', 'quiet'): True}): > node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) > tmpwctx = repo[node] > +ui.debug("temporary working copy commit: %s:%s\n" % > + (tmpwctx.rev(), nodemod.short(node))) > return tmpwctx, addedbefore > > -def _unshelverestorecommit(ui, repo, basename): > +def _unshelverestorecommit(ui, repo, basename, obsshelve, shfile): > """Recreate commit in the repository during the unshelve""" > with ui.configoverride({('ui', 'quiet'): True}): > -shelvedfile(repo, basename, 'hg').applybundle() > -shelvectx = repo['tip'] > +if obsshelve: > +md = shfile.readjson() > +shelvenode = nodemod.bin(md['node']) > +repo = repo.unfiltered() > +shelvectx = repo[shelvenode] > +else: > +shelvedfile(repo, basename, 'hg').applybundle() > +shelvectx = repo['tip'] > return repo, shelvectx > > def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx, > - tmpwctx, shelvectx, branchtorestore): > + tmpwctx, shelvectx, branchtorestore, obsshelve): > """Rebase restored commit from its original location to a > destination""" > # If the shelve is not immediately on top of the commit > # we'll be merging with, rebase it to be on top. > if tmpwctx.node() == shelvectx.parents()[0].node(): > +# shelvectx is immediately on top of the tmpwctx > return shelvectx > > +# we need a new commit extra every time we perform a rebase to ensure > +# that "nothing to rebase" does not happen with obs-based shelve > +# "nothing to rebase" means that tip does not point to a "successor" > +# commit after a rebase and we have no way to learn which commit > +# should be a "shelvectx". this is a dirty hack until we implement > +# some way to learn the results of rebase operation, other than > +# text output and
Re: mercurial@30549: 7 new changesets
Hi! * Gregory Szorc [20161130 04:53]: > Anyone know what process sends these emails? It would be nice to see the > URLs updated to point to https://www.mercurial-scm.org/repo/hg. I generate them and just updated the URL. Thank you for the reminder! Regards, Thomas -- tho...@intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998 Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel