D9473: upgrade: capitalize the `deficiency` constant
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I am reworking this code and moving to the current naming scheme help readability. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9473 AFFECTED FILES mercurial/upgrade.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -151,7 +151,7 @@ return set() -deficiency = b'deficiency' +DEFICIENCY = b'deficiency' optimisation = b'optimization' @@ -165,13 +165,13 @@ will be mapped to an action later in the upgrade process. type - Either ``deficiency`` or ``optimisation``. A deficiency is an obvious + Either ``DEFICIENCY`` or ``optimisation``. A deficiency is an obvious problem. An optimization is an action (sometimes optional) that can be taken to further improve the state of the repository. description Message intended for humans explaining the improvement in more detail, - including the implications of it. For ``deficiency`` types, should be + including the implications of it. For ``DEFICIENCY`` types, should be worded in the present tense. For ``optimisation`` types, should be worded in the future tense. @@ -210,7 +210,7 @@ class formatvariant(improvement): """an improvement subclass dedicated to repository format""" -type = deficiency +type = DEFICIENCY ### The following attributes should be defined for each class: # machine-readable string uniquely identifying this improvement. it will be @@ -218,7 +218,7 @@ name = None # message intended for humans explaining the improvement in more detail, -# including the implications of it ``deficiency`` types, should be worded +# including the implications of it ``DEFICIENCY`` types, should be worded # in the present tense. description = None To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9474: upgrade: capitalize the `deficiency` constant
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I am reworking this code and moving to the current naming scheme help readability. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9474 AFFECTED FILES mercurial/upgrade.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -152,7 +152,7 @@ DEFICIENCY = b'deficiency' -optimisation = b'optimization' +OPTIMISATION = b'optimization' class improvement(object): @@ -165,14 +165,14 @@ will be mapped to an action later in the upgrade process. type - Either ``DEFICIENCY`` or ``optimisation``. A deficiency is an obvious + Either ``DEFICIENCY`` or ``OPTIMISATION``. A deficiency is an obvious problem. An optimization is an action (sometimes optional) that can be taken to further improve the state of the repository. description Message intended for humans explaining the improvement in more detail, including the implications of it. For ``DEFICIENCY`` types, should be - worded in the present tense. For ``optimisation`` types, should be + worded in the present tense. For ``OPTIMISATION`` types, should be worded in the future tense. upgrademessage @@ -551,7 +551,7 @@ optimizations.append( improvement( name=b're-delta-parent', -type=optimisation, +type=OPTIMISATION, description=_( b'deltas within internal storage will be recalculated to ' b'choose an optimal base revision where this was not ' @@ -571,7 +571,7 @@ optimizations.append( improvement( name=b're-delta-multibase', -type=optimisation, +type=OPTIMISATION, description=_( b'deltas within internal storage will be recalculated ' b'against multiple base revision and the smallest ' @@ -595,7 +595,7 @@ optimizations.append( improvement( name=b're-delta-all', -type=optimisation, +type=OPTIMISATION, description=_( b'deltas within internal storage will always be ' b'recalculated without reusing prior deltas; this will ' @@ -613,7 +613,7 @@ optimizations.append( improvement( name=b're-delta-fulladd', -type=optimisation, +type=OPTIMISATION, description=_( b'every revision will be re-added as if it was new ' b'content. It will go through the full storage ' @@ -1297,7 +1297,7 @@ ui.write(b'\n') def printoptimisations(): -optimisations = [a for a in actions if a.type == optimisation] +optimisations = [a for a in actions if a.type == OPTIMISATION] optimisations.sort(key=lambda a: a.name) if optimisations: ui.write(_(b'optimisations: ')) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9475: upgrade: move optimisation to something more declarative
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is not great yet, but still better than the previous state. This get use one step closer to having all the possible "actions" clearly declared and moved in a dedicated module. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9475 AFFECTED FILES mercurial/upgrade.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -541,96 +541,102 @@ b'redeltafulladd': b're-delta-fulladd', } +ALL_OPTIMISATIONS = [] + + +def register_optimization(obj): +ALL_OPTIMISATIONS.append(obj) +return obj + + +register_optimization( +improvement( +name=b're-delta-parent', +type=OPTIMISATION, +description=_( +b'deltas within internal storage will be recalculated to ' +b'choose an optimal base revision where this was not ' +b'already done; the size of the repository may shrink and ' +b'various operations may become faster; the first time ' +b'this optimization is performed could slow down upgrade ' +b'execution considerably; subsequent invocations should ' +b'not run noticeably slower' +), +upgrademessage=_( +b'deltas within internal storage will choose a new ' +b'base revision if needed' +), +) +) + +register_optimization( +improvement( +name=b're-delta-multibase', +type=OPTIMISATION, +description=_( +b'deltas within internal storage will be recalculated ' +b'against multiple base revision and the smallest ' +b'difference will be used; the size of the repository may ' +b'shrink significantly when there are many merges; this ' +b'optimization will slow down execution in proportion to ' +b'the number of merges in the repository and the amount ' +b'of files in the repository; this slow down should not ' +b'be significant unless there are tens of thousands of ' +b'files and thousands of merges' +), +upgrademessage=_( +b'deltas within internal storage will choose an ' +b'optimal delta by computing deltas against multiple ' +b'parents; may slow down execution time ' +b'significantly' +), +) +) + +register_optimization( +improvement( +name=b're-delta-all', +type=OPTIMISATION, +description=_( +b'deltas within internal storage will always be ' +b'recalculated without reusing prior deltas; this will ' +b'likely make execution run several times slower; this ' +b'optimization is typically not needed' +), +upgrademessage=_( +b'deltas within internal storage will be fully ' +b'recomputed; this will likely drastically slow down ' +b'execution time' +), +) +) + +register_optimization( +improvement( +name=b're-delta-fulladd', +type=OPTIMISATION, +description=_( +b'every revision will be re-added as if it was new ' +b'content. It will go through the full storage ' +b'mechanism giving extensions a chance to process it ' +b'(eg. lfs). This is similar to "re-delta-all" but even ' +b'slower since more logic is involved.' +), +upgrademessage=_( +b'each revision will be added as new content to the ' +b'internal storage; this will likely drastically slow ' +b'down execution time, but some extensions might need ' +b'it' +), +) +) + def findoptimizations(repo): """Determine optimisation that could be used during upgrade""" # These are unconditionally added. There is logic later that figures out # which ones to apply. -optimizations = [] - -optimizations.append( -improvement( -name=b're-delta-parent', -type=OPTIMISATION, -description=_( -b'deltas within internal storage will be recalculated to ' -b'choose an optimal base revision where this was not ' -b'already done; the size of the repository may shrink and ' -b'various operations may become faster; the first time ' -b'this optimization is performed could slow down upgrade ' -b'execution considerably; subsequent invocations should ' -b'not run noticeably slower' -), -upgrademessage=_( -b'deltas within internal storage will choose a new ' -b'base revision if needed' -), -) -) - -optimizations.app
[PATCH 1 of 4] scmutil: document that bookmarkrevs() ignores non-head bookmark branch
# HG changeset patch # User Yuya Nishihara # Date 1606819561 -32400 # Tue Dec 01 19:46:01 2020 +0900 # Node ID 4439db4d98bc5d5d05b709d0886cb81b1347516e # Parent d42809b6b10ff91cf6fcad5914e77c6974195e78 scmutil: document that bookmarkrevs() ignores non-head bookmark branch "- ancestors(head() and not bookmark(%s))" excludes the bookmarked branch itself if bookmark(%s) is not a head. I'm a bit surprised by this behavior while writing "log -B" tests, so let's document it. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -2300,8 +2300,9 @@ def _getrevsfromsymbols(repo, symbols): def bookmarkrevs(repo, mark): -""" -Select revisions reachable by a given bookmark +"""Select revisions reachable by a given bookmark + +If the bookmarked revision isn't a head, an empty set will be returned. """ return repo.revs( b"ancestors(bookmark(%s)) - " ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 4] log: do not accept string-matcher pattern as -u/-b/-B parameter
# HG changeset patch # User Yuya Nishihara # Date 1606821744 -32400 # Tue Dec 01 20:22:24 2020 +0900 # Node ID 8e8feec5114933aaa5224ff33acfa1bc9a52625c # Parent 773cf7f8899449979131792e82a49fc6bc0d25ec log: do not accept string-matcher pattern as -u/-b/-B parameter I'm pretty sure this is a bug introduced after we've switched the filtering backend to revset matcher. diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -898,13 +898,13 @@ def _makenofollowfilematcher(repo, pats, def _makerevset(repo, wopts, slowpath): """Return a revset string built from log options and file patterns""" opts = { -b'branch': [repo.lookupbranch(b) for b in wopts.branches], +b'branch': [b'literal:' + repo.lookupbranch(b) for b in wopts.branches], b'date': wopts.date, b'keyword': wopts.keywords, b'no_merges': wopts.no_merges, b'only_merges': wopts.only_merges, b'prune': wopts.prune_ancestors, -b'user': wopts.users, +b'user': [b'literal:' + v for v in wopts.users], } if wopts.filter_revisions_by_pats and slowpath: diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -2310,6 +2310,7 @@ def bookmarkrevs(repo, mark): def format_bookmark_revspec(mark): """Build a revset expression to select revisions reachable by a given bookmark""" +mark = b'literal:' + mark return revsetlang.formatspec( b"ancestors(bookmark(%s)) - " b"ancestors(head() and not bookmark(%s)) - " diff --git a/tests/test-glog-beautifygraph.t b/tests/test-glog-beautifygraph.t --- a/tests/test-glog-beautifygraph.t +++ b/tests/test-glog-beautifygraph.t @@ -1588,19 +1588,19 @@ glog always reorders nodes which explain (list (func (symbol 'user') -(string 'test')) +(string 'literal:test')) (func (symbol 'user') -(string 'not-a-user' +(string 'literal:not-a-user' , , ->, +>, , ->>> +>>> $ testlog -b not-a-branch abort: unknown revision 'not-a-branch' abort: unknown revision 'not-a-branch' @@ -1611,28 +1611,28 @@ glog always reorders nodes which explain (list (func (symbol 'branch') -(string 'default')) +(string 'literal:default')) (or (list (func (symbol 'branch') -(string 'branch')) +(string 'literal:branch')) (func (symbol 'branch') -(string 'branch')) +(string 'literal:branch')) , , ->, +>, , - >, + >, , - + $ testlog -k expand -k merge [] (or diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -1438,19 +1438,19 @@ glog always reorders nodes which explain (list (func (symbol 'user') -(string 'test')) +(string 'literal:test')) (func (symbol 'user') -(string 'not-a-user' +(string 'literal:not-a-user' , , ->, +>, , ->>> +>>> $ testlog -b not-a-branch abort: unknown revision 'not-a-branch' abort: unknown revision 'not-a-branch' @@ -1461,28 +1461,28 @@ glog always reorders nodes which explain (list (func (symbol 'branch') -(string 'default')) +(string 'literal:default')) (or (list (func (symbol 'branch') -(string 'branch')) +(string 'literal:branch')) (func (symbol 'branch') -(string 'branch')) +(string 'literal:branch')) , , ->, +>, , - >, + >, , - + $ testlog -k expand -k merge [] (or diff --git a/tests/test-log-bookmark.t b/tests/test-log-bookmark.t --- a/tests/test-log-bookmark.t +++ b/tests/test-log-bookmark.t @@ -190,3 +190,9 @@ Unknown bookmark: $ hg log -B unknown abort: bookmark 'unknown' does not exist [255] + +Shouldn't accept string-matcher syntax: + + $ hg log -B 're:.*' + abort: bookmark 're:.*' does not exist + [255] diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1378,6 +1378,14 @@ are specified (issue5100): 1 k1 0 k0 + log -b/-u/-k shouldn't accept string-matcher syntax: + + $ hg log -b 're:.*' + abort: unknown revision 're:.*' + [255] + $ hg log -k 're:.*' + $ hg log -u 're:.*' + log FILE in ascending order, against dagrange: $ hg log -r1:: -T '{rev} {files}\n' f1 f2 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial
[PATCH 2 of 4] scmutil: extract function that builds revset expr to select bookmark branch
# HG changeset patch # User Yuya Nishihara # Date 1606818203 -32400 # Tue Dec 01 19:23:23 2020 +0900 # Node ID 3b3f53b5b57f32b10c6e5c8aacffab002fd793ea # Parent 4439db4d98bc5d5d05b709d0886cb81b1347516e scmutil: extract function that builds revset expr to select bookmark branch This is needed to process "log -B" option properly. "log" options have to be translated to a revset expression, not to an evaluated set. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -2304,7 +2304,13 @@ def bookmarkrevs(repo, mark): If the bookmarked revision isn't a head, an empty set will be returned. """ -return repo.revs( +return repo.revs(format_bookmark_revspec(mark)) + + +def format_bookmark_revspec(mark): +"""Build a revset expression to select revisions reachable by a given +bookmark""" +return revsetlang.formatspec( b"ancestors(bookmark(%s)) - " b"ancestors(head() and not bookmark(%s)) - " b"ancestors(bookmark() and not bookmark(%s))", ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 4] log: do not override other filtering and sorting options by --bookmark
# HG changeset patch # User Yuya Nishihara # Date 1606818756 -32400 # Tue Dec 01 19:32:36 2020 +0900 # Node ID 773cf7f8899449979131792e82a49fc6bc0d25ec # Parent 3b3f53b5b57f32b10c6e5c8aacffab002fd793ea log: do not override other filtering and sorting options by --bookmark This basically reimplements 0aa118f18d4b 'log: add bookmark option to "hg log"'. Before, any other filtering options but --rev were ignored. -G didn't work either since the ordering constraint wasn't enforced. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4636,12 +4636,6 @@ def log(ui, repo, *pats, **opts): # then filter the result by logcmdutil._makerevset() and --limit revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts) -if opts.get(b'bookmark'): -cmdutil.check_at_most_one_arg(opts, b'rev', b'bookmark') -bookmarks = opts.get(b'bookmark') -bookmark = bookmarks[0] -revs, differ = logcmdutil.get_bookmark_revs(repo, bookmark, walk_opts) - getcopies = None if opts.get(b'copies'): endrev = None diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -691,6 +691,7 @@ class walkopts(object): revspec = attr.ib() # type: List[bytes] # miscellaneous queries to filter revisions (see "hg help log" for details) +bookmarks = attr.ib(default=attr.Factory(list)) # type: List[bytes] branches = attr.ib(default=attr.Factory(list)) # type: List[bytes] date = attr.ib(default=None) # type: Optional[bytes] keywords = attr.ib(default=attr.Factory(list)) # type: List[bytes] @@ -746,6 +747,7 @@ def parseopts(ui, pats, opts): pats=pats, opts=opts, revspec=opts.get(b'rev', []), +bookmarks=opts.get(b'bookmark', []), # branch and only_branch are really aliases and must be handled at # the same time branches=opts.get(b'branch', []) + opts.get(b'only_branch', []), @@ -937,6 +939,14 @@ def _makerevset(repo, wopts, slowpath): val = [revsetlang.formatspec(revop, v) for v in val] expr.append(revsetlang.formatspec(listop, val)) +if wopts.bookmarks: +expr.append( +revsetlang.formatspec( +b'%lr', +[scmutil.format_bookmark_revspec(v) for v in wopts.bookmarks], +) +) + if expr: expr = b'(' + b' and '.join(expr) + b')' else: @@ -1023,26 +1033,6 @@ def getrevs(repo, wopts): return revs, differ -def get_bookmark_revs(repo, bookmark, walk_opts): -# type: (Any, bookmark, walk_opts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]] -"""Return (revs, differ) where revs is a smartset - -differ is a changesetdiffer with pre-configured file matcher. -""" -revs, filematcher = makewalker(repo, walk_opts) -if not revs: -return revs, None -differ = changesetdiffer() -differ._makefilematcher = filematcher - -if bookmark: -if bookmark not in repo._bookmarks: -raise error.Abort(_(b"bookmark '%s' not found") % bookmark) -revs = scmutil.bookmarkrevs(repo, bookmark) - -return revs, differ - - def _parselinerangeopt(repo, opts): """Parse --line-range log option and return a list of tuples (filename, (fromline, toline)). diff --git a/tests/test-log-bookmark.t b/tests/test-log-bookmark.t --- a/tests/test-log-bookmark.t +++ b/tests/test-log-bookmark.t @@ -125,3 +125,68 @@ Check the log of topic X, topic Y, and d date:Thu Jan 01 00:00:00 1970 + summary: Add foo in 'default' + +Set up multiple bookmarked heads: + + $ hg bookmark merged-head + $ hg up 1 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + (leaving bookmark merged-head) + $ echo "Z" > z.txt + $ hg ci -Am 'Add Z' + adding z.txt + $ hg bookmark topic-Z + + $ hg log -GT '{rev}: {branch}, {bookmarks}\n' + @ 5: sebhtml, topic-Z + | + | o 4: default, merged-head + |/| + | o3: default, + | |\ + | | o 2: sebhtml, sebhtml/2-topic-Y + | |/ + o | 1: sebhtml, sebhtml/1-topic-X + |/ + o 0: default, + + +Multiple revisions under bookmarked head: + + $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head + o4: default, merged-head + |\ + | ~ + o3: default, + |\ + ~ ~ + +Follows multiple bookmarks: + + $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head -B topic-Z + @ 5: sebhtml, topic-Z + | + ~ + o4: default, merged-head + |\ + | ~ + o3: default, + |\ + ~ ~ + +Filter by bookmark and branch: + + $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head -B topic-Z -b default + o4: default, merged-head + |\ + | ~ + o3: default, + |\ + ~ ~ + + +Unknown bookmark: + + $ hg log -B unknown + abort: bookmark 'unknown' does not exist + [255] ___
D9476: upgrade: split actual upgrade code away from the main module
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The main module is getting big and hard to follow. So we are splitting all the logic to actually run an upgrade in a sub module. It nicely highlight that there are very few actual call point to the code we just moved. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9476 AFFECTED FILES hgext/lfs/wrapper.py mercurial/upgrade.py mercurial/upgrade_utils/__init__.py mercurial/upgrade_utils/engine.py setup.py tests/testlib/ext-sidedata.py CHANGE DETAILS diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py --- a/tests/testlib/ext-sidedata.py +++ b/tests/testlib/ext-sidedata.py @@ -15,9 +15,10 @@ node, requirements, revlog, -upgrade, ) +from mercurial.upgrade_utils import engine as upgrade_engine + from mercurial.revlogutils import sidedata @@ -79,5 +80,5 @@ extensions.wrapfunction(revlog.revlog, 'addrevision', wrapaddrevision) extensions.wrapfunction(revlog.revlog, 'revision', wraprevision) extensions.wrapfunction( -upgrade, 'getsidedatacompanion', wrapgetsidedatacompanion +upgrade_engine, 'getsidedatacompanion', wrapgetsidedatacompanion ) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1287,6 +1287,7 @@ 'mercurial.thirdparty.attr', 'mercurial.thirdparty.zope', 'mercurial.thirdparty.zope.interface', +'mercurial.upgrade_utils', 'mercurial.utils', 'mercurial.revlogutils', 'mercurial.testing', diff --git a/mercurial/upgrade.py b/mercurial/upgrade_utils/engine.py copy from mercurial/upgrade.py copy to mercurial/upgrade_utils/engine.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade_utils/engine.py @@ -9,14 +9,12 @@ import stat -from .i18n import _ -from .pycompat import getattr -from . import ( +from ..i18n import _ +from ..pycompat import getattr +from .. import ( changelog, error, filelog, -hg, -localrepo, manifest, metadata, pycompat, @@ -27,648 +25,6 @@ vfs as vfsmod, ) -from .utils import compression - -# list of requirements that request a clone of all revlog if added/removed -RECLONES_REQUIREMENTS = { -b'generaldelta', -requirements.SPARSEREVLOG_REQUIREMENT, -} - - -def requiredsourcerequirements(repo): -"""Obtain requirements required to be present to upgrade a repo. - -An upgrade will not be allowed if the repository doesn't have the -requirements returned by this function. -""" -return { -# Introduced in Mercurial 0.9.2. -b'revlogv1', -# Introduced in Mercurial 0.9.2. -b'store', -} - - -def blocksourcerequirements(repo): -"""Obtain requirements that will prevent an upgrade from occurring. - -An upgrade cannot be performed if the source repository contains a -requirements in the returned set. -""" -return { -# The upgrade code does not yet support these experimental features. -# This is an artificial limitation. -requirements.TREEMANIFEST_REQUIREMENT, -# This was a precursor to generaldelta and was never enabled by default. -# It should (hopefully) not exist in the wild. -b'parentdelta', -# Upgrade should operate on the actual store, not the shared link. -requirements.SHARED_REQUIREMENT, -} - - -def supportremovedrequirements(repo): -"""Obtain requirements that can be removed during an upgrade. - -If an upgrade were to create a repository that dropped a requirement, -the dropped requirement must appear in the returned set for the upgrade -to be allowed. -""" -supported = { -requirements.SPARSEREVLOG_REQUIREMENT, -requirements.SIDEDATA_REQUIREMENT, -requirements.COPIESSDC_REQUIREMENT, -requirements.NODEMAP_REQUIREMENT, -} -for name in compression.compengines: -engine = compression.compengines[name] -if engine.available() and engine.revlogheader(): -supported.add(b'exp-compression-%s' % name) -if engine.name() == b'zstd': -supported.add(b'revlog-compression-zstd') -return supported - - -def supporteddestrequirements(repo): -"""Obtain requirements that upgrade supports in the destination. - -If the result of the upgrade would create requirements not in this set, -the upgrade is disallowed. - -Extensions should monkeypatch this to add their custom requirements. -""" -supported = { -b'dotencode', -b'fncache', -b'generaldelta', -b'revlogv1', -b'store', -requirements.SPARSEREVLOG_REQUIREMENT, -requirements.SIDEDATA_REQUIREMENT, -requirements.COPIESSDC_REQUIREMENT, -requirements.NODEMAP_REQUIREMENT, -requirements.SHARESAFE_REQUIREMENT, -} -for
D9477: upgrade: split definition and management of the actions from the main code
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is a second step to clarify and clean up this code. The code responsible for definition which action exist, are possible and their compatibility if moved into a sub module. This clarify the main code and prepare further cleanup. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9477 AFFECTED FILES hgext/largefiles/overrides.py hgext/lfs/wrapper.py mercurial/upgrade.py mercurial/upgrade_utils/actions.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade_utils/actions.py copy from mercurial/upgrade.py copy to mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade_utils/actions.py @@ -7,21 +7,14 @@ from __future__ import absolute_import -from .i18n import _ -from . import ( -error, -hg, +from ..i18n import _ +from .. import ( localrepo, -pycompat, requirements, util, ) -from .upgrade_utils import ( -engine as upgrade_engine, -) - -from .utils import compression +from ..utils import compression # list of requirements that request a clone of all revlog if added/removed RECLONES_REQUIREMENTS = { @@ -522,19 +515,6 @@ return deficiencies -# search without '-' to support older form on newer client. -# -# We don't enforce backward compatibility for debug command so this -# might eventually be dropped. However, having to use two different -# forms in script when comparing result is anoying enough to add -# backward compatibility for a while. -legacy_opts_map = { -b'redeltaparent': b're-delta-parent', -b'redeltamultibase': b're-delta-multibase', -b'redeltaall': b're-delta-all', -b'redeltafulladd': b're-delta-fulladd', -} - ALL_OPTIMISATIONS = [] @@ -662,311 +642,3 @@ # e.g. adding generaldelta could schedule parent redeltas. return newactions - - -def upgraderepo( -ui, -repo, -run=False, -optimize=None, -backup=True, -manifest=None, -changelog=None, -filelogs=None, -): -"""Upgrade a repository in place.""" -if optimize is None: -optimize = [] -optimize = {legacy_opts_map.get(o, o) for o in optimize} -repo = repo.unfiltered() - -revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) -specentries = ( -(upgrade_engine.UPGRADE_CHANGELOG, changelog), -(upgrade_engine.UPGRADE_MANIFEST, manifest), -(upgrade_engine.UPGRADE_FILELOGS, filelogs), -) -specified = [(y, x) for (y, x) in specentries if x is not None] -if specified: -# we have some limitation on revlogs to be recloned -if any(x for y, x in specified): -revlogs = set() -for upgrade, enabled in specified: -if enabled: -revlogs.add(upgrade) -else: -# none are enabled -for upgrade, __ in specified: -revlogs.discard(upgrade) - -# Ensure the repository can be upgraded. -missingreqs = requiredsourcerequirements(repo) - repo.requirements -if missingreqs: -raise error.Abort( -_(b'cannot upgrade repository; requirement missing: %s') -% _(b', ').join(sorted(missingreqs)) -) - -blockedreqs = blocksourcerequirements(repo) & repo.requirements -if blockedreqs: -raise error.Abort( -_( -b'cannot upgrade repository; unsupported source ' -b'requirement: %s' -) -% _(b', ').join(sorted(blockedreqs)) -) - -# FUTURE there is potentially a need to control the wanted requirements via -# command arguments or via an extension hook point. -newreqs = localrepo.newreporequirements( -repo.ui, localrepo.defaultcreateopts(repo.ui) -) -newreqs.update(preservedrequirements(repo)) - -noremovereqs = ( -repo.requirements - newreqs - supportremovedrequirements(repo) -) -if noremovereqs: -raise error.Abort( -_( -b'cannot upgrade repository; requirement would be ' -b'removed: %s' -) -% _(b', ').join(sorted(noremovereqs)) -) - -noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo) -if noaddreqs: -raise error.Abort( -_( -b'cannot upgrade repository; do not support adding ' -b'requirement: %s' -) -% _(b', ').join(sorted(noaddreqs)) -) - -unsupportedreqs = newreqs - supporteddestrequirements(repo) -if unsupportedreqs: -raise error.Abort( -_( -b'cannot upgrade repository; do not support ' -b'destination requirement: %s' -) -% _(b', ').join(sorted(unsupportedreqs)) -) - -# Find and validat
[Bug 6447] New: Mercurial needs to export it's call options when doing a shell bang
https://bz.mercurial-scm.org/show_bug.cgi?id=6447 Bug ID: 6447 Summary: Mercurial needs to export it's call options when doing a shell bang Product: Mercurial Version: default branch Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: c.ozan...@gmail.com CC: mercurial-devel@mercurial-scm.org Python Version: --- When running an application / shell script from an hg shell bang the following shell variables are exported and available: HG - the path to hg HG_ARGS - the name of the alias that performed the shell bang If I create a shell script that calls hg, there is no current method of passing the calling options. For example: I create the following script: #! /usr/bin/env bash hg log -T $1 exit $? I then add the following alias to my ~/.hgrc file named slog in ~/bin/: [alias] slog= ! ~/bin/slog now if I type the following: hg slog status I get the logs using the status template However, if I type the following: hg --color off --hidden slog status I get logging with color set to default (not the option) and it does not show hidden changesets. It would be nice if mercurial where to also export its call options for scripts / applications to use. Possibly a comma separated list as HG_FULLARGS. For example: hg --color off --hidden slog status would make available the following additional exported content: HG_FULLARGS=-"-color,off,--hidden" this could then be parsed by a shell script and used when calling hg. -- 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
[Bug 6448] New: hg-evolve sometimes shows status changes even when the -q / --quiet option is set
https://bz.mercurial-scm.org/show_bug.cgi?id=6448 Bug ID: 6448 Summary: hg-evolve sometimes shows status changes even when the -q / --quiet option is set Product: Mercurial Version: default branch Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: evolution Assignee: bugzi...@mercurial-scm.org Reporter: c.ozan...@gmail.com CC: mercurial-devel@mercurial-scm.org, pierre-yves.da...@ens-lyon.org Python Version: --- -- 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
D9478: rhg: add a test for --rev with a hex changeset ID
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY And fix error message formatting REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9478 AFFECTED FILES rust/rhg/src/commands/cat.rs rust/rhg/src/commands/files.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -116,6 +116,26 @@ $ rhg cat -r 1 copy_of_original original content +Specifying revisions by changeset ID + $ hg log + changeset: 1:41263439dc17 + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: add copy of original + + changeset: 0:1c9e69808da7 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: add original + + $ rhg files -r 41263439dc17 + abort: invalid revision identifier 41263439dc17 + [255] + $ rhg cat -r 41263439dc17 original + abort: invalid revision identifier 41263439dc17 + [255] + Requirements $ rhg debugrequirements dotencode diff --git a/rust/rhg/src/commands/files.rs b/rust/rhg/src/commands/files.rs --- a/rust/rhg/src/commands/files.rs +++ b/rust/rhg/src/commands/files.rs @@ -85,7 +85,7 @@ ListRevTrackedFilesErrorKind::InvalidRevision => { CommandErrorKind::Abort(Some( utf8_to_local(&format!( -"abort: invalid revision identifier{}\n", +"abort: invalid revision identifier {}\n", rev )) .into(), diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs --- a/rust/rhg/src/commands/cat.rs +++ b/rust/rhg/src/commands/cat.rs @@ -70,7 +70,7 @@ )), CatRevErrorKind::InvalidRevision => CommandErrorKind::Abort(Some( utf8_to_local(&format!( -"abort: invalid revision identifier{}\n", +"abort: invalid revision identifier {}\n", rev )) .into(), To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9479: rhg: allow specifying a changeset ID prefix
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9479 AFFECTED FILES rust/hg-core/src/revlog/revlog.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -130,11 +130,10 @@ summary: add original $ rhg files -r 41263439dc17 - abort: invalid revision identifier 41263439dc17 - [255] + copy_of_original + original $ rhg cat -r 41263439dc17 original - abort: invalid revision identifier 41263439dc17 - [255] + original content Requirements $ rhg debugrequirements diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs --- a/rust/hg-core/src/revlog/revlog.rs +++ b/rust/hg-core/src/revlog/revlog.rs @@ -96,7 +96,7 @@ for rev in (0..self.len() as Revision).rev() { let index_entry = self.index.get_entry(rev).ok_or(RevlogError::Corrupted)?; -if node == index_entry.hash() { +if index_entry.hash().starts_with(node) { return Ok(rev); } } To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9480: node: import symbols explicitly
joerg.sonnenberger created this revision. Herald added a reviewer: durin42. Herald added a reviewer: durin42. Herald added a reviewer: martinvonz. Herald added a reviewer: martinvonz. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY There is no point in lazy importing mercurial.node, it is used all over the place anyway. So consistently import the used symbols directly. Fix one file using symbols indirectly via mercurial.revlog. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9480 AFFECTED FILES contrib/dumprevlog contrib/undumprevlog hgext/absorb.py hgext/convert/git.py hgext/convert/hg.py hgext/fastannotate/context.py hgext/fastannotate/formatter.py hgext/git/dirstate.py hgext/git/gitlog.py hgext/git/index.py hgext/gpg.py hgext/histedit.py hgext/infinitepush/bundleparts.py hgext/infinitepush/store.py hgext/journal.py hgext/largefiles/lfcommands.py hgext/largefiles/lfutil.py hgext/lfs/__init__.py hgext/lfs/blobstore.py hgext/narrow/narrowcommands.py hgext/patchbomb.py hgext/rebase.py hgext/releasenotes.py hgext/remotefilelog/__init__.py hgext/remotefilelog/basepack.py hgext/remotefilelog/debugcommands.py hgext/remotefilelog/fileserverclient.py hgext/remotefilelog/shallowutil.py hgext/transplant.py hgext/uncommit.py mercurial/bundle2.py mercurial/bundlerepo.py mercurial/chgserver.py mercurial/copies.py mercurial/dagop.py mercurial/hg.py mercurial/keepalive.py mercurial/metadata.py mercurial/obsolete.py mercurial/obsutil.py mercurial/revlogutils/nodemap.py mercurial/revset.py mercurial/revsetlang.py mercurial/rewriteutil.py mercurial/shelve.py mercurial/simplemerge.py mercurial/sslutil.py mercurial/store.py mercurial/strip.py mercurial/subrepo.py mercurial/tagmerge.py mercurial/templatefilters.py mercurial/util.py tests/drawdag.py tests/test-parseindex2.py tests/test-revlog-raw.py tests/test-rust-ancestor.py tests/testlib/ext-sidedata.py CHANGE DETAILS diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py --- a/tests/testlib/ext-sidedata.py +++ b/tests/testlib/ext-sidedata.py @@ -10,9 +10,12 @@ import hashlib import struct +from mercurial.node import ( +nullid, +nullrev, +) from mercurial import ( extensions, -node, requirements, revlog, upgrade, @@ -40,7 +43,7 @@ text = orig(self, nodeorrev, *args, **kwargs) if getattr(self, 'sidedatanocheck', False): return text -if nodeorrev != node.nullrev and nodeorrev != node.nullid: +if nodeorrev != nullrev and nodeorrev != nullid: sd = self.sidedata(nodeorrev) if len(text) != struct.unpack('>I', sd[sidedata.SD_TEST1])[0]: raise RuntimeError('text size mismatch') diff --git a/tests/test-rust-ancestor.py b/tests/test-rust-ancestor.py --- a/tests/test-rust-ancestor.py +++ b/tests/test-rust-ancestor.py @@ -2,10 +2,8 @@ import sys import unittest -from mercurial import ( -error, -node, -) +from mercurial.node import wdirrev +from mercurial import error from mercurial.testing import revlog as revlogtesting @@ -150,7 +148,7 @@ # WdirUnsupported directly idx = self.parseindex() with self.assertRaises(error.WdirUnsupported): -list(AncestorsIterator(idx, [node.wdirrev], -1, False)) +list(AncestorsIterator(idx, [wdirrev], -1, False)) def testheadrevs(self): idx = self.parseindex() diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py --- a/tests/test-revlog-raw.py +++ b/tests/test-revlog-raw.py @@ -6,9 +6,9 @@ import hashlib import sys +from mercurial.node import nullid from mercurial import ( encoding, -node, revlog, transaction, vfs, @@ -93,7 +93,7 @@ """ nextrev = len(rlog) p1 = rlog.node(nextrev - 1) -p2 = node.nullid +p2 = nullid if isext: flags = revlog.REVIDX_EXTSTORED else: @@ -127,7 +127,7 @@ class dummychangegroup(object): @staticmethod def deltachunk(pnode): -pnode = pnode or node.nullid +pnode = pnode or nullid parentrev = rlog.rev(pnode) r = parentrev + 1 if r >= len(rlog): @@ -142,7 +142,7 @@ return { b'node': rlog.node(r), b'p1': pnode, -b'p2': node.nullid, +b'p2': nullid, b'cs': rlog.node(rlog.linkrev(r)), b'flags': rlog.flags(r), b'deltabase': rlog.node(deltaparent), @@ -181,7 +181,7 @@ dlog = newrevlog(destname, recreate=True) for r in rlog: p1 = rlog.node(r - 1) -p2 = node.nullid +p2 = nullid if r == 0 or (rlog.flags(r) & revlog.REVIDX_EXTSTORED): text = rlog.rawdata(r) cachede
D9481: relnotes: document better memory use for unbundle
joerg.sonnenberger created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9481 AFFECTED FILES relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -17,10 +17,12 @@ can be e.g. `rebase`. As part of this effort, the default format from `hg rebase` was reorganized a bit. - * `hg strip`, from the strip extension, is now a core command, `hg debugstrip`. The extension remains for compatibility. + * The memory footprint per changeset during pull/unbundle + operations has been further reduced. + == New Experimental Features == To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13476 has failed for branch/default | 98be0c3b
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 98be0c3b ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/98be0c3b28e71e87e6b70389a38c183ecdbee287 ) Commit Message: rhg: check that .hg/requires is ASCII Differen... Commit Author: Simon Sapin Pipeline #13476 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13476 ) triggered by Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal ) had 13 failed builds. Job #125786 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125786/raw ) Stage: test Name: rust-cargo-test-py3-dirstate-tree Job #125784 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125784/raw ) Stage: test Name: rust-cargo-test-py2 Job #125782 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125782/raw ) Stage: test Name: checks-py2 Job #125792 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125792/raw ) Stage: test Name: test-py3-rust Job #125793 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125793/raw ) Stage: test Name: test-py3-rust-dirstate-tree Job #125785 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125785/raw ) Stage: test Name: rust-cargo-test-py3 Job #125790 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125790/raw ) Stage: test Name: test-py3-pure Job #125789 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125789/raw ) Stage: test Name: test-py2-pure Job #125787 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125787/raw ) Stage: test Name: test-py2 Job #125783 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125783/raw ) Stage: test Name: checks-py3 Job #125794 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125794/raw ) Stage: test Name: test-py2-chg Job #125788 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125788/raw ) Stage: test Name: test-py3 Job #125791 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125791/raw ) Stage: test Name: test-py2-rust -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13402 has failed for branch/default | e9540c4a
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: e9540c4a ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/e9540c4adca0da9c4c49c7d49b9715fdcd29504c ) Commit Message: pyoxidizer: make sure defaultrc directory exist... Commit Author: Augie Fackler Pipeline #13402 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13402 ) triggered by Pulkit Goyal ( https://foss.heptapod.net/pulkit.goyal ) had 1 failed build. Job #125175 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125175/raw ) Stage: test Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13497 has failed for branch/default | 66a22c92
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 66a22c92 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/66a22c92706a5c14c36ee8129b6a34675d0c7afc ) Commit Message: formating: upgrade to black 20.8b1 This requir... Commit Author: durin42 ( https://foss.heptapod.net/durin42 ) Pipeline #13497 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13497 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 13 failed builds. Job #125888 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125888/raw ) Stage: test Name: checks-py3 Job #125893 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125893/raw ) Stage: test Name: test-py3 Job #125898 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125898/raw ) Stage: test Name: test-py3-rust-dirstate-tree Job #125895 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125895/raw ) Stage: test Name: test-py3-pure Job #125897 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125897/raw ) Stage: test Name: test-py3-rust Job #125890 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125890/raw ) Stage: test Name: rust-cargo-test-py3 Job #125887 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125887/raw ) Stage: test Name: checks-py2 Job #125894 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125894/raw ) Stage: test Name: test-py2-pure Job #125889 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125889/raw ) Stage: test Name: rust-cargo-test-py2 Job #125892 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125892/raw ) Stage: test Name: test-py2 Job #125896 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125896/raw ) Stage: test Name: test-py2-rust Job #125891 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125891/raw ) Stage: test Name: rust-cargo-test-py3-dirstate-tree Job #125899 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/125899/raw ) Stage: test Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13521 has failed for branch/default | 2b32876d
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 2b32876d ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/2b32876d7f1f8e85ed34e59b4ec887b243525339 ) Commit Message: copies: introduce the hg-cpython wrapper for `c... Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute ) Pipeline #13521 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13521 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 13 failed builds. Job #126115 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126115/raw ) Stage: test Name: test-py3-rust-dirstate-tree Job #126116 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126116/raw ) Stage: test Name: test-py2-chg Job #126114 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126114/raw ) Stage: test Name: test-py3-rust Job #126113 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126113/raw ) Stage: test Name: test-py2-rust Job #126112 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126112/raw ) Stage: test Name: test-py3-pure Job #126111 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126111/raw ) Stage: test Name: test-py2-pure Job #126110 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126110/raw ) Stage: test Name: test-py3 Job #126109 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126109/raw ) Stage: test Name: test-py2 Job #126108 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126108/raw ) Stage: test Name: rust-cargo-test-py3-dirstate-tree Job #126107 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126107/raw ) Stage: test Name: rust-cargo-test-py3 Job #126106 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126106/raw ) Stage: test Name: rust-cargo-test-py2 Job #126105 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126105/raw ) Stage: test Name: checks-py3 Job #126104 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126104/raw ) Stage: test Name: checks-py2 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13529 has failed for branch/default | 036e6f57
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 036e6f57 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/036e6f579e8e4137dbb2158647faf34540a24088 ) Commit Message: run-tests: use a context manager when looking f... Commit Author: Matt Harbison Pipeline #13529 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13529 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 13 failed builds. Job #126177 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126177/raw ) Stage: test Name: test-py3-rust Job #126179 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126179/raw ) Stage: test Name: test-py2-chg Job #126172 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126172/raw ) Stage: test Name: test-py2 Job #126169 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126169/raw ) Stage: test Name: rust-cargo-test-py2 Job #126178 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126178/raw ) Stage: test Name: test-py3-rust-dirstate-tree Job #126176 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126176/raw ) Stage: test Name: test-py2-rust Job #126174 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126174/raw ) Stage: test Name: test-py2-pure Job #126173 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126173/raw ) Stage: test Name: test-py3 Job #126167 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126167/raw ) Stage: test Name: checks-py2 Job #126175 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126175/raw ) Stage: test Name: test-py3-pure Job #126171 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126171/raw ) Stage: test Name: rust-cargo-test-py3-dirstate-tree Job #126170 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126170/raw ) Stage: test Name: rust-cargo-test-py3 Job #126168 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126168/raw ) Stage: test Name: checks-py3 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13589 has failed for branch/default | 528cd9fc
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 528cd9fc ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/528cd9fcd9b783465d6481afd24cabab07aea527 ) Commit Message: heptapod-ci: add a explicite "test" phases We ... Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute ) Pipeline #13589 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13589 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126397 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126397/raw ) Stage: tests Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13564 has failed for branch/default | 036e6f57
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 036e6f57 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/036e6f579e8e4137dbb2158647faf34540a24088 ) Commit Message: run-tests: use a context manager when looking f... Commit Author: Matt Harbison Pipeline #13564 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13564 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 13 failed builds. Job #126296 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126296/raw ) Stage: test Name: test-py2-rust Job #126288 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126288/raw ) Stage: test Name: checks-py3 Job #126294 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126294/raw ) Stage: test Name: test-py2-pure Job #126295 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126295/raw ) Stage: test Name: test-py3-pure Job #126298 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126298/raw ) Stage: test Name: test-py3-rust-dirstate-tree Job #126291 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126291/raw ) Stage: test Name: rust-cargo-test-py3-dirstate-tree Job #126299 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126299/raw ) Stage: test Name: test-py2-chg Job #126287 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126287/raw ) Stage: test Name: checks-py2 Job #126293 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126293/raw ) Stage: test Name: test-py3 Job #126290 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126290/raw ) Stage: test Name: rust-cargo-test-py3 Job #126297 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126297/raw ) Stage: test Name: test-py3-rust Job #126292 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126292/raw ) Stage: test Name: test-py2 Job #126289 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126289/raw ) Stage: test Name: rust-cargo-test-py2 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13604 has failed for branch/default | dfd1acfd
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: dfd1acfd ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/dfd1acfdead85f2542b072d6d95119d5b4e9de14 ) Commit Message: bisect: add `-G` to an `hg log` command in a te... Commit Author: Simon Sapin Pipeline #13604 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13604 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126461 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126461/raw ) Stage: tests Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13638 has failed for branch/default | dfd1acfd
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: dfd1acfd ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/dfd1acfdead85f2542b072d6d95119d5b4e9de14 ) Commit Message: bisect: add `-G` to an `hg log` command in a te... Commit Author: Simon Sapin Pipeline #13638 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13638 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 2 failed builds. Job #126645 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126645/raw ) Stage: tests Name: test-py2 Job #126652 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126652/raw ) Stage: tests Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13639 has failed for branch/stable | 4aa25f8a
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/stable ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/stable ) Commit: 4aa25f8a ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/4aa25f8a5485856c2d911ef7f2efb2dd62297211 ) Commit Message: chg: reset errno prior to calling strtol() Oth... Commit Author: Yuya Nishihara ( https://foss.heptapod.net/yuja ) Pipeline #13639 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13639 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126665 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126665/raw ) Stage: test Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13639 has failed for branch/stable | 4aa25f8a
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/stable ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/stable ) Commit: 4aa25f8a ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/4aa25f8a5485856c2d911ef7f2efb2dd62297211 ) Commit Message: chg: reset errno prior to calling strtol() Oth... Commit Author: Yuya Nishihara ( https://foss.heptapod.net/yuja ) Pipeline #13639 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13639 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126665 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126665/raw ) Stage: test Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13686 has failed for branch/default | c02d5fa4
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: c02d5fa4 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/c02d5fa4adc07441844cb4b5e068872cce6f1ee5 ) Commit Message: rust-format: pin the formatted to a specific ni... Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute ) Pipeline #13686 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13686 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126940 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126940/raw ) Stage: tests Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13688 has failed for topic/default/simple-upgrade | dde5cb5f
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: topic/default/simple-upgrade ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/topic/default/simple-upgrade ) Commit: dde5cb5f ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/dde5cb5f4cb36808e4b7152d9112a9866aa59fe9 ) Commit Message: upgrade: move optimisation to something more de... Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute ) Pipeline #13688 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13688 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #126968 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/126968/raw ) Stage: tests Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9482: upgrade: move requirements checking in a dedicated function
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is a simple an isolated check that can go next to the associated code. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9482 AFFECTED FILES mercurial/upgrade.py mercurial/upgrade_utils/actions.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -9,6 +9,7 @@ from ..i18n import _ from .. import ( +error, localrepo, requirements, util, @@ -642,3 +643,21 @@ # e.g. adding generaldelta could schedule parent redeltas. return newactions + + +def check_source_requirements(repo): +"""Ensure that no existing requirements prevent the repository upgrade""" + +required = requiredsourcerequirements(repo) +missingreqs = required - repo.requirements +if missingreqs: +msg = _(b'cannot upgrade repository; requirement missing: %s') +missingreqs = b', '.join(sorted(missingreqs)) +raise error.Abort(msg % missingreqs) + +blocking = blocksourcerequirements(repo) +blockingreqs = blocking & repo.requirements +if blockingreqs: +m = _(b'cannot upgrade repository; unsupported source requirement: %s') +blockingreqs = b', '.join(sorted(blockingreqs)) +raise error.Abort(m % blockingreqs) diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -72,26 +72,7 @@ revlogs.discard(upgrade) # Ensure the repository can be upgraded. -missingreqs = ( -upgrade_actions.requiredsourcerequirements(repo) - repo.requirements -) -if missingreqs: -raise error.Abort( -_(b'cannot upgrade repository; requirement missing: %s') -% _(b', ').join(sorted(missingreqs)) -) - -blockedreqs = ( -upgrade_actions.blocksourcerequirements(repo) & repo.requirements -) -if blockedreqs: -raise error.Abort( -_( -b'cannot upgrade repository; unsupported source ' -b'requirement: %s' -) -% _(b', ').join(sorted(blockedreqs)) -) +upgrade_actions.check_source_requirements(repo) # FUTURE there is potentially a need to control the wanted requirements via # command arguments or via an extension hook point. To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9483: upgrade: gather code about source checking together
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY They just moved in the same file, now they are grouped together and documented. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9483 AFFECTED FILES mercurial/upgrade_utils/actions.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -24,38 +24,6 @@ } -def requiredsourcerequirements(repo): -"""Obtain requirements required to be present to upgrade a repo. - -An upgrade will not be allowed if the repository doesn't have the -requirements returned by this function. -""" -return { -# Introduced in Mercurial 0.9.2. -b'revlogv1', -# Introduced in Mercurial 0.9.2. -b'store', -} - - -def blocksourcerequirements(repo): -"""Obtain requirements that will prevent an upgrade from occurring. - -An upgrade cannot be performed if the source repository contains a -requirements in the returned set. -""" -return { -# The upgrade code does not yet support these experimental features. -# This is an artificial limitation. -requirements.TREEMANIFEST_REQUIREMENT, -# This was a precursor to generaldelta and was never enabled by default. -# It should (hopefully) not exist in the wild. -b'parentdelta', -# Upgrade should operate on the actual store, not the shared link. -requirements.SHARED_REQUIREMENT, -} - - def supportremovedrequirements(repo): """Obtain requirements that can be removed during an upgrade. @@ -645,6 +613,41 @@ return newactions +### Code checking if a repository can got through the upgrade process at all. # + + +def requiredsourcerequirements(repo): +"""Obtain requirements required to be present to upgrade a repo. + +An upgrade will not be allowed if the repository doesn't have the +requirements returned by this function. +""" +return { +# Introduced in Mercurial 0.9.2. +b'revlogv1', +# Introduced in Mercurial 0.9.2. +b'store', +} + + +def blocksourcerequirements(repo): +"""Obtain requirements that will prevent an upgrade from occurring. + +An upgrade cannot be performed if the source repository contains a +requirements in the returned set. +""" +return { +# The upgrade code does not yet support these experimental features. +# This is an artificial limitation. +requirements.TREEMANIFEST_REQUIREMENT, +# This was a precursor to generaldelta and was never enabled by default. +# It should (hopefully) not exist in the wild. +b'parentdelta', +# Upgrade should operate on the actual store, not the shared link. +requirements.SHARED_REQUIREMENT, +} + + def check_source_requirements(repo): """Ensure that no existing requirements prevent the repository upgrade""" To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9484: upgrade: drop an outdated comment
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We can control the added/removed requirement through config for multiple years. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9484 AFFECTED FILES mercurial/upgrade.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -74,8 +74,6 @@ # Ensure the repository can be upgraded. upgrade_actions.check_source_requirements(repo) -# FUTURE there is potentially a need to control the wanted requirements via -# command arguments or via an extension hook point. newreqs = localrepo.newreporequirements( repo.ui, localrepo.defaultcreateopts(repo.ui) ) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9485: upgrade: extract the checking of target requirements change
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This logic is fairly independant, lets move it out of the main function. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9485 AFFECTED FILES mercurial/upgrade.py mercurial/upgrade_utils/actions.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -664,3 +664,34 @@ m = _(b'cannot upgrade repository; unsupported source requirement: %s') blockingreqs = b', '.join(sorted(blockingreqs)) raise error.Abort(m % blockingreqs) + + +### Verify the validity of the planned requirement changes + + +def check_requirements_changes(repo, new_reqs): +old_reqs = repo.requirements + +support_removal = supportremovedrequirements(repo) +no_remove_reqs = old_reqs - new_reqs - support_removal +if no_remove_reqs: +msg = _(b'cannot upgrade repository; requirement would be removed: %s') +no_remove_reqs = b', '.join(sorted(no_remove_reqs)) +raise error.Abort(msg % no_remove_reqs) + +support_addition = allowednewrequirements(repo) +no_add_reqs = new_reqs - old_reqs - support_addition +if no_add_reqs: +m = _(b'cannot upgrade repository; do not support adding requirement: ') +no_add_reqs = b', '.join(sorted(no_add_reqs)) +raise error.Abort(m + no_add_reqs) + +supported = supporteddestrequirements(repo) +unsupported_reqs = new_reqs - supported +if unsupported_reqs: +msg = _( +b'cannot upgrade repository; do not support destination ' +b'requirement: %s' +) +unsupported_reqs = b', '.join(sorted(unsupported_reqs)) +raise error.Abort(msg % unsupported_reqs) diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -74,48 +74,11 @@ # Ensure the repository can be upgraded. upgrade_actions.check_source_requirements(repo) -newreqs = localrepo.newreporequirements( -repo.ui, localrepo.defaultcreateopts(repo.ui) -) +default_options = localrepo.defaultcreateopts(repo.ui) +newreqs = localrepo.newreporequirements(repo.ui, default_options) newreqs.update(upgrade_actions.preservedrequirements(repo)) -noremovereqs = ( -repo.requirements -- newreqs -- upgrade_actions.supportremovedrequirements(repo) -) -if noremovereqs: -raise error.Abort( -_( -b'cannot upgrade repository; requirement would be ' -b'removed: %s' -) -% _(b', ').join(sorted(noremovereqs)) -) - -noaddreqs = ( -newreqs -- repo.requirements -- upgrade_actions.allowednewrequirements(repo) -) -if noaddreqs: -raise error.Abort( -_( -b'cannot upgrade repository; do not support adding ' -b'requirement: %s' -) -% _(b', ').join(sorted(noaddreqs)) -) - -unsupportedreqs = newreqs - upgrade_actions.supporteddestrequirements(repo) -if unsupportedreqs: -raise error.Abort( -_( -b'cannot upgrade repository; do not support ' -b'destination requirement: %s' -) -% _(b', ').join(sorted(unsupportedreqs)) -) +upgrade_actions.check_requirements_changes(repo, newreqs) # Find and validate all improvements that can be made. alloptimizations = upgrade_actions.findoptimizations(repo) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9486: upgrade: gather code about requirement checking together
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY They just moved in the same file, now they are grouped together and documented. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9486 AFFECTED FILES mercurial/upgrade_utils/actions.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -24,85 +24,6 @@ } -def supportremovedrequirements(repo): -"""Obtain requirements that can be removed during an upgrade. - -If an upgrade were to create a repository that dropped a requirement, -the dropped requirement must appear in the returned set for the upgrade -to be allowed. -""" -supported = { -requirements.SPARSEREVLOG_REQUIREMENT, -requirements.SIDEDATA_REQUIREMENT, -requirements.COPIESSDC_REQUIREMENT, -requirements.NODEMAP_REQUIREMENT, -} -for name in compression.compengines: -engine = compression.compengines[name] -if engine.available() and engine.revlogheader(): -supported.add(b'exp-compression-%s' % name) -if engine.name() == b'zstd': -supported.add(b'revlog-compression-zstd') -return supported - - -def supporteddestrequirements(repo): -"""Obtain requirements that upgrade supports in the destination. - -If the result of the upgrade would create requirements not in this set, -the upgrade is disallowed. - -Extensions should monkeypatch this to add their custom requirements. -""" -supported = { -b'dotencode', -b'fncache', -b'generaldelta', -b'revlogv1', -b'store', -requirements.SPARSEREVLOG_REQUIREMENT, -requirements.SIDEDATA_REQUIREMENT, -requirements.COPIESSDC_REQUIREMENT, -requirements.NODEMAP_REQUIREMENT, -requirements.SHARESAFE_REQUIREMENT, -} -for name in compression.compengines: -engine = compression.compengines[name] -if engine.available() and engine.revlogheader(): -supported.add(b'exp-compression-%s' % name) -if engine.name() == b'zstd': -supported.add(b'revlog-compression-zstd') -return supported - - -def allowednewrequirements(repo): -"""Obtain requirements that can be added to a repository during upgrade. - -This is used to disallow proposed requirements from being added when -they weren't present before. - -We use a list of allowed requirement additions instead of a list of known -bad additions because the whitelist approach is safer and will prevent -future, unknown requirements from accidentally being added. -""" -supported = { -b'dotencode', -b'fncache', -b'generaldelta', -requirements.SPARSEREVLOG_REQUIREMENT, -requirements.SIDEDATA_REQUIREMENT, -requirements.COPIESSDC_REQUIREMENT, -requirements.NODEMAP_REQUIREMENT, -} -for name in compression.compengines: -engine = compression.compengines[name] -if engine.available() and engine.revlogheader(): -supported.add(b'exp-compression-%s' % name) -if engine.name() == b'zstd': -supported.add(b'revlog-compression-zstd') -return supported - - def preservedrequirements(repo): return set() @@ -669,6 +590,85 @@ ### Verify the validity of the planned requirement changes +def supportremovedrequirements(repo): +"""Obtain requirements that can be removed during an upgrade. + +If an upgrade were to create a repository that dropped a requirement, +the dropped requirement must appear in the returned set for the upgrade +to be allowed. +""" +supported = { +requirements.SPARSEREVLOG_REQUIREMENT, +requirements.SIDEDATA_REQUIREMENT, +requirements.COPIESSDC_REQUIREMENT, +requirements.NODEMAP_REQUIREMENT, +} +for name in compression.compengines: +engine = compression.compengines[name] +if engine.available() and engine.revlogheader(): +supported.add(b'exp-compression-%s' % name) +if engine.name() == b'zstd': +supported.add(b'revlog-compression-zstd') +return supported + + +def supporteddestrequirements(repo): +"""Obtain requirements that upgrade supports in the destination. + +If the result of the upgrade would create requirements not in this set, +the upgrade is disallowed. + +Extensions should monkeypatch this to add their custom requirements. +""" +supported = { +b'dotencode', +b'fncache', +b'generaldelta', +b'revlogv1', +b'store', +requirements.SPARSEREVLOG_REQUIREMENT, +requirements.SIDEDATA_REQUIREMENT, +requir
D9487: upgrade: start moving the "to be happening" data in a dedicated object
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The upgrade code has a lot of logic to determine which action needs to be performed depending of various element (sometimes depending from each other). It would be nice to have a consistent object representing this. That could be cleanly passed and avoid some logic duplication. So we create this object as a start. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9487 AFFECTED FILES mercurial/upgrade.py mercurial/upgrade_utils/actions.py mercurial/upgrade_utils/engine.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/engine.py b/mercurial/upgrade_utils/engine.py --- a/mercurial/upgrade_utils/engine.py +++ b/mercurial/upgrade_utils/engine.py @@ -383,9 +383,7 @@ """ -def upgrade( -ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS -): +def upgrade(ui, srcrepo, dstrepo, upgrade_op): """Do the low-level work of upgrading a repository. The upgrade is effectively performed as a copy between a source @@ -405,13 +403,13 @@ ) ) -if b're-delta-all' in actions: +if b're-delta-all' in upgrade_op.actions: deltareuse = revlog.revlog.DELTAREUSENEVER -elif b're-delta-parent' in actions: +elif b're-delta-parent' in upgrade_op.actions: deltareuse = revlog.revlog.DELTAREUSESAMEREVS -elif b're-delta-multibase' in actions: +elif b're-delta-multibase' in upgrade_op.actions: deltareuse = revlog.revlog.DELTAREUSESAMEREVS -elif b're-delta-fulladd' in actions: +elif b're-delta-fulladd' in upgrade_op.actions: deltareuse = revlog.revlog.DELTAREUSEFULLADD else: deltareuse = revlog.revlog.DELTAREUSEALWAYS @@ -423,14 +421,16 @@ dstrepo, tr, deltareuse, -b're-delta-multibase' in actions, -revlogs=revlogs, +b're-delta-multibase' in upgrade_op.actions, +revlogs=upgrade_op.revlogs_to_process, ) # Now copy other files in the store directory. # The sorted() makes execution deterministic. for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): -if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st): +if not _filterstorefile( +srcrepo, dstrepo, upgrade_op.requirements, p, kind, st +): continue srcrepo.ui.status(_(b'copying %s\n') % p) @@ -489,7 +489,7 @@ b'again\n' ) ) -scmutil.writereporequirements(srcrepo, requirements) +scmutil.writereporequirements(srcrepo, upgrade_op.requirements) # The lock file from the old store won't be removed because nothing has a # reference to its new location. So clean it up manually. Alternatively, we diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -534,6 +534,15 @@ return newactions +class UpgradeOperation(object): +"""represent the work to be done during an upgrade""" + +def __init__(self, requirements, actions, revlogs_to_process): +self.requirements = requirements +self.actions = actions +self.revlogs_to_process = revlogs_to_process + + ### Code checking if a repository can got through the upgrade process at all. # diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -176,6 +176,13 @@ ui.write((b' - %s\n' % r)) ui.write((b'\n')) +upgrade_op = upgrade_actions.UpgradeOperation( +newreqs, +[a.name for a in actions], +revlogs, +) +upgrade_op + if not run: fromconfig = [] onlydefault = [] @@ -249,8 +256,6 @@ printupgradeactions() print_affected_revlogs() -upgradeactions = [a.name for a in actions] - ui.status(_(b'beginning upgrade...\n')) with repo.wlock(), repo.lock(): ui.status(_(b'repository locked and read-only\n')) @@ -276,7 +281,7 @@ with dstrepo.wlock(), dstrepo.lock(): backuppath = upgrade_engine.upgrade( -ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs +ui, repo, dstrepo, upgrade_op ) if not (backup or backuppath is None): ui.status( To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9488: match: skip walking up the directory hierarchy if the number of pats are small
spectral created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Previously, we would receive a path like abc/def/ghi and "walk up" the directory hierarchy, checking abc/def, abc, and `b''` to see if they were in the set of prefixes that this matcher covered. We did this indiscriminately - we generated all of these paths even if the set of prefixes the matcher covered was completely empty, which is the case for a lot of repos at my company (the narrow matcher we use is usually non-recursive). This brings the time for a rebase in one of my repos from 12.20s to 10.87s. In this particular repo, this is entirely due to the `len(prefix_set) == 0` check, as I do not have any recursive patterns in the narrowspec. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9488 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -563,6 +563,36 @@ return b'' % s +def path_or_parents_in_set(path, prefix_set): +"""Returns True if `path` (or any parent of `path`) is in `prefix_set`.""" +l = len(prefix_set) +if l == 0: +return False +if path in prefix_set: +return True +# If there's more than 5 paths in prefix_set, it's *probably* quicker to +# "walk up" the directory hierarchy instead, with the assumption that most +# directory hierarchies are relatively shallow and hash lookup is cheap. +if l > 5: +return any( +parentdir in prefix_set for parentdir in pathutil.finddirs(path) +) + +# FIXME: Ideally we'd never get to this point if this is the case - we'd +# recognize ourselves as an 'always' matcher and skip this. +if b'' in prefix_set: +return True + +if pycompat.ispy3: +sl = ord(b'/') +else: +sl = '/' + +# We already checked that path isn't in prefix_set exactly, so +# `path[len(pf)] should never raise IndexError. +return any(path.startswith(pf) and path[len(pf)] == sl for pf in prefix_set) + + class patternmatcher(basematcher): r"""Matches a set of (kind, pat, source) against a 'root' directory. @@ -611,12 +641,8 @@ if self._prefix and dir in self._fileset: return b'all' return ( -dir in self._fileset -or dir in self._dirs -or any( -parentdir in self._fileset -for parentdir in pathutil.finddirs(dir) -) +dir in self._dirs +or path_or_parents_in_set(dir, self._fileset) ) def visitchildrenset(self, dir): @@ -698,12 +724,9 @@ if self._prefix and dir in self._roots: return b'all' return ( -dir in self._roots -or dir in self._dirs +dir in self._dirs or dir in self._parents -or any( -parentdir in self._roots for parentdir in pathutil.finddirs(dir) -) +or path_or_parents_in_set(dir, self._roots) ) @propertycache @@ -726,11 +749,8 @@ # visitdir, that's handled below. if ( b'' in self._roots -or dir in self._roots or dir in self._dirs -or any( -parentdir in self._roots for parentdir in pathutil.finddirs(dir) -) +or path_or_parents_in_set(dir, self._roots) ): return b'this' To: spectral, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9489: registrar: clarify the documentation about some byte strings being required
mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I *thought* these needed to be byte strings, but didn't remember and had to search out examples. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9489 AFFECTED FILES mercurial/registrar.py CHANGE DETAILS diff --git a/mercurial/registrar.py b/mercurial/registrar.py --- a/mercurial/registrar.py +++ b/mercurial/registrar.py @@ -37,7 +37,7 @@ keyword = registrar.keyword() -@keyword('bar') +@keyword(b'bar') def barfunc(*args, **kwargs): '''Explanation of bar keyword ''' @@ -249,7 +249,7 @@ revsetpredicate = registrar.revsetpredicate() -@revsetpredicate('mypredicate(arg1, arg2[, arg3])') +@revsetpredicate(b'mypredicate(arg1, arg2[, arg3])') def mypredicatefunc(repo, subset, x): '''Explanation of this revset predicate ''' @@ -299,7 +299,7 @@ filesetpredicate = registrar.filesetpredicate() -@filesetpredicate('mypredicate()') +@filesetpredicate(b'mypredicate()') def mypredicatefunc(mctx, x): '''Explanation of this fileset predicate ''' @@ -356,7 +356,7 @@ templatekeyword = registrar.templatekeyword() # new API (since Mercurial 4.6) -@templatekeyword('mykeyword', requires={'repo', 'ctx'}) +@templatekeyword(b'mykeyword', requires={b'repo', b'ctx'}) def mykeywordfunc(context, mapping): '''Explanation of this template keyword ''' @@ -388,7 +388,7 @@ templatefilter = registrar.templatefilter() -@templatefilter('myfilter', intype=bytes) +@templatefilter(b'myfilter', intype=bytes) def myfilterfunc(text): '''Explanation of this template filter ''' @@ -420,8 +420,8 @@ templatefunc = registrar.templatefunc() -@templatefunc('myfunc(arg1, arg2[, arg3])', argspec='arg1 arg2 arg3', - requires={'ctx'}) +@templatefunc(b'myfunc(arg1, arg2[, arg3])', argspec=b'arg1 arg2 arg3', + requires={b'ctx'}) def myfuncfunc(context, mapping, args): '''Explanation of this template function ''' @@ -460,7 +460,7 @@ internalmerge = registrar.internalmerge() -@internalmerge('mymerge', internalmerge.mergeonly, +@internalmerge(b'mymerge', internalmerge.mergeonly, onfailure=None, precheck=None, binary=False, symlink=False): def mymergefunc(repo, mynode, orig, fcd, fco, fca, To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel