[PATCH 1 of 2] share: move the implementation of 'unshare' to the 'hg' module
# HG changeset patch # User Matt Harbison# Date 1508291336 14400 # Tue Oct 17 21:48:56 2017 -0400 # Node ID a6b470f15cc5f902afd54f29b0e53e5c03f6eec6 # Parent 14c87708f4328fa46938be99d6deba678f3455aa share: move the implementation of 'unshare' to the 'hg' module This will be used to setup unsharing subrepos. Usually cmdutil is used for this purpose. But the implementation needs hg.copystore(), and the hg module already imports cmdutil. diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -114,28 +114,7 @@ if not repo.shared(): raise error.Abort(_("this is not a shared repo")) -destlock = lock = None -lock = repo.lock() -try: -# we use locks here because if we race with commit, we -# can end up with extra data in the cloned revlogs that's -# not pointed to by changesets, thus causing verify to -# fail - -destlock = hg.copystore(ui, repo, repo.path) - -sharefile = repo.vfs.join('sharedpath') -util.rename(sharefile, sharefile + '.old') - -repo.requirements.discard('shared') -repo.requirements.discard('relshared') -repo._writerequirements() -finally: -destlock and destlock.release() -lock and lock.release() - -# update store, spath, svfs and sjoin of repo -repo.unfiltered().__init__(repo.baseui, repo.root) +hg.unshare(ui, repo) # Wrap clone command to pass auto share options. def clone(orig, ui, source, *args, **opts): diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -257,6 +257,35 @@ _postshareupdate(r, update, checkout=checkout) return r +def unshare(ui, repo): +"""convert a shared repository to a normal one + +Copy the store data to the repo and remove the sharedpath data. +""" + +destlock = lock = None +lock = repo.lock() +try: +# we use locks here because if we race with commit, we +# can end up with extra data in the cloned revlogs that's +# not pointed to by changesets, thus causing verify to +# fail + +destlock = copystore(ui, repo, repo.path) + +sharefile = repo.vfs.join('sharedpath') +util.rename(sharefile, sharefile + '.old') + +repo.requirements.discard('shared') +repo.requirements.discard('relshared') +repo._writerequirements() +finally: +destlock and destlock.release() +lock and lock.release() + +# update store, spath, svfs and sjoin of repo +repo.unfiltered().__init__(repo.baseui, repo.root) + def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): """Called after a new shared repo is created. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] subrepo: implement 'unshare' for Mercurial subrepos
# HG changeset patch # User Matt Harbison# Date 1508295333 14400 # Tue Oct 17 22:55:33 2017 -0400 # Node ID 609c60c0b706f9b6402d275a57b8255b142e8ba7 # Parent a6b470f15cc5f902afd54f29b0e53e5c03f6eec6 subrepo: implement 'unshare' for Mercurial subrepos I think there's a slight hole here in that a subrepo could be shared, removed from .hgsub, and then it's not part of context.substate (so not iterated over). But the push command has the same hole IIRC, and I think removing a subrepo is an edge case. The import hack is a copy/paste of subrepo.subrepo(). diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -286,6 +286,13 @@ # update store, spath, svfs and sjoin of repo repo.unfiltered().__init__(repo.baseui, repo.root) +# TODO: figure out how to access subrepos that exist, but were previously +# removed from .hgsub +c = repo['.'] +subs = c.substate +for s in sorted(subs): +c.sub(s).unshare() + def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): """Called after a new shared repo is created. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -621,6 +621,11 @@ def shortid(self, revid): return revid +def unshare(self): +''' +convert this repository from shared to normal storage. +''' + def verify(self): '''verify the integrity of the repository. Return 0 on success or warning, 1 on any error. @@ -1083,6 +1088,24 @@ def shortid(self, revid): return revid[:12] +@annotatesubrepoerror +def unshare(self): +# subrepo inherently violates our import layering rules +# because it wants to make repo objects from deep inside the stack +# so we manually delay the circular imports to not break +# scripts that don't use our demand-loading +global hg +from . import hg as h +hg = h + +# Nothing prevents a user from sharing in a repo, and then making that a +# subrepo. Alternately, the previous unshare attempt may have failed +# part way through. So recurse whether or not this layer is shared. +if self._repo.shared(): +self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath) + +hg.unshare(self.ui, self._repo) + def verify(self): try: rev = self._state[1] diff --git a/tests/test-archive.t b/tests/test-archive.t --- a/tests/test-archive.t +++ b/tests/test-archive.t @@ -51,6 +51,24 @@ $ hg -R clone1 update -C tip cloning subrepo subrepo from $TESTTMP/test/subrepo 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ find share2 | egrep 'sharedpath|00.+\.i' | sort + share2/.hg/sharedpath + share2/subrepo/.hg/sharedpath + $ hg -R share2 unshare + unsharing subrepo 'subrepo' + $ find share2 | egrep 'sharedpath|00.+\.i' | sort + share2/.hg/00changelog.i + share2/.hg/sharedpath.old + share2/.hg/store/00changelog.i + share2/.hg/store/00manifest.i + share2/subrepo/.hg/00changelog.i + share2/subrepo/.hg/sharedpath.old + share2/subrepo/.hg/store/00changelog.i + share2/subrepo/.hg/store/00manifest.i + $ hg -R share2/subrepo log -r tip -T compact + 1[tip] 559dcc9bfa65 1970-01-01 00:00 + test +subrepo mod + $ rm -rf clone1 $ hg clone -qr 1 test clone1 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V3] phase: use a binary phase part to push through bundle2 (BC)
> On Oct 17, 2017, at 13:10, Boris Feldwrote: > > # HG changeset patch > # User Boris Feld > # Date 1505929086 -7200 > # Wed Sep 20 19:38:06 2017 +0200 > # Node ID 0505e8dfaf0f62b3532699958ce0d6d62bf1bb0c > # Parent 44c4ed4ad0326c6a8ab09b7a27c40a45e67ec1f3 > # EXP-Topic b2.phases.push > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 0505e8dfaf0f > phase: use a binary phase part to push through bundle2 (BC) This is queued, thanks. Please go ahead and at least give me a link to those bookmark related patches you mentioned - I know we're down to the wire, but that regression has been open irresponsibly long and I'd love for 4.4 to be the release to include a fix. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D894: fsmonitor: warn when fsmonitor could be used
quark added inline comments. INLINE COMMENTS > krbullock wrote in test-fsmonitor-warning.t:9 > We can't squeeze these into a test that's already set up? Brand-new test > cases are discouraged, since so much time in our test suite is already burned > on initializing repos. There was no fsmonitor related tests. So I think this is fine. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D894 To: indygreg, #hg-reviewers, mbthomas, krbullock Cc: quark, krbullock, mbthomas, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1081: tests: add check in test-check-commit.t to verify releasenotes directives
pulkit requested changes to this revision. pulkit added a comment. I have tweaked releasenotes to not error out in this case, rather show a warning only. So this patch is no longer applicable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1081 To: durin42, #hg-reviewers, indygreg, yuja, pulkit Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D940: remotenames: add functions to read remotenames data from .hg/remotenames/
pulkit abandoned this revision. pulkit added a comment. Will revisit after the freeze. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D940 To: pulkit, #hg-reviewers, dlax Cc: dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D939: remotenames: add functionality to store remotenames under .hg/hgremotenames/
pulkit abandoned this revision. pulkit added a comment. Will revisit after the freeze. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D939 To: pulkit, #hg-reviewers, dlax, ryanmce Cc: ryanmce, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D941: remotenames: add a function to return the vfs object
pulkit abandoned this revision. pulkit added a comment. Will revisit after the freeze. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D941 To: pulkit, #hg-reviewers, dlax, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D938: remotenames: move utility functions to join and split names to core
pulkit abandoned this revision. pulkit added a comment. Will revisit after the freeze. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D938 To: pulkit, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D974: py3: handle keyword arguments correctly in hgext/patchbomb.py
pulkit abandoned this revision. pulkit added a comment. Will revisit after the freeze. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D974 To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D933: scmutil: add a new function to show changes after a command
pulkit abandoned this revision. pulkit added a comment. Abandoning in favor of https://phab.mercurial-scm.org/D1173. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D933 To: pulkit, #hg-reviewers, dlax Cc: dlax, quark, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D934: rebase: add an experimental.showhashchanges config to show hash changes
pulkit abandoned this revision. pulkit added a comment. Abandoning in favor of https://phab.mercurial-scm.org/D1173. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D934 To: pulkit, #hg-reviewers Cc: quark, dlax, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D934: rebase: add an experimental.showhashchanges config to show hash changes
pulkit added a comment. In https://phab.mercurial-scm.org/D934#15996, @durin42 wrote: > In https://phab.mercurial-scm.org/D934#15995, @pulkit wrote: > > > In https://phab.mercurial-scm.org/D934#15939, @durin42 wrote: > > > > > I see what it does, but why? What's the motivation for the feature? > > > > > > It's for automation and helping editors such as Nuclide. > > > Could you please put that in the commit message? > > I wonder if we could make this stuff that was just --verbose output for rebase, and always put it in the json output (-Tjson) via the formatter, and not require a config. What do you think of taht approach? I like the approach but I have followed Jun's one as that was easy and no UI change. :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D934 To: pulkit, #hg-reviewers Cc: quark, dlax, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1173: rebase: add support to output nodechanges
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds support to rebase to show the changes in node once the rebase is complete. This will be extremely helpful for automation purposes and editors such as Nuclide. The output is a dictionary of predecessor hash as key and a list of successors' hashes. The successors one is a list as there can be many successor for a single predecessor in case of split and it will good to have a generic output format. This patch adds tests for the same. A new file is created for the patch as existing files related to rebase has their own purpose and there will be more formatter support coming for rebase in nex cycle. Thanks to Jun for suggesting to use fm.data(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1173 AFFECTED FILES hgext/rebase.py tests/test-rebase-templates.t CHANGE DETAILS diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t new file mode 100644 --- /dev/null +++ b/tests/test-rebase-templates.t @@ -0,0 +1,44 @@ +Testing templating for rebase command + +Setup + + $ cat >> $HGRCPATH < [extensions] + > rebase= + > [experimental] + > evolution=createmarkers + > EOF + + $ hg init repo + $ cd repo + $ for ch in a b c d; do echo foo > $ch; hg commit -Aqm "Added "$ch; done + + $ hg log -G -T "{rev}:{node|short} {desc}" + @ 3:62615734edd5 Added d + | + o 2:28ad74487de9 Added c + | + o 1:29becc82797a Added b + | + o 0:18d04c59bb5d Added a + +Getting the JSON output for nodechanges + + $ hg rebase -s 2 -d 0 -q -Tjson + [ + { +"nodechanges": {"28ad74487de9599d00d81085be739c61fc340652": ["849767420fd5519cf0026232411a943ed03cc9fb"], "62615734edd52f06b6fb9c2beb429e4fe30d57b8": ["df21b32134ba85d86bca590cbe9b8b7cbc346c53"]} + } + ] + + $ hg log -G -T "{rev}:{node|short} {desc}" + @ 5:df21b32134ba Added d + | + o 4:849767420fd5 Added c + | + | o 1:29becc82797a Added b + |/ + o 0:18d04c59bb5d Added a + + $ hg rebase -s 1 -d 5 -q -T "{nodechanges|json}" + {"29becc82797a4bc11ec8880b58eaecd2ab3e7760": ["d9d6773efc831c274eace04bc13e8e6412517139"]} (no-eol) diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -21,6 +21,7 @@ from mercurial.i18n import _ from mercurial.node import ( +hex, nullid, nullrev, short, @@ -501,6 +502,8 @@ def _finishrebase(self): repo, ui, opts = self.repo, self.ui, self.opts +fm = ui.formatter('rebase', opts) +fm.startitem() if self.collapsef and not self.keepopen: p1, p2, _base = defineparents(repo, min(self.state), self.destmap, self.state, self.skipped, @@ -551,7 +554,7 @@ if self.collapsef: collapsedas = newnode clearrebased(ui, repo, self.destmap, self.state, self.skipped, - collapsedas, self.keepf) + collapsedas, self.keepf, fm=fm) clearstatus(repo) clearcollapsemsg(repo) @@ -561,6 +564,7 @@ if self.skipped: skippedlen = len(self.skipped) ui.note(_("%d revisions have been skipped\n") % skippedlen) +fm.end() if (self.activebookmark and self.activebookmark in repo._bookmarks and repo['.'].node() == repo._bookmarks[self.activebookmark]): @@ -1517,7 +1521,7 @@ return originalwd, destmap, state def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None, - keepf=False): + keepf=False, fm=None): """dispose of rebased revision at the end of the rebase If `collapsedas` is not None, the rebase was a collapse whose result if the @@ -1541,6 +1545,10 @@ succs = (newnode,) replacements[oldnode] = succs scmutil.cleanupnodes(repo, replacements, 'rebase', moves) +if fm: +nodechanges = {hex(oldn): [hex(n) for n in newn] + for oldn, newn in replacements.iteritems()} +fm.data(nodechanges=nodechanges) def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1155: config: gather allowdivergence under the evolution namespace
quark added a comment. I'm not a big fan of inserting `evolution` everywhere. It confuses people. I'd prefer things like `experimental.obsstore=bool`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1155 To: lothiraldan, #hg-reviewers Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco added inline comments. INLINE COMMENTS > phillco wrote in test-arbitraryfilectx.t:4-5 > hm, something might be up with my setup, definitely got a green on > everything. I'll look into it. Ah, mea culpa. I had exempted those from my test system while on the long-lived in-memory merge branch (which has a lot of temp commits0 and forgot to switch them back on. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1165 To: phillco, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco added inline comments. INLINE COMMENTS > ryanmce wrote in context.py:2578 > I will remove the backticks in-flight; I think this are discouraged in > comments still > > Excellent comment overall, nonetheless Is there one standard for indicating code snippets? I've seen backticks, double backticks, or nothing, but I think anything is better than nothing. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1165 To: phillco, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco added inline comments. INLINE COMMENTS > ryanmce wrote in test-arbitraryfilectx.t:4-5 > --- /data/users/rmcelroy/mercurial/hg/tests/test-check-module-imports.t > +++ /data/users/rmcelroy/mercurial/hg/tests/test-check-module-imports.t.err > @@ -42,3 +42,6 @@ > > -X tests/test-lock.py \ > > -X tests/test-verify-repo-operations.py \ > > | sed 's-\\-/-g' | $PYTHON "$import_checker" - > + tests/test-arbitraryfilectx.t:4: imports from mercurial not lexically > sorted: commands < context > + tests/test-arbitraryfilectx.t:5: stdlib import "filecmp" follows local > import: mercurial > + [1] > > I can fix this in flight. Are you running all the `test-check-*.t` tests > locally? hm, something might be up with my setup, definitely got a green on everything. I'll look into it. > ryanmce wrote in test-arbitraryfilectx.t:8-13 > What a terrible, evil extension! You misspelled "glorious"! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1165 To: phillco, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1155: config: gather allowdivergence under the evolution namespace
ryanmce added a comment. I think this series overall cleans up the namespaces. I don't really love that evolution is still "hiding" under experimental but currently we don't have a way of marking non-"experimental" configs as experimental still so I guess this will have to suffice for now. I'll take a closer look tomorrow if nobody else gets to this first. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1155 To: lothiraldan, #hg-reviewers Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
This revision was automatically updated to reflect the committed changes. Closed by commit rHG14c87708f432: arbitraryfilecontext: skip the cmp fast path if any side is a symlink (authored by phillco, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D1165?vs=2942=2954#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1165?vs=2942=2954 REVISION DETAIL https://phab.mercurial-scm.org/D1165 AFFECTED FILES mercurial/context.py tests/test-arbitraryfilectx.t CHANGE DETAILS diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t new file mode 100644 --- /dev/null +++ b/tests/test-arbitraryfilectx.t @@ -0,0 +1,57 @@ +Setup: + $ cat > eval.py < from __future__ import absolute_import + > import filecmp + > from mercurial import commands, context, registrar + > cmdtable = {} + > command = registrar.command(cmdtable) + > @command(b'eval', [], 'hg eval CMD') + > def eval_(ui, repo, *cmds, **opts): + > cmd = " ".join(cmds) + > res = str(eval(cmd, globals(), locals())) + > ui.warn("%s" % res) + > EOF + + $ echo "[extensions]" >> $HGRCPATH + $ echo "eval=`pwd`/eval.py" >> $HGRCPATH + +Arbitraryfilectx.cmp does not follow symlinks: + $ mkdir case1 + $ cd case1 + $ hg init + $ printf "A" > real_A + $ printf "foo" > A + $ printf "foo" > B + $ ln -s A sym_A + $ hg add . + adding A + adding B + adding real_A + adding sym_A + $ hg commit -m "base" + +These files are different and should return True (different): +(Note that filecmp.cmp's return semantics are inverted from ours, so we invert +for simplicity): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])" + True (no-eol) + $ hg eval "not filecmp.cmp('A', 'real_A')" + True (no-eol) + +These files are identical and should return False (same): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])" + False (no-eol) + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])" + False (no-eol) + $ hg eval "not filecmp.cmp('A', 'B')" + False (no-eol) + +This comparison should also return False, since A and sym_A are substantially +the same in the eyes of ``filectx.cmp``, which looks at data only. + $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])" + False (no-eol) + +A naive use of filecmp on those two would wrongly return True, since it follows +the symlink to "A", which has different contents. + $ hg eval "not filecmp.cmp('real_A', 'sym_A')" + True (no-eol) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2570,9 +2570,13 @@ self._path = path def cmp(self, fctx): -if isinstance(fctx, workingfilectx) and self._repo: +# filecmp follows symlinks whereas `cmp` should not, so skip the fast +# path if either side is a symlink. +symlinks = ('l' in self.flags() or 'l' in fctx.flags()) +if not symlinks and isinstance(fctx, workingfilectx) and self._repo: # Add a fast-path for merge if both sides are disk-backed. -# Note that filecmp uses the opposite return values as cmp. +# Note that filecmp uses the opposite return values (True if same) +# from our cmp functions (True if different). return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) return self.data() != fctx.data() To: phillco, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
ryanmce accepted this revision. ryanmce added a comment. This revision is now accepted and ready to land. queued INLINE COMMENTS > context.py:2578 > +# Note that filecmp uses the opposite return values (True if > same) > +# as our ``cmp`` functions (True if different). > return not filecmp.cmp(self.path(), > self._repo.wjoin(fctx.path())) I will remove the backticks in-flight; I think this are discouraged in comments still Excellent comment overall, nonetheless > test-arbitraryfilectx.t:4-5 > + > from __future__ import absolute_import > + > from mercurial import context, commands, registrar > + > import filecmp > + > cmdtable = {} --- /data/users/rmcelroy/mercurial/hg/tests/test-check-module-imports.t +++ /data/users/rmcelroy/mercurial/hg/tests/test-check-module-imports.t.err @@ -42,3 +42,6 @@ > -X tests/test-lock.py \ > -X tests/test-verify-repo-operations.py \ > | sed 's-\\-/-g' | $PYTHON "$import_checker" - + tests/test-arbitraryfilectx.t:4: imports from mercurial not lexically sorted: commands < context + tests/test-arbitraryfilectx.t:5: stdlib import "filecmp" follows local import: mercurial + [1] I can fix this in flight. Are you running all the `test-check-*.t` tests locally? > test-arbitraryfilectx.t:8-13 > + > @command(b'eval', [], 'hg eval CMD') > + > def eval_(ui, repo, *cmds, **opts): > + > cmd = " ".join(cmds) > + > res = str(eval(cmd, globals(), locals())) > + > ui.warn("%s" % res) > + > EOF What a terrible, evil extension! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1165 To: phillco, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1170: parsers: allow clang-format here
durin42 added a comment. To review this, I suggest removing parsers.c from the blacklist and running `make format-c` (see https://phab.mercurial-scm.org/D1167) to observe that the resulting diff matches what's in this commit, rather than hand-inspecting the entire diff. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1170 To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1169: cext: add /* header */ comment to all PyVarObject_HEAD_INIT() calls
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This gives clang-format the right notion about formatting these struct initializers, therefore allowing us to automatically format several additional files. 1. skip-blame because this is just a content-free comment addition REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1169 AFFECTED FILES mercurial/cext/manifest.c mercurial/cext/osutil.c mercurial/cext/parsers.c mercurial/cext/revlog.c CHANGE DETAILS diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -1991,7 +1991,7 @@ }; static PyTypeObject indexType = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "parsers.index", /* tp_name */ sizeof(indexObject), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -195,7 +195,7 @@ }; PyTypeObject dirstateTupleType = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "dirstate_tuple", /* tp_name */ sizeof(dirstateTupleObject),/* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c --- a/mercurial/cext/osutil.c +++ b/mercurial/cext/osutil.c @@ -121,7 +121,7 @@ } static PyTypeObject listdir_stat_type = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "osutil.stat", /*tp_name*/ sizeof(struct listdir_stat), /*tp_basicsize*/ 0, /*tp_itemsize*/ diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c --- a/mercurial/cext/manifest.c +++ b/mercurial/cext/manifest.c @@ -262,7 +262,7 @@ #endif static PyTypeObject lazymanifestEntriesIterator = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "parsers.lazymanifest.entriesiterator", /*tp_name */ sizeof(lmIter), /*tp_basicsize */ 0, /*tp_itemsize */ @@ -310,7 +310,7 @@ #endif static PyTypeObject lazymanifestKeysIterator = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "parsers.lazymanifest.keysiterator", /*tp_name */ sizeof(lmIter), /*tp_basicsize */ 0, /*tp_itemsize */ @@ -890,7 +890,7 @@ #endif static PyTypeObject lazymanifestType = { - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(NULL, 0) /* header */ "parsers.lazymanifest", /* tp_name */ sizeof(lazymanifest), /* tp_basicsize */ 0,/* tp_itemsize */ To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1170: parsers: allow clang-format here
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY skip-blame because parsers.c is mechanically rewritten by = clang-format with no semantic change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1170 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/parsers.c CHANGE DETAILS diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -48,10 +48,8 @@ char *str, *start, *end; int len; - if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest", - _Type, , - _Type, , - , )) + if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest", _Type, + , _Type, , , )) goto quit; start = str; @@ -65,14 +63,14 @@ zero = memchr(start, '\0', end - start); if (!zero) { PyErr_SetString(PyExc_ValueError, - "manifest entry has no separator"); + "manifest entry has no separator"); goto quit; } newline = memchr(zero + 1, '\n', end - (zero + 1)); if (!newline) { PyErr_SetString(PyExc_ValueError, - "manifest contains trailing garbage"); + "manifest contains trailing garbage"); goto quit; } @@ -88,8 +86,7 @@ goto bail; if (nlen > 40) { - flags = PyBytes_FromStringAndSize(zero + 41, - nlen - 40); + flags = PyBytes_FromStringAndSize(zero + 41, nlen - 40); if (!flags) goto bail; @@ -120,10 +117,10 @@ } static inline dirstateTupleObject *make_dirstate_tuple(char state, int mode, - int size, int mtime) + int size, int mtime) { - dirstateTupleObject *t = PyObject_New(dirstateTupleObject, - ); + dirstateTupleObject *t = + PyObject_New(dirstateTupleObject, ); if (!t) return NULL; t->state = state; @@ -134,7 +131,7 @@ } static PyObject *dirstate_tuple_new(PyTypeObject *subtype, PyObject *args, - PyObject *kwds) +PyObject *kwds) { /* We do all the initialization here and not a tp_init function because * dirstate_tuple is immutable. */ @@ -184,55 +181,55 @@ } static PySequenceMethods dirstate_tuple_sq = { - dirstate_tuple_length, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - dirstate_tuple_item, /* sq_item */ - 0, /* sq_ass_item */ - 0, /* sq_contains */ - 0, /* sq_inplace_concat */ - 0 /* sq_inplace_repeat */ +dirstate_tuple_length, /* sq_length */ +0, /* sq_concat */ +0, /* sq_repeat */ +dirstate_tuple_item, /* sq_item */ +0, /* sq_ass_item */ +0, /* sq_contains */ +0, /* sq_inplace_concat */ +0 /* sq_inplace_repeat */ }; PyTypeObject dirstateTupleType = { - PyVarObject_HEAD_INIT(NULL, 0) /* header */ - "dirstate_tuple", /* tp_name */ - sizeof(dirstateTupleObject),/* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)dirstate_tuple_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - _tuple_sq,/* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT,/* tp_flags */ - "dirstate tuple", /* tp_doc
D1168: parsers: protect some case-folding tables from clang-format
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We want a slightly weird format here so that it's easier to read, but in order to preserve that we need to disable clang-format. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1168 AFFECTED FILES mercurial/cext/charencode.c CHANGE DETAILS diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -23,6 +23,7 @@ #define PyInt_AS_LONG PyLong_AS_LONG #endif +/* clang-format off */ static const char lowertable[128] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', @@ -64,6 +65,7 @@ '\x58', '\x59', '\x5a', /* x-z */ '\x7b', '\x7c', '\x7d', '\x7e', '\x7f' }; +/* clang-format on */ /* 1: no escape, 2: \, 6: \u */ static const uint8_t jsonlentable[256] = { To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1167: makefile: add target to apply clang-format in-place
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This makes it easy to reformat files after you finish editing them. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1167 AFFECTED FILES Makefile CHANGE DETAILS diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -122,6 +122,10 @@ check-code: hg manifest | xargs python contrib/check-code.py +format-c: + clang-format --style file -i \ + `hg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` + update-pot: i18n/hg.pot i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1150: config: use 'experimental.evolution.allowunstable'
ryanmce added inline comments. INLINE COMMENTS > test-check-commit.t:22 > > - Please avoid unrelated changes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1150 To: lothiraldan, durin42, #hg-reviewers Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2e8477059d4f: test-clang-format: new test to verify that files stay clang-formatted (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1133?vs=2916=2948 REVISION DETAIL https://phab.mercurial-scm.org/D1133 AFFECTED FILES contrib/clang-format-blacklist tests/test-check-clang-format.t CHANGE DETAILS diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t new file mode 100644 --- /dev/null +++ b/tests/test-check-clang-format.t @@ -0,0 +1,10 @@ +#require clang-format test-repo + + $ . "$TESTDIR/helpers-testrepo.sh" + + $ cd "$TESTDIR"/.. + $ for f in `testrepohg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do + > clang-format --style file $f > $f.formatted + > cmp $f $f.formatted || diff -u $f $f.formatted + > rm $f.formatted + > done diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist new file mode 100644 --- /dev/null +++ b/contrib/clang-format-blacklist @@ -0,0 +1,70 @@ +# Files that just need to be migrated to the formatter. +# Do not add new files here! +contrib/chg/chg.c +contrib/chg/hgclient.c +contrib/chg/hgclient.h +contrib/chg/procutil.c +contrib/chg/procutil.h +contrib/chg/util.c +contrib/chg/util.h +contrib/hgsh/hgsh.c +mercurial/cext/base85.c +mercurial/cext/bdiff.c +mercurial/cext/charencode.c +mercurial/cext/charencode.h +mercurial/cext/diffhelpers.c +mercurial/cext/dirs.c +mercurial/cext/manifest.c +mercurial/cext/mpatch.c +mercurial/cext/osutil.c +mercurial/cext/parsers.c +mercurial/cext/pathencode.c +mercurial/cext/revlog.c +# Vendored code that we should never format: +contrib/python-zstandard/c-ext/bufferutil.c +contrib/python-zstandard/c-ext/compressiondict.c +contrib/python-zstandard/c-ext/compressionparams.c +contrib/python-zstandard/c-ext/compressionwriter.c +contrib/python-zstandard/c-ext/compressobj.c +contrib/python-zstandard/c-ext/compressor.c +contrib/python-zstandard/c-ext/compressoriterator.c +contrib/python-zstandard/c-ext/constants.c +contrib/python-zstandard/c-ext/decompressionwriter.c +contrib/python-zstandard/c-ext/decompressobj.c +contrib/python-zstandard/c-ext/decompressor.c +contrib/python-zstandard/c-ext/decompressoriterator.c +contrib/python-zstandard/c-ext/frameparams.c +contrib/python-zstandard/c-ext/python-zstandard.h +contrib/python-zstandard/zstd.c +contrib/python-zstandard/zstd/common/bitstream.h +contrib/python-zstandard/zstd/common/entropy_common.c +contrib/python-zstandard/zstd/common/error_private.c +contrib/python-zstandard/zstd/common/error_private.h +contrib/python-zstandard/zstd/common/fse.h +contrib/python-zstandard/zstd/common/fse_decompress.c +contrib/python-zstandard/zstd/common/huf.h +contrib/python-zstandard/zstd/common/mem.h +contrib/python-zstandard/zstd/common/pool.c +contrib/python-zstandard/zstd/common/pool.h +contrib/python-zstandard/zstd/common/threading.c +contrib/python-zstandard/zstd/common/threading.h +contrib/python-zstandard/zstd/common/xxhash.c +contrib/python-zstandard/zstd/common/xxhash.h +contrib/python-zstandard/zstd/common/zstd_common.c +contrib/python-zstandard/zstd/common/zstd_errors.h +contrib/python-zstandard/zstd/common/zstd_internal.h +contrib/python-zstandard/zstd/compress/fse_compress.c +contrib/python-zstandard/zstd/compress/huf_compress.c +contrib/python-zstandard/zstd/compress/zstd_compress.c +contrib/python-zstandard/zstd/compress/zstd_opt.h +contrib/python-zstandard/zstd/compress/zstdmt_compress.c +contrib/python-zstandard/zstd/compress/zstdmt_compress.h +contrib/python-zstandard/zstd/decompress/huf_decompress.c +contrib/python-zstandard/zstd/decompress/zstd_decompress.c +contrib/python-zstandard/zstd/dictBuilder/cover.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.h +contrib/python-zstandard/zstd/dictBuilder/zdict.c +contrib/python-zstandard/zstd/dictBuilder/zdict.h +contrib/python-zstandard/zstd/zstd.h +hgext/fsmonitor/pywatchman/bser.c To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
ryanmce accepted this revision. ryanmce added a comment. This revision is now accepted and ready to land. Yeah, I was running the wrong run-tests.py. Thanks for the help @durin42. queued REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D987: copies: add a config to limit the number of candidates to check in heuristics
pulkit updated this revision to Diff 2947. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D987?vs=2539=2947 REVISION DETAIL https://phab.mercurial-scm.org/D987 AFFECTED FILES mercurial/configitems.py mercurial/copies.py tests/test-copytrace-heuristics.t CHANGE DETAILS diff --git a/tests/test-copytrace-heuristics.t b/tests/test-copytrace-heuristics.t --- a/tests/test-copytrace-heuristics.t +++ b/tests/test-copytrace-heuristics.t @@ -201,6 +201,65 @@ $ cd .. $ rm -rf repo +Test the copytrace.movecandidateslimit with many move candidates + + + $ hg init repo + $ initclient repo + $ cd repo + $ echo a > a + $ hg add a + $ hg ci -m initial + $ hg mv a foo + $ echo a > b + $ echo a > c + $ echo a > d + $ echo a > e + $ echo a > f + $ echo a > g + $ hg add b + $ hg add c + $ hg add d + $ hg add e + $ hg add f + $ hg add g + $ hg ci -m 'mv a foo, add many files' + $ hg up -q ".^" + $ echo b > a + $ hg ci -m 'mod a' + created new head + + $ hg log -G -T 'changeset: {node}\n desc: {desc}\n' + @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e + | desc: mod a + | o changeset: 8329d5c6bf479ec5ca59b9864f3f45d07213f5a4 + |/desc: mv a foo, add many files + o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98 + desc: initial + +With small limit + + $ hg rebase -s 2 -d 1 --config experimental.copytrace.movecandidateslimit=0 + rebasing 2:ef716627c70b "mod a" (tip) + skipping copytracing for 'a', more candidates than the limit: 7 + other [source] changed a which local [dest] deleted + use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u + unresolved conflicts (see hg resolve, then hg rebase --continue) + [1] + + $ hg rebase --abort + rebase aborted + +With default limit which is 100 + + $ hg rebase -s 2 -d 1 + rebasing 2:ef716627c70b "mod a" (tip) + merging foo and a to foo + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob) + + $ cd .. + $ rm -rf repo + Move file in one branch and delete it in another --- diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -11,6 +11,8 @@ import heapq import os +from .i18n import _ + from . import ( match as matchmod, node, @@ -644,6 +646,11 @@ [experimental] copytrace = heuristics + +In some cases the copy/move candidates found by heuristics can be very large +in number and that will make the algorithm slow. The number of possible +candidates to check can be limited by using the config +`experimental.copytrace.movecandidateslimit` which defaults to 100. """ if c1.rev() is None: @@ -704,6 +711,17 @@ # f is guaranteed to be present in c2, that's why # c2.filectx(f) won't fail f2 = c2.filectx(f) +# we can have a lot of candidates which can slow down the heuristics +# config value to limit the number of candidates moves to check +maxcandidates = repo.ui.configint('experimental', + 'copytrace.movecandidateslimit') + +if len(movecandidates) > maxcandidates: +repo.ui.status(_("skipping copytracing for '%s', more " + "candidates than the limit: %d\n") + % (f, len(movecandidates))) +continue + for candidate in movecandidates: f1 = c1.filectx(candidate) if _related(f1, f2, anc.rev()): diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -330,6 +330,9 @@ coreconfigitem('experimental', 'copytrace', default='on', ) +coreconfigitem('experimental', 'copytrace.movecandidateslimit', +default=100, +) coreconfigitem('experimental', 'copytrace.sourcecommitlimit', default=100, ) To: pulkit, #hg-reviewers, yuja Cc: stash, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
quark added a comment. In https://phab.mercurial-scm.org/D1133#19539, @ryanmce wrote: > I get `skipped: unknown feature: clang-format` when running `test-check-clang-format.t` now. What am I doing wrong? Are you using `run-tests.py` from this repo and running it in the `tests/` directory from this repo? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1156: tests: add test demonstrating regression in path audit
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd6009d1488e8: tests: add test demonstrating regression in path audit (authored by mbthomas, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1156?vs=2929=2945 REVISION DETAIL https://phab.mercurial-scm.org/D1156 AFFECTED FILES tests/test-audit-path.t CHANGE DETAILS diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -119,9 +119,14 @@ $ hg manifest -r3 ../test + $ mkdir ../test + $ echo data > ../test/file $ hg update -Cr3 abort: path contains illegal component: ../test (glob) [255] + $ cat ../test/file + cat: ../test/file: No such file or directory + [1] attack /tmp/test To: mbthomas, #hg-reviewers, ryanmce Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1157: context: audit paths before clearing unknown files and dirs
This revision was automatically updated to reflect the committed changes. Closed by commit rHG07bbb208a924: context: audit paths before clearing unknown files and dirs (authored by mbthomas, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1157?vs=2930=2946 REVISION DETAIL https://phab.mercurial-scm.org/D1157 AFFECTED FILES mercurial/context.py tests/test-audit-path.t CHANGE DETAILS diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -125,8 +125,7 @@ abort: path contains illegal component: ../test (glob) [255] $ cat ../test/file - cat: ../test/file: No such file or directory - [1] + data attack /tmp/test diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1946,6 +1946,7 @@ """ wvfs = self._repo.wvfs f = self._path +wvfs.audit(f) if wvfs.isdir(f) and not wvfs.islink(f): wvfs.rmtree(f, forcibly=True) for p in reversed(list(util.finddirs(f))): To: mbthomas, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1166: ui: move request exit handlers to global state
quark accepted this revision. quark added a comment. This was discussed internally. Exit handlers should be per process (ex. "global"), non-copyable to avoid run them multiple times. So this change is a pure improvement. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1166 To: singhsrb, #hg-reviewers, quark Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
ryanmce added a comment. I get `skipped: unknown feature: clang-format` when running `test-check-clang-format.t` now. What am I doing wrong? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1157: context: audit paths before clearing unknown files and dirs
ryanmce accepted this revision. ryanmce added a comment. This revision is now accepted and ready to land. queued REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1157 To: mbthomas, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1074: branch: add a --rev flag to change branch name of given revisions
pulkit marked 4 inline comments as done. pulkit added inline comments. INLINE COMMENTS > ryanmce wrote in cmdutil.py:722-731 > What about an unclean working copy? It looks like that's supported -- could > we make sure it's tested? It's not supported. Handled that case and added a test. Thanks! > ryanmce wrote in cmdutil.py:733-734 > In theory, the phase boundary could move after our check but before we take > the repolock. Can we guard against that please? > > Two ways to accomplish this: > > 1/ Take the repo lock earlier > 2/ Check before repo lock (fast path) and again after the repo lock is held > (in case something changed) Improved the implementation by taking lock earlier. Thanks! > ryanmce wrote in test-branch-change.t:10 > This test needs to include a case where we strip commits, especially with a > merge, just so the behavior is clear in this change. > > That will probably (in my understanding of the current code) expose an issue > that needs to be fixed. Oh, I didn't know that. Just banned merge revisions for now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1074 To: pulkit, #hg-reviewers, dlax, ryanmce Cc: ryanmce, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1082: split: new extension to split changesets
quark added a comment. In https://phab.mercurial-scm.org/D1082#19507, @lothiraldan wrote: > I'm still concerned about possible obsmarkers explosion as we move to more and more auto-stabilizing commands in core. For leaving a trace of the problem, if we use auto-stabilizing commands on every changeset on the stack (rewrite the first changeset, all parent get stabilized, rewrite the second changeset, all parents get stabilized, etc..), we will end up creating N²/2 obsmarkers with a stack of N: > > stack of 4 changeset: 8 obs-markers, > stack of 10 changesets: 50 obs-markers, > stack of 30 changesets: 450 obs-markers, > > > I'm not saying that everyone has a 30 changesets stack but even with a small stack going back and forth in the stack while making editions would rapidly grow the number of obsmarkers created which will cause scalability issues when exchanging markers. > > There is a couple of interesting lead to solve this, maybe we could do something special when more than X (configurable) obs-markers are created. Probably avoid the stabilization and point to some documentation or commands (like restack). In my opinion, the "obsmarkers explosion" problem is because the current algorithm loads the entire obsstore while it is not necessary to know all markers in all cases. i.e. "obsmarkers explosion" is NOT a problem if the algorithm is smarter that only parses or loads markers needed for certain calculations. i.e. `obsolete()` and all obsmarker-related revsets are lazy. Of course it takes some time to rewrite them into lazy versions. In additional, the `N^2` case you are talking about only happens if the user splits every commit in their draft stack, which is unrealistic. I don't think that should block the default behavior here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1082 To: quark, #hg-reviewers Cc: lothiraldan, martinvonz, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1074: branch: add a --rev flag to change branch name of given revisions
pulkit updated this revision to Diff 2944. pulkit edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1074?vs=2807=2944 REVISION DETAIL https://phab.mercurial-scm.org/D1074 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py tests/test-branch-change.t tests/test-completion.t CHANGE DETAILS diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -239,7 +239,7 @@ backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user bisect: reset, good, bad, skip, extend, command, noupdate bookmarks: force, rev, delete, rename, inactive, template - branch: force, clean + branch: force, clean, rev branches: active, closed, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template diff --git a/tests/test-branch-change.t b/tests/test-branch-change.t new file mode 100644 --- /dev/null +++ b/tests/test-branch-change.t @@ -0,0 +1,271 @@ +Testing changing branch on commits +== + +Setup + + $ cat >> $HGRCPATH << EOF + > [alias] + > glog = log -G -T "{rev}:{node|short} {desc}\n{branch} ({bookmarks})" + > [experimental] + > evolution = createmarkers + > [extensions] + > rebase= + > EOF + + $ hg init repo + $ cd repo + $ for ch in a b c d e; do echo foo >> $ch; hg ci -Aqm "Added "$ch; done + $ hg glog + @ 4:aa98ab95a928 Added e + | default () + o 3:62615734edd5 Added d + | default () + o 2:28ad74487de9 Added c + | default () + o 1:29becc82797a Added b + | default () + o 0:18d04c59bb5d Added a + default () + + $ hg branches + default4:aa98ab95a928 + +Try without passing a new branch name + + $ hg branch -r . + abort: no branch name specified for the revisions + [255] + +Setting an invalid branch name + + $ hg branch -r . a:b + abort: ':' cannot be used in a name + [255] + $ hg branch -r . tip + abort: the name 'tip' is reserved + [255] + $ hg branch -r . 1234 + abort: cannot use an integer as a name + [255] + +Change on non-linear set of commits + + $ hg branch -r 2 -r 4 foo + abort: cannot change branch of non-linear revisions + [255] + +Change in middle of the stack (linear commits) + + $ hg branch -r 1::3 foo + abort: cannot change branch in middle of a stack + [255] + +Change with dirty working directory + + $ echo bar > a + $ hg branch -r . foo + abort: uncommitted changes + [255] + + $ hg revert --all + reverting a + +Changing branch on linear set of commits from head + +Without obsmarkers + + $ hg branch -r 3:4 foo --config experimental.evolution=! + changed branch on 2 changesets + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/62615734edd5-e86bd13a-branch-change.hg (glob) + $ hg glog + @ 4:3938acfb5c0f Added e + | foo () + o 3:9435da006bdc Added d + | foo () + o 2:28ad74487de9 Added c + | default () + o 1:29becc82797a Added b + | default () + o 0:18d04c59bb5d Added a + default () + + $ hg branches + foo4:3938acfb5c0f + default2:28ad74487de9 (inactive) + +With obsmarkers + + $ hg branch -r 3::4 bar + changed branch on 2 changesets + $ hg glog + @ 6:7c1991464886 Added e + | bar () + o 5:1ea05e93925f Added d + | bar () + o 2:28ad74487de9 Added c + | default () + o 1:29becc82797a Added b + | default () + o 0:18d04c59bb5d Added a + default () + + $ hg branches + bar6:7c1991464886 + default2:28ad74487de9 (inactive) + +Change branch name to an existing branch + + $ hg branch -r . default + abort: a branch of the same name already exists + (use 'hg update' to switch to it) + [255] + +Changing on a branch head which is not topological head + + $ hg branch -r 2 stable + abort: cannot change branch in middle of a stack + [255] + +Make sure bookmark movement is correct + + $ hg bookmark b1 + $ hg glog -r . + @ 6:7c1991464886 Added e + | bar (b1) + ~ + + $ hg branch -r '(.^)::' foo --debug + changing branch of '1ea05e93925f806d875a2163f9b76764be644636' from 'bar' to 'foo' + committing files: + d + committing manifest + committing changelog + new node id is 974cbad5a704c10bec744568fec0f2fd2dc000e4 + changing branch of '7c19914648869f5b02fc7fed31ddee9783fdd680' from 'bar' to 'foo' + committing files: + e + committing manifest + committing changelog + new node id is 916bb75f2f1dc742cbbec815d2f89b733f5832b2 + moving bookmarks ['b1'] from 7c19914648869f5b02fc7fed31ddee9783fdd680 to 916bb75f2f1dc742cbbec815d2f89b733f5832b2 + resolving manifests + branchmerge: False, force: False, partial: False + ancestor: 7c1991464886, local: 7c1991464886+, remote: 916bb75f2f1d + changed branch on 2 changesets + updating the branch cache
D1166: ui: move request exit handlers to global state
singhsrb created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Since the ui objects can be created with the 'load' class method, it is possible to lose the exit handlers information from the old ui instance. For example, running 'test-bad-extension.t' leads to this situation where chg creates a new ui instance which does not copy the exit handlers from the earlier ui instance. For exit handlers, which are special cases anyways, it probably makes sense to have a global state of the handlers. This would ensure that the exit handlers registered once are definitely executed at the end of the request. TEST PLAN Ran all the tests without '--chg' option. This also fixes the 'test-bad-extension.t' with the '--chg' option. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1166 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -183,6 +183,9 @@ # retrieving configuration value. _unset = object() +# _reqexithandlers: callbacks run at the end of a request +_reqexithandlers = [] + class ui(object): def __init__(self, src=None): """Create a fresh new ui object if no src given @@ -193,8 +196,6 @@ """ # _buffers: used for temporary capture of output self._buffers = [] -# _exithandlers: callbacks run at the end of a request -self._exithandlers = [] # 3-tuple describing how each buffer in the stack behaves. # Values are (capture stderr, capture subprocesses, apply labels). self._bufferstates = [] @@ -220,7 +221,6 @@ self._styles = {} if src: -self._exithandlers = src._exithandlers self.fout = src.fout self.ferr = src.ferr self.fin = src.fin @@ -1090,6 +1090,10 @@ return True +@property +def _exithandlers(self): +return _reqexithandlers + def atexit(self, func, *args, **kwargs): '''register a function to run after dispatching a request To: singhsrb, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1082: split: new extension to split changesets
lothiraldan added a comment. In https://phab.mercurial-scm.org/D1082#18693, @quark wrote: > In https://phab.mercurial-scm.org/D1082#18648, @lothiraldan wrote: > > > It will be great to have split in core, even if it's only as an experimental experiment for now. > > > > I like the UX improvements, but could we add a config knob to disable the auto-rebase for power-users? I agree that generating orphans is maybe not the best UX for users, so I think having it on by default could be an improvement. > > > I believe most users want auto-rebase by default. Auto-rebase is the default at FB for months and people like it. Yes agreed, sorry if I was not clear, I think it's a good behavior for most users. > I agree power users may want a different default. In that case, you can set alias `split = split --no-rebase`. > >> But, I often am in the middle of a too big stack and auto-rebasing would break my flow of fixing commits from bottom to top without mentioning the number of obs-markers it would generate. I'm still concerned about possible obsmarkers explosion as we move to more and more auto-stabilizing commands in core. For leaving a trace of the problem, if we use auto-stabilizing commands on every changeset on the stack (rewrite the first changeset, all parent get stabilized, rewrite the second changeset, all parents get stabilized, etc..), we will end up creating N²/2 obsmarkers with a stack of N: stack of 4 changeset: 8 obs-markers, stack of 10 changesets: 50 obs-markers, stack of 30 changesets: 450 obs-markers, I'm not saying that everyone has a 30 changesets stack but even with a small stack going back and forth in the stack while making editions would rapidly grow the number of obsmarkers created which will cause scalability issues when exchanging markers. There is a couple of interesting lead to solve this, maybe we could do something special when more than X (configurable) obs-markers are created. Probably avoid the stabilization and point to some documentation or commands (like restack). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1082 To: quark, #hg-reviewers Cc: lothiraldan, martinvonz, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco added a comment. I've sent https://phab.mercurial-scm.org/D1165, which is the corrected version. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1122 To: phillco, #hg-reviewers, durin42 Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1165: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY `filecmp` follows symlinks by default, which a `filectx.cmp()` call should not be doing as it should only compare the requested entry. After this patch, only the contexts' data are compared, which is the correct contract. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1165 AFFECTED FILES mercurial/context.py tests/test-arbitraryfilectx.t CHANGE DETAILS diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t new file mode 100644 --- /dev/null +++ b/tests/test-arbitraryfilectx.t @@ -0,0 +1,57 @@ +Setup: + $ cat > eval.py < from __future__ import absolute_import + > from mercurial import context, commands, registrar + > import filecmp + > cmdtable = {} + > command = registrar.command(cmdtable) + > @command(b'eval', [], 'hg eval CMD') + > def eval_(ui, repo, *cmds, **opts): + > cmd = " ".join(cmds) + > res = str(eval(cmd, globals(), locals())) + > ui.warn("%s" % res) + > EOF + + $ echo "[extensions]" >> $HGRCPATH + $ echo "eval=`pwd`/eval.py" >> $HGRCPATH + +Arbitraryfilectx.cmp does not follow symlinks: + $ mkdir case1 + $ cd case1 + $ hg init + $ printf "A" > real_A + $ printf "foo" > A + $ printf "foo" > B + $ ln -s A sym_A + $ hg add . + adding A + adding B + adding real_A + adding sym_A + $ hg commit -m "base" + +These files are different and should return True (different): +(Note that filecmp.cmp's return semantics are inverted from ours, so we invert +for simplicity): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])" + True (no-eol) + $ hg eval "not filecmp.cmp('A', 'real_A')" + True (no-eol) + +These files are identical and should return False (same): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])" + False (no-eol) + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])" + False (no-eol) + $ hg eval "not filecmp.cmp('A', 'B')" + False (no-eol) + +This comparison should also return False, since A and sym_A are substantially +the same in the eyes of ``filectx.cmp``, which looks at data only. + $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])" + False (no-eol) + +A naive use of filecmp on those two would wrongly return True, since it follows +the symlink to "A", which has different contents. + $ hg eval "not filecmp.cmp('real_A', 'sym_A')" + True (no-eol) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2569,9 +2569,13 @@ self._path = path def cmp(self, fctx): -if isinstance(fctx, workingfilectx) and self._repo: +# filecmp follows symlinks whereas `cmp` should not, so skip the fast +# path if either side is a symlink. +symlinks = ('l' in self.flags() or 'l' in fctx.flags()) +if isinstance(fctx, workingfilectx) and self._repo and not symlinks: # Add a fast-path for merge if both sides are disk-backed. -# Note that filecmp uses the opposite return values as cmp. +# Note that filecmp uses the opposite return values (True if same) +# as our ``cmp`` functions (True if different). return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) return self.data() != fctx.data() To: phillco, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco updated this revision to Diff 2941. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1122?vs=2878=2941 REVISION DETAIL https://phab.mercurial-scm.org/D1122 AFFECTED FILES mercurial/context.py tests/test-arbitraryfilectx.t CHANGE DETAILS diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t new file mode 100644 --- /dev/null +++ b/tests/test-arbitraryfilectx.t @@ -0,0 +1,57 @@ +Setup: + $ cat > eval.py < from __future__ import absolute_import + > from mercurial import context, commands, registrar + > import filecmp + > cmdtable = {} + > command = registrar.command(cmdtable) + > @command(b'eval', [], 'hg eval CMD') + > def eval_(ui, repo, *cmds, **opts): + > cmd = " ".join(cmds) + > res = str(eval(cmd, globals(), locals())) + > ui.warn("%s" % res) + > EOF + + $ echo "[extensions]" >> $HGRCPATH + $ echo "eval=`pwd`/eval.py" >> $HGRCPATH + +Arbitraryfilectx.cmp does not follow symlinks: + $ mkdir case1 + $ cd case1 + $ hg init + $ printf "A" > real_A + $ printf "foo" > A + $ printf "foo" > B + $ ln -s A sym_A + $ hg add . + adding A + adding B + adding real_A + adding sym_A + $ hg commit -m "base" + +These files are different and should return True (different): +(Note that filecmp.cmp's return semantics are inverted from ours, so we invert +for simplicity): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])" + True (no-eol) + $ hg eval "not filecmp.cmp('A', 'real_A')" + True (no-eol) + +These files are identical and should return False (same): + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])" + False (no-eol) + $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])" + False (no-eol) + $ hg eval "not filecmp.cmp('A', 'B')" + False (no-eol) + +This comparison should also return False, since A and sym_A are substantially +the same in the eyes of ``filectx.cmp``, which looks at data only. + $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])" + False (no-eol) + +A naive use of filecmp on those two would wrongly return True, since it follows +the symlink to "A", which has different contents. + $ hg eval "not filecmp.cmp('real_A', 'sym_A')" + True (no-eol) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2569,9 +2569,13 @@ self._path = path def cmp(self, fctx): -if isinstance(fctx, workingfilectx) and self._repo: +# filecmp follows symlinks whereas `cmp` should not, so skip the fast +# path if either side is a symlink. +symlinks = ('l' in self.flags() or 'l' in fctx.flags()) +if isinstance(fctx, workingfilectx) and self._repo and not symlinks: # Add a fast-path for merge if both sides are disk-backed. -# Note that filecmp uses the opposite return values as cmp. +# Note that filecmp uses the opposite return values (True if same) +# as our ``cmp`` functions (True if different). return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) return self.data() != fctx.data() To: phillco, #hg-reviewers, durin42 Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 4 v4] revset: extract a parsefollowlinespattern helper function
# HG changeset patch # User Denis Laxalde# Date 1507123663 -7200 # Wed Oct 04 15:27:43 2017 +0200 # Node ID 73dcd7f479a2481be007de11b03e834aec334ffd # Parent 68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac # EXP-Topic followlines-cli revset: extract a parsefollowlinespattern helper function We'll need the same logic in forthcoming changeset to handle --line-range option in 'hg log' command. The function lives in scmutil.py (rather than util.py) as it uses match and pathutil modules. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -981,16 +981,9 @@ def followlines(repo, subset, x): rev = revs.last() pat = getstring(args['file'], _("followlines requires a pattern")) -if not matchmod.patkind(pat): -fname = pathutil.canonpath(repo.root, repo.getcwd(), pat) -else: -m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=repo[rev]) -files = [f for f in repo[rev] if m(f)] -if len(files) != 1: -# i18n: "followlines" is a keyword -raise error.ParseError(_("followlines expects exactly one file")) -fname = files[0] - +# i18n: "followlines" is a keyword +msg = _("followlines expects exactly one file") +fname = scmutil.parsefollowlinespattern(repo, rev, pat, msg) # i18n: "followlines" is a keyword lr = getrange(args['lines'][0], _("followlines expects a line range")) fromline, toline = [getinteger(a, _("line range bounds must be integers")) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -567,6 +567,20 @@ def matchfiles(repo, files, badfn=None): '''Return a matcher that will efficiently match exactly these files.''' return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn) +def parsefollowlinespattern(repo, rev, pat, msg): +"""Return a file name from `pat` pattern suitable for usage in followlines +logic. +""" +if not matchmod.patkind(pat): +return pathutil.canonpath(repo.root, repo.getcwd(), pat) +else: +ctx = repo[rev] +m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=ctx) +files = [f for f in ctx if m(f)] +if len(files) != 1: +raise error.ParseError(msg) +return files[0] + def origpath(ui, repo, filepath): '''customize where .orig files are created ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 4 v4] log: add -L/--line-range option to follow file history by line range
# HG changeset patch # User Denis Laxalde# Date 1508267731 -7200 # Tue Oct 17 21:15:31 2017 +0200 # Node ID 601ab53301506bc35ab75adc8de9f611af9b3d80 # Parent 909a69f31ef323ded6fef8dd56fb44dc97f4cd89 # EXP-Topic followlines-cli log: add -L/--line-range option to follow file history by line range We add an experimental -L/--line-range option to 'hg log' taking file patterns along with a line range using the (new) FILE,FROMLINE-TOLINE syntax where FILE may be a pattern (matching exactly one file). The resulting history is similar to what the "followlines" revset except that, if --patch is specified, only diff hunks within specified line range are shown. Basically, this brings the CLI on par with what currently only exists in hgweb through line selection in "file" and "annotate" views resulting in a file log with filtered patch to only display followed line range. The option may be specified multiple times and can be combined with --rev and regular file patterns to further restrict revisions. Usage of this option requires --follow; revisions are shown in descending order and renames are followed. Only the --graph option is currently not supported. The UI is the result of a consensus from review feedback at: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-October/106749.html The implementation spreads between commands.log() and cmdutil module. In commands.log(), the main loop may now use a "hunksfilter" factory (similar to "filematcher") that, for a given "rev", produces a filtering function for diff hunks for a given file context object. The logic to build revisions from -L/--line-range options lives in cmdutil.getloglinerangerevs() which produces "revs", "filematcher" and "hunksfilter" information. Revisions obtained by following files' line range are filtered if they do not match the revset specified by --rev option. If regular FILE arguments are passed along with -L options, both filematchers are combined into a new matcher. .. feature:: Add an experimental -L/--line-range FILE,FROMLINE-TOLINE option to 'hg log' command to follow the history of files by line range. In combination with -p/--patch option, only diff hunks within specified line range will be displayed. Feedback, especially on UX aspects, is welcome. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -26,12 +26,14 @@ from . import ( changelog, copies, crecord as crecordmod, +dagop, dirstateguard, encoding, error, formatter, graphmod, match as matchmod, +mdiff, obsolete, patch, pathutil, @@ -2573,6 +2575,87 @@ def getlogrevs(repo, pats, opts): return revs, expr, filematcher +def _parselinerangelogopt(repo, opts): +"""Parse --line-range log option and return a list of tuples (filename, +(fromline, toline)). +""" +linerangebyfname = [] +for pat in opts.get('line_range', []): +try: +pat, linerange = pat.rsplit(',', 1) +except ValueError: +raise error.Abort(_('malformatted line-range pattern %s') % pat) +try: +fromline, toline = map(int, linerange.split('-')) +except ValueError: +raise error.Abort(_("invalid line range for %s") % pat) +msg = _("line range pattern '%s' must match exactly one file") % pat +fname = scmutil.parsefollowlinespattern(repo, None, pat, msg) +linerangebyfname.append( +(fname, util.processlinerange(fromline, toline))) +return linerangebyfname + +def getloglinerangerevs(repo, userrevs, opts): +"""Return (revs, filematcher, hunksfilter). + +"revs" are revisions obtained by processing "line-range" log options and +walking block ancestors of each specified file/line-range. + +"filematcher(rev) -> match" is a factory function returning a match object +for a given revision for file patterns specified in --line-range option. +If neither --stat nor --patch options are passed, "filematcher" is None. + +"hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function +returning a hunks filtering function. +If neither --stat nor --patch options are passed, "filterhunks" is None. +""" +wctx = repo[None] + +# Two-levels map of "rev -> file ctx -> [line range]". +linerangesbyrev = {} +for fname, (fromline, toline) in _parselinerangelogopt(repo, opts): +fctx = wctx.filectx(fname) +for fctx, linerange in dagop.blockancestors(fctx, fromline, toline): +rev = fctx.introrev() +if rev not in userrevs: +continue +linerangesbyrev.setdefault( +rev, {}).setdefault( +fctx.path(), []).append(linerange) + +filematcher = None +hunksfilter = None +if opts.get('patch') or opts.get('stat'): + +def nofilterhunksfn(fctx, hunks): +
[PATCH 3 of 4 v4] diff: pass a diff hunks filter function from changeset_printer to patch.diff()
# HG changeset patch # User Denis Laxalde# Date 1507293917 -7200 # Fri Oct 06 14:45:17 2017 +0200 # Node ID 909a69f31ef323ded6fef8dd56fb44dc97f4cd89 # Parent c73893dd6cfb5693029f5d9dcf1d537197b40a4a # EXP-Topic followlines-cli diff: pass a diff hunks filter function from changeset_printer to patch.diff() We add a 'hunksfilterfn' keyword argument in all functions of the call stack from changeset_printer.show() to patch.diff(). This is a callable that will be used to filter out hunks by line range and will be used in the "-L/--line-range" option of "hg log" command introduced in the following changesets. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1494,7 +1494,7 @@ def export(repo, revs, fntemplate='hg-%h def diffordiffstat(ui, repo, diffopts, node1, node2, match, changes=None, stat=False, fp=None, prefix='', - root='', listsubrepos=False): + root='', listsubrepos=False, hunksfilterfn=None): '''show diff or diffstat.''' if fp is None: write = ui.write @@ -1522,14 +1522,16 @@ def diffordiffstat(ui, repo, diffopts, n if not ui.plain(): width = ui.termwidth() chunks = patch.diff(repo, node1, node2, match, changes, diffopts, -prefix=prefix, relroot=relroot) +prefix=prefix, relroot=relroot, +hunksfilterfn=hunksfilterfn) for chunk, label in patch.diffstatui(util.iterlines(chunks), width=width): write(chunk, label=label) else: for chunk, label in patch.diffui(repo, node1, node2, match, changes, diffopts, prefix=prefix, - relroot=relroot): + relroot=relroot, + hunksfilterfn=hunksfilterfn): write(chunk, label=label) if listsubrepos: @@ -1591,16 +1593,17 @@ class changeset_printer(object): if self.footer: self.ui.write(self.footer) -def show(self, ctx, copies=None, matchfn=None, **props): +def show(self, ctx, copies=None, matchfn=None, hunksfilterfn=None, + **props): props = pycompat.byteskwargs(props) if self.buffered: self.ui.pushbuffer(labeled=True) -self._show(ctx, copies, matchfn, props) +self._show(ctx, copies, matchfn, hunksfilterfn, props) self.hunk[ctx.rev()] = self.ui.popbuffer() else: -self._show(ctx, copies, matchfn, props) - -def _show(self, ctx, copies, matchfn, props): +self._show(ctx, copies, matchfn, hunksfilterfn, props) + +def _show(self, ctx, copies, matchfn, hunksfilterfn, props): '''show a single changeset or file revision''' changenode = ctx.node() rev = ctx.rev() @@ -1711,13 +1714,13 @@ class changeset_printer(object): label='log.summary') self.ui.write("\n") -self.showpatch(ctx, matchfn) +self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn) def _exthook(self, ctx): '''empty method used by extension as a hook point ''' -def showpatch(self, ctx, matchfn): +def showpatch(self, ctx, matchfn, hunksfilterfn=None): if not matchfn: matchfn = self.matchfn if matchfn: @@ -1728,12 +1731,14 @@ class changeset_printer(object): prev = ctx.p1().node() if stat: diffordiffstat(self.ui, self.repo, diffopts, prev, node, - match=matchfn, stat=True) + match=matchfn, stat=True, + hunksfilterfn=hunksfilterfn) if diff: if stat: self.ui.write("\n") diffordiffstat(self.ui, self.repo, diffopts, prev, node, - match=matchfn, stat=False) + match=matchfn, stat=False, + hunksfilterfn=hunksfilterfn) self.ui.write("\n") class jsonchangeset(changeset_printer): @@ -1750,7 +1755,7 @@ class jsonchangeset(changeset_printer): else: self.ui.write("[]\n") -def _show(self, ctx, copies, matchfn, props): +def _show(self, ctx, copies, matchfn, hunksfilterfn, props): '''show a single changeset or file revision''' rev = ctx.rev() if rev is None: @@ -1884,7 +1889,7 @@ class changeset_templater(changeset_prin self.footer += templater.stringify(self.t(self._parts['docfooter'])) return super(changeset_templater, self).close() -def _show(self, ctx, copies, matchfn, props): +def _show(self, ctx,
[PATCH 2 of 4 v4] diff: also yield file context objects in patch.trydiff()
# HG changeset patch # User Denis Laxalde# Date 1507231208 -7200 # Thu Oct 05 21:20:08 2017 +0200 # Node ID c73893dd6cfb5693029f5d9dcf1d537197b40a4a # Parent 73dcd7f479a2481be007de11b03e834aec334ffd # EXP-Topic followlines-cli diff: also yield file context objects in patch.trydiff() And retrieve them in patch.diffhunks(). We'll use these in forthcoming changesets to filter diff hunks by line range. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -479,7 +479,7 @@ def diffs(web, tmpl, ctx, basectx, files parity = paritygen(web.stripecount) diffhunks = patch.diffhunks(repo, node1, node2, m, opts=diffopts) -for blockno, (header, hunks) in enumerate(diffhunks, 1): +for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1): if style != 'raw': header = header[1:] lines = [h + '\n' for h in header] diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2319,10 +2319,11 @@ def diff(repo, node1=None, node2=None, m copy, if not empty, should contain mappings {dst@y: src@x} of copy information.''' -for hdr, hunks in diffhunks(repo, node1=node1, node2=node2, match=match, -changes=changes, opts=opts, -losedatafn=losedatafn, prefix=prefix, -relroot=relroot, copy=copy): +for fctx1, fctx2, hdr, hunks in diffhunks( +repo, node1=node1, node2=node2, +match=match, changes=changes, opts=opts, +losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, +): text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) if hdr and (text or len(hdr) > 1): yield '\n'.join(hdr) + '\n' @@ -2687,7 +2688,7 @@ def trydiff(repo, revs, ctx1, ctx2, modi content2, date2, path1, path2, opts=opts) header.extend(uheaders) -yield header, hunks +yield fctx1, fctx2, header, hunks def diffstatsum(stats): maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
phillco added a comment. Whoops, sorry, I forgot to run tests on the most recent version. Will fix & resend. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1122 To: phillco, #hg-reviewers, durin42 Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] show: use labelcset() template alias for work (and stack) views
# HG changeset patch # User Denis Laxalde# Date 1508264743 -7200 # Tue Oct 17 20:25:43 2017 +0200 # Node ID 9af9aa26a601cf26aca9320d0384857fe09fa28b # Parent 68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac # EXP-Topic show-obs-info show: use labelcset() template alias for work (and stack) views By reusing labelcset() template alias from map-cmdline.default we can now display obsolescence information in `hg show work/stack`. diff --git a/mercurial/templates/map-cmdline.show b/mercurial/templates/map-cmdline.show --- a/mercurial/templates/map-cmdline.show +++ b/mercurial/templates/map-cmdline.show @@ -1,8 +1,8 @@ # TODO there are a few deficiencies in this file: # * The "namespace" of the labels needs to be worked out. We currently # piggyback on existing values so color works. -# * Obsolescence isn't considered for node labels. See _cset_labels in -# map-cmdline.default. + +%include map-cmdline.default [templates] showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, nodelen)}\n' @@ -10,7 +10,7 @@ showbookmarks = '{if(active, "*", " ")} showwork = '{cset_shortnode}{namespaces % cset_namespace} {cset_shortdesc}' showstack = '{showwork}' -cset_shortnode = '{label("log.changeset changeset.{phase}", shortest(node, nodelen))}' +cset_shortnode = '{labelcset(shortest(node, nodelen))}' # Treat branch and tags specially so we don't display "default" or "tip" cset_namespace = '{ifeq(namespace, "branches", names_branches, ifeq(namespace, "tags", names_tags, names_others))}' diff --git a/tests/test-show-work.t b/tests/test-show-work.t --- a/tests/test-show-work.t +++ b/tests/test-show-work.t @@ -234,6 +234,20 @@ Extra namespaces are rendered o 6a75 (r1) commit 2 o 97fc (r0) commit 1 +Obsolescence information appears in labels. + + $ cat >> .hg/hgrc << EOF + > [experimental] + > stabilization=createmarkers + > EOF + $ hg debugobsolete `hg log -r 'desc("commit 2")' -T "{node}"` + obsoleted 1 changesets + $ hg show work --color=debug + @ [log.changeset changeset.draft changeset.unstable instability.orphan|32f3] [log.description|commit 3] + x [log.changeset changeset.draft changeset.obsolete|6a75] [log.description|commit 2] + | + ~ + $ cd .. Prefix collision on hashes increases shortest node length ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1144: directaccess: add support to export and tests to demonstrate things
lothiraldan requested changes to this revision. lothiraldan added a comment. This revision now requires changes to proceed. I'm +1 on the feature. But I have several concerns with the current implementation: - Marking a whole command as readonly or not is too simplistic I'm afraid, we have commands (like phase) that can be readonly or not based on their parameters. I think we need a more fine-grained selection and that commands needs to pass the desired directaccess mode to `scmutil.revrange`. For example, imagine we add a `--reuse-message REV` argument to fold, that to select a revision to use the message from. The usual argument of fold rewrite the changes (so direct access is off). However having a more relax direct access for the --reuse-message make sense. - Putting direct access hashes in pinnedrevs attribute while having the same filter function for all filters could lead to have visible filter excludind the direct accessed hashes when we bust the volatile sets which will require a full cache bust at the next check. Instead, I propose: - To clarify the vocabulary: direct access allow for node explicitly specified to be made visible for the duration of a command. We could call such revisions `visibility exceptions`. To achieve this the `exceptions` need to be excluded from the usual filter applied to the repository during a command. - Put the direct access hashes, not in pinnedrevs but in a separate attribute, maybe with a dedicated API `repo.addvisibilityexception(revs)` that could also be used by rebase and histedit as they already have some exception mechanism. - Keep the new filter name, but with a dedicated filter function (`computehiddenexceptions` for example). The new dedicated function could use the attribute updated by `repo.addvisibilityexception(revs)` to exclude them from the result without ever impacting the `visible` filter. - Makes `scmutil.revrange` accepts a new parameter `visibility_exception_mode` for example which could have 3 values and could be used to replace this condition `if repo and repo.filtername in ['visible-hidden', 'visible-warnhidden']:`: - None, current behavior - `warning`, warns when directly accessed hashes are detected, could be used to replace this condition `if repo.filtername == 'visible-warnhidden':` - `silent`, unhide directly accessed hashed without warning - Now that we can distinguish between warning mode or silent mode, we could use only a single filter, `visible+exceptions` for example, and limit the scope of it with a context manager so consumers could get revisions with exceptions without needing to reset the filter by hand, I have something like this in mind: def my_command(ui, repo, *revs, foo=[]): with repo.allowexception() as repo: ... foorevs = scmutil.revrange(repo, foo, allowexception='warn') ... targetrevs = scmutil.revrange(repo, foo) ... I don't think it's the best API right now, but being able to limit explicitly the "scope" of the new filter would be beneficial for avoiding hard to debug issues and performances regressions. I couldn't find a better API than the context manager + new revrange parameter, if you have ideas please share. This proposal is focused on removing the implicit global state carried by the filter name and pinnedrevs and make the filter change scope more controllable and explicit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1144 To: pulkit, #hg-reviewers, lothiraldan Cc: lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1161: hghave: disable demandimport when chg is running
singhsrb updated this revision to Diff 2940. singhsrb edited the summary of this revision. singhsrb retitled this revision from "hghave: make 'on demand import' unsupported when chg is running" to "hghave: disable demandimport when chg is running". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1161?vs=2936=2940 REVISION DETAIL https://phab.mercurial-scm.org/D1161 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -601,7 +601,8 @@ @check("demandimport", "demandimport enabled") def has_demandimport(): -return os.environ.get('HGDEMANDIMPORT') != 'disable' +# chg disables demandimport intentionally for performance wins. +return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable') @check("py3k", "running with Python 3.x") def has_py3k(): To: singhsrb, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1161: hghave: make 'on demand import' unsupported when chg is running
singhsrb added inline comments. INLINE COMMENTS > quark wrote in hghave.py:604 > It's more accurate saying: > > # chg disables demandimport on purpose > > chg could support demandimport but chooses to disable it for performance win. Yes, that does looks like a better way to put it. I will update the commit message as well to reflect the same. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1161 To: singhsrb, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1161: hghave: make 'on demand import' unsupported when chg is running
quark added inline comments. INLINE COMMENTS > hghave.py:604 > def has_demandimport(): > -return os.environ.get('HGDEMANDIMPORT') != 'disable' > +# chg does not support on demand importing. > +return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != > 'disable') It's more accurate saying: # chg disables demandimport on purpose chg could support demandimport but chooses to disable it for performance win. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1161 To: singhsrb, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1163: tests: move baduisetup() test out of "#if demandimport"
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It no longer depends on demandimport. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1163 AFFECTED FILES tests/test-extension.t CHANGE DETAILS diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -510,6 +510,8 @@ $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) +#endif + Make sure a broken uisetup doesn't globally break hg: $ cat > $TESTTMP/baduisetup.py < def uisetup(ui): @@ -541,8 +543,6 @@ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -#endif - $ cd .. hide outer repo To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1162: tests: make test-extension.t's baduisetup.py test fail even if bdiff exists
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY A mercurial.bdiff module has existed at some point and when I have built at an old version, some .pyc file or something seems to stick around and test-extension.t fails. Let's remove the reference to bdiff and simplify the test. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1162 AFFECTED FILES tests/test-extension.t CHANGE DETAILS diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -512,21 +512,13 @@ Make sure a broken uisetup doesn't globally break hg: $ cat > $TESTTMP/baduisetup.py < from mercurial import ( - > bdiff, - > extensions, - > ) - > - > def blockswrapper(orig, *args, **kwargs): - > return orig(*args, **kwargs) - > > def uisetup(ui): - > extensions.wrapfunction(bdiff, 'blocks', blockswrapper) + > 1/0 > EOF Even though the extension fails during uisetup, hg is still basically usable: $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version - \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re) + *** failed to set up extension baduisetup: integer division or modulo by zero Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information) @@ -538,18 +530,10 @@ Traceback (most recent call last): File "*/mercurial/extensions.py", line *, in _runuisetup (glob) uisetup(ui) -File "$TESTTMP/baduisetup.py", line 10, in uisetup - extensions.wrapfunction(bdiff, 'blocks', blockswrapper) -File "*/mercurial/extensions.py", line *, in wrapfunction (glob) - origfn = getattr(container, funcname) -File "*/hgdemandimport/demandimportpy2.py", line *, in __getattr__ (glob) - self._load() -File "*/hgdemandimport/demandimportpy2.py", line *, in _load (glob) - mod = _hgextimport(_origimport, head, globals, locals, None, level) -File "*/hgdemandimport/demandimportpy2.py", line *, in _hgextimport (glob) - return importfunc(name, globals, *args, **kwargs) - ImportError: No module named (mercurial\.)?bdiff (re) - \*\*\* failed to set up extension baduisetup: No module named (mercurial\.)?bdiff (re) +File "$TESTTMP/baduisetup.py", line 2, in uisetup + 1/0 + ZeroDivisionError: integer division or modulo by zero + *** failed to set up extension baduisetup: integer division or modulo by zero Mercurial Distributed SCM (version *) (glob) (see https://mercurial-scm.org for more information) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1164: extensions: always include traceback when extension setup fails
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I have spent a lot of time debugging extensions that failed to load because we don't include a traceback and I didn't realize I could get traceback for the extension failure with --traceback. Let's just turn them on by default, since it should be rare that the user sees these tracebacks anyway (and if they do, it's not so bad if the extra traceback pushes them a little harder to report the problem). Since we already had a test case with --traceback and one without, I just removed the one with the flag. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1164 AFFECTED FILES mercurial/extensions.py tests/test-extension.t tests/test-flagprocessor.t CHANGE DETAILS diff --git a/tests/test-flagprocessor.t b/tests/test-flagprocessor.t --- a/tests/test-flagprocessor.t +++ b/tests/test-flagprocessor.t @@ -162,8 +162,18 @@ > duplicate=$TESTDIR/flagprocessorext.py > EOF $ hg debugrebuilddirstate + Traceback (most recent call last): +File "*/mercurial/extensions.py", line *, in _runextsetup (glob) + extsetup(ui) +File "*/tests/flagprocessorext.py", line *, in extsetup (glob) + validatehash, +File "*/mercurial/revlog.py", line *, in addflagprocessor (glob) + raise error.Abort(msg) + Abort: cannot register multiple processors on flag '0x8'. *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'. $ hg st 2>&1 | egrep 'cannot register multiple processors|flagprocessorext' +File "*/tests/flagprocessorext.py", line *, in extsetup (glob) + Abort: cannot register multiple processors on flag '0x8'. *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'. File "*/tests/flagprocessorext.py", line *, in b64decode (glob) diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -520,15 +520,6 @@ Even though the extension fails during uisetup, hg is still basically usable: $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version - *** failed to set up extension baduisetup: integer division or modulo by zero - Mercurial Distributed SCM (version *) (glob) - (see https://mercurial-scm.org for more information) - - Copyright (C) 2005-2017 Matt Mackall and others - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version --traceback Traceback (most recent call last): File "*/mercurial/extensions.py", line *, in _runuisetup (glob) uisetup(ui) diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -182,7 +182,7 @@ try: uisetup(ui) except Exception as inst: -ui.traceback() +ui.traceback(force=True) msg = util.forcebytestr(inst) ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) return False @@ -203,7 +203,7 @@ raise extsetup() # old extsetup with no ui argument except Exception as inst: -ui.traceback() +ui.traceback(force=True) msg = util.forcebytestr(inst) ui.warn(_("*** failed to set up extension %s: %s\n") % (name, msg)) return False To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1161: hghave: make 'on demand import' unsupported when chg is running
singhsrb created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Chg does not support on demand import and therefore, it probably makes sense to indicate that the 'on demand import' is unsupported when chg is running. TEST PLAN Ran all the tests. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1161 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -601,7 +601,8 @@ @check("demandimport", "demandimport enabled") def has_demandimport(): -return os.environ.get('HGDEMANDIMPORT') != 'disable' +# chg does not support on demand importing. +return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable') @check("py3k", "running with Python 3.x") def has_py3k(): To: singhsrb, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1160: test-extension: make the test compatible with chg
singhsrb created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This test fails when run with chg. This commit just makes the test chg aware by fixing the output of some of the tests. TEST PLAN Ran the test 'test-extension.t' with and without '--chg' option. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1160 AFFECTED FILES tests/test-extension.t CHANGE DETAILS diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -42,20 +42,22 @@ uisetup called reposetup called for a ui == repo.ui + reposetup called for a (chg !) + ui == repo.ui (chg !) Foo $ cd .. $ hg clone a b - uisetup called + uisetup called (no-chg !) reposetup called for a ui == repo.ui reposetup called for b ui == repo.ui updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg bar - uisetup called + uisetup called (no-chg !) Bar $ echo 'foobar = !' >> $HGRCPATH @@ -67,6 +69,8 @@ uisetup called reposetup called for a ui == repo.ui + reposetup called for a (chg !) + ui == repo.ui (chg !) Foo $ echo 'barfoo = !' >> $HGRCPATH @@ -1525,6 +1529,7 @@ $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc $ hg -R src status reposetup() for $TESTTMP/reposetup-test/src (glob) + reposetup() for $TESTTMP/reposetup-test/src (glob) (chg !) $ hg clone -U src clone-dst1 reposetup() for $TESTTMP/reposetup-test/src (glob) To: singhsrb, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1063: rebase: enable multidest by default
quark added inline comments. INLINE COMMENTS > dlax wrote in rebase.py:645 > Maybe this could be in a `.. container:: verbose` block since it's an > advanced feature? I think the "SRC" feature itself is not that "advanced" and is easy to understand. The problem is the revset for "restack" is long given the expressiveness of today's revsets. So that revset is hidden. It's possible to write short revsets, like: -d _destrebase(SRC) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1063 To: quark, #hg-reviewers, durin42 Cc: dlax, martinvonz, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1159: run-tests: move newline out of colorized message
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The leading newline before "ERROR:" led to an incorrect lexing of the message and the newline got lost. The fixed formatting can be seen in the test case. The reason we didn't notice before was that the bad formatting just led to the loss of a blank line in the test. However, there are other cases where it would be joined with a line saying "Accept this change? [n]" or "Reference output has changed (run again to prompt changes)". REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1159 AFFECTED FILES tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -131,6 +131,7 @@ \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc) bar*bad (glob) \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc) + \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc) ! \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1663,7 +1663,9 @@ self.stream.write('t') else: if not self._options.nodiff: -formatted = '\nERROR: %s output changed\n' % test +self.stream.write('\n') +# Exclude the '\n' from highlighting to lex correctly +formatted = 'ERROR: %s output changed\n' % test self.stream.write(highlightmsg(formatted, self.color)) self.stream.write('!') To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1063: rebase: enable multidest by default
quark added a comment. https://phab.mercurial-scm.org/D1139 changes restack to use revsets. The resulting code is simpler, and no longer do duplicated rebases. From a high level, this feature basically allows some user-invisible logic like rebase source and destination decision to be more user-visible as revsets, so users can investigate them by running `log -r` etc., which seems to be a good thing. > Ultimately, if it's really safe, why keeping the option at all? The feature was implemented by multiple patches. I added the config so in case some of the patches did not land, the incomplete feature is not exposed. Now that all patches are landed. It's time to enable the feature by default. INLINE COMMENTS > dlax wrote in rebase.py:698 > I'd also be very useful to have an example of how to stabilize only the > current stack, but maybe this is unrelated to this changeset. This could be expressed via a complex revset if `predecessors` is in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1063 To: quark, #hg-reviewers, durin42 Cc: dlax, martinvonz, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1158: test-show: make it compatible with chg
quark created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The show extension reads `commands.show.aliasprefix` config in its `extsetup` and that causes issues with chg. This patch adds that config item to chg confighash to solve the issue. TEST PLAN `run-tests.py -l --chg test-show.t` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1158 AFFECTED FILES mercurial/chgserver.py CHANGE DETAILS diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -73,6 +73,10 @@ 'extensions', ] +_configsectionitems = [ +('commands', 'show.aliasprefix'), # show.py reads it in extsetup +] + # sensitive environment variables affecting confighash _envre = re.compile(r'''\A(?: CHGHG @@ -101,6 +105,8 @@ sectionitems = [] for section in _configsections: sectionitems.append(ui.configitems(section)) +for section, item in _configsectionitems: +sectionitems.append(ui.config(section, item)) sectionhash = _hashlist(sectionitems) envitems = [(k, v) for k, v in encoding.environ.iteritems() if _envre.match(k)] To: quark, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 8 of 8 V2] phase: use a binary phase part to push through bundle2 (BC)
On Tue, 2017-10-17 at 11:17 -0400, Augie Fackler wrote: > On Mon, Oct 16, 2017 at 08:23:49PM +0200, Boris Feld wrote: > > # HG changeset patch > > # User Boris Feld> > # Date 1505929086 -7200 > > # Wed Sep 20 19:38:06 2017 +0200 > > # Node ID 76e192debcd8036c6695b56681ca096690322880 > > # Parent 9c084f14df72a2d511d414e0ecf50a086c0a2341 > > # EXP-Topic b2.phases.push > > # Available At https://bitbucket.org/octobus/mercurial-devel/ > > # hg pull https://bitbucket.org/octobus/mercurial-deve > > l/ -r 76e192debcd8 > > phase: use a binary phase part to push through bundle2 (BC) > > Patches 1-7 are queued, with some copyediting on patch 5. If my > comment below on the docstring is right, please follow up with a v3 > of > this? > > Thanks! I just sent the V3 version. Thank you for the copyediting on patch 5, I missed it during my review. > > > > > The part we are using for pull is now used for push too. As we no > > longer use > > pushkey, pushkey hook are no longer triggered. This is an obvious > > backward > > incompatible change. We could artificially trigger the pushkey hook > > within the > > bundle2 part, but this seemed too hacky to me. > > > > An option would be to disable by default this new mechanism for a > > couple of > > versions to help people migrate to `txnclose-phase`. I took the > > liberal and > > optimistic path to just turn it on by default directly. > > > > .. bc:: > > > > Push no longer trigger a pushkey hook when updating phases. Use > > the new > > Nit: triggers, not trigger. > > > `txnclose-phase` and `txnclose-phase` hooks instead. > > (Apply when both server and client use version 4.4 or above). > > Nit: Applies not apply. > > > > > diff --git a/mercurial/exchange.py b/mercurial/exchange.py > > --- a/mercurial/exchange.py > > +++ b/mercurial/exchange.py > > @@ -806,9 +806,26 @@ > > if 'phases' in pushop.stepsdone: > > return > > b2caps = bundle2.bundle2caps(pushop.remote) > > -if 'pushkey' in b2caps: > > +ui = pushop.repo.ui > > + > > +legacyphase = 'phases' in ui.configlist('devel', > > 'legacy.exchange') > > +haspushkey = 'pushkey' in b2caps > > +hasphaseheads = 'heads' in b2caps.get('phases', ()) > > + > > +if hasphaseheads and not legacyphase: > > +_pushb2phaseheads(pushop, bundler) > > +elif haspushkey: > > _pushb2phasespushkey(pushop, bundler) > > > > +def _pushb2phaseheads(pushop, bundler): > > +"""push phase information through a bundle2 - pushkey part""" > > Er - isn't this the non-pushkey flavor? > > > +pushop.stepsdone.add('phases') > > +if pushop.outdatedphases: > > +updates = [[] for p in phases.allphases] > > +updates[0].extend(h.node() for h in pushop.outdatedphases) > > +phasedata = phases.binaryencode(updates) > > +bundler.newpart('phase-heads', data=phasedata) > > + > > def _pushb2phasespushkey(pushop, bundler): > > """push phase information through a bundle2 - pushkey part""" > > pushop.stepsdone.add('phases') > > diff --git a/tests/test-acl.t b/tests/test-acl.t > > --- a/tests/test-acl.t > > +++ b/tests/test-acl.t > > @@ -97,7 +97,7 @@ > > bundle2-output-part: "check:phases" 24 bytes payload > > bundle2-output-part: "check:heads" streamed payload > > bundle2-output-part: "changegroup" (params: 1 mandatory) > > streamed payload > > - bundle2-output-part: "pushkey" (params: 4 mandatory) empty > > payload > > + bundle2-output-part: "phase-heads" 24 bytes payload > > bundle2-input-bundle: with-transaction > > bundle2-input-part: "replycaps" supported > > bundle2-input-part: total payload size 168 > > @@ -117,17 +117,15 @@ > > adding quux/file.py revisions > > added 3 changesets with 3 changes to 3 files > > bundle2-input-part: total payload size 1553 > > - bundle2-input-part: "pushkey" (params: 4 mandatory) supported > > - pushing key for > > "phases:911600dab2ae7a9baff75958b84fe606851ce955" > > + bundle2-input-part: "phase-heads" supported > > + bundle2-input-part: total payload size 24 > > bundle2-input-bundle: 4 parts total > > updating the branch cache > > - bundle2-output-bundle: "HG20", 2 parts total > > + bundle2-output-bundle: "HG20", 1 parts total > > bundle2-output-part: "reply:changegroup" (advisory) (params: 0 > > advisory) empty payload > > - bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty > > payload > > bundle2-input-bundle: no-transaction > > bundle2-input-part: "reply:changegroup" (advisory) (params: 0 > > advisory) supported > > - bundle2-input-part: "reply:pushkey" (params: 0 advisory) > > supported > > - bundle2-input-bundle: 1 parts total > > + bundle2-input-bundle: 0 parts total > > listing keys for "phases" > > repository tip rolled back to revision 0 (undo push) > > 0:6675d58eff77 > > @@ -162,7 +160,7 @@ > > bundle2-output-part: "check:phases" 24 bytes payload > >
[PATCH V3] phase: use a binary phase part to push through bundle2 (BC)
# HG changeset patch # User Boris Feld# Date 1505929086 -7200 # Wed Sep 20 19:38:06 2017 +0200 # Node ID 0505e8dfaf0f62b3532699958ce0d6d62bf1bb0c # Parent 44c4ed4ad0326c6a8ab09b7a27c40a45e67ec1f3 # EXP-Topic b2.phases.push # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 0505e8dfaf0f phase: use a binary phase part to push through bundle2 (BC) The part we are using for pull is now used for push too. As we no longer use pushkey, pushkey hooks are no longer triggered. This is an obvious backward incompatible change. We could artificially trigger the pushkey hook within the bundle2 part, but this seemed too hacky to me. An option would be to disable by default this new mechanism for a couple of versions to help people migrate to `txnclose-phase`. I took the liberal and optimistic path to just turn it on by default directly. .. bc:: Push no longer triggers a pushkey hook when updating phases. Use the new `txnclose-phase` and `txnclose-phase` hooks instead. (Applies when both server and client use version 4.4 or above). diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -806,9 +806,26 @@ if 'phases' in pushop.stepsdone: return b2caps = bundle2.bundle2caps(pushop.remote) -if 'pushkey' in b2caps: +ui = pushop.repo.ui + +legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange') +haspushkey = 'pushkey' in b2caps +hasphaseheads = 'heads' in b2caps.get('phases', ()) + +if hasphaseheads and not legacyphase: +_pushb2phaseheads(pushop, bundler) +elif haspushkey: _pushb2phasespushkey(pushop, bundler) +def _pushb2phaseheads(pushop, bundler): +"""push phase information through a bundle2 - binary part""" +pushop.stepsdone.add('phases') +if pushop.outdatedphases: +updates = [[] for p in phases.allphases] +updates[0].extend(h.node() for h in pushop.outdatedphases) +phasedata = phases.binaryencode(updates) +bundler.newpart('phase-heads', data=phasedata) + def _pushb2phasespushkey(pushop, bundler): """push phase information through a bundle2 - pushkey part""" pushop.stepsdone.add('phases') diff --git a/tests/test-acl.t b/tests/test-acl.t --- a/tests/test-acl.t +++ b/tests/test-acl.t @@ -97,7 +97,7 @@ bundle2-output-part: "check:phases" 24 bytes payload bundle2-output-part: "check:heads" streamed payload bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload - bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload + bundle2-output-part: "phase-heads" 24 bytes payload bundle2-input-bundle: with-transaction bundle2-input-part: "replycaps" supported bundle2-input-part: total payload size 168 @@ -117,17 +117,15 @@ adding quux/file.py revisions added 3 changesets with 3 changes to 3 files bundle2-input-part: total payload size 1553 - bundle2-input-part: "pushkey" (params: 4 mandatory) supported - pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955" + bundle2-input-part: "phase-heads" supported + bundle2-input-part: total payload size 24 bundle2-input-bundle: 4 parts total updating the branch cache - bundle2-output-bundle: "HG20", 2 parts total + bundle2-output-bundle: "HG20", 1 parts total bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload - bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload bundle2-input-bundle: no-transaction bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported - bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported - bundle2-input-bundle: 1 parts total + bundle2-input-bundle: 0 parts total listing keys for "phases" repository tip rolled back to revision 0 (undo push) 0:6675d58eff77 @@ -162,7 +160,7 @@ bundle2-output-part: "check:phases" 24 bytes payload bundle2-output-part: "check:heads" streamed payload bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload - bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload + bundle2-output-part: "phase-heads" 24 bytes payload bundle2-input-bundle: with-transaction bundle2-input-part: "replycaps" supported bundle2-input-part: total payload size 168 @@ -184,17 +182,15 @@ calling hook pretxnchangegroup.acl: hgext.acl.hook acl: changes have source "push" - skipping bundle2-input-part: total payload size 1553 - bundle2-input-part: "pushkey" (params: 4 mandatory) supported - pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955" + bundle2-input-part: "phase-heads" supported + bundle2-input-part: total payload size 24 bundle2-input-bundle: 4 parts total updating the branch cache - bundle2-output-bundle: "HG20", 2 parts total + bundle2-output-bundle: "HG20", 1 parts
Re: [PATCH 7 of 7] configitems: adds a developer warning when accessing undeclared configuration
On 10/17/17 4:27 PM, Augie Fackler wrote: On Mon, Oct 16, 2017 at 06:53:32PM +0200, Boris Feld wrote: # HG changeset patch # User Boris Feld# Date 1508168487 -7200 # Mon Oct 16 17:41:27 2017 +0200 # Node ID 7a2c3832349499f8b00b9db64e6b87ff644faa9d # Parent d64632aed1d71fd2750aca29fe09d8a2e86921cd # EXP-Topic config.register.ready configitems: adds a developer warning when accessing undeclared configuration I've queued patches 1-6. This one I'm inclined to wait until the 4.5 cycle, given how annoyingly invasive it's going to be for third parties. Otherwise there's no released-hg transition window for extensions. What do you think? What about others? Durham, I suspect this will be particularly annoying for y'all? My view is that this will cause a little pain which will cause us to quickly define all of the configs we use, which will be good for us in the long-run. It will be more painful for extensions that don't continuously integrate, but it's only a devel-warn so I feel the pain level is the right balance. I'd be in favor of queuing this and getting the pain over more quickly, myself. Now that all known options are declared, we setup a warning to make sure it will stay this way. We disable the warning in two tests checking other behavior with random options. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -247,6 +247,9 @@ coreconfigitem('devel', 'user.obsmarker', default=None, ) +coreconfigitem('devel', 'warn-config-unknown', +default=None, +) coreconfigitem('diff', 'nodates', default=False, ) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -477,6 +477,10 @@ if item is not None: alternates.extend(item.alias) +else: +msg = ("accessing unregistered config item: '%s.%s'") +msg %= (section, name) +self.develwarn(msg, 2, 'warn-config-unknown') if default is _unset: if item is None: diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t --- a/tests/test-devel-warnings.t +++ b/tests/test-devel-warnings.t @@ -363,6 +363,8 @@ > repo.ui.config('test', 'some', 'foo') > repo.ui.config('test', 'dynamic', 'some-required-default') > repo.ui.config('test', 'dynamic') + > repo.ui.config('test', 'unregistered') + > repo.ui.config('unregistered', 'unregistered') > EOF $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig @@ -372,5 +374,7 @@ devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: specifying a default value for a registered config item: 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: config item requires an explicit default value: 'test.dynamic' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: accessing unregistered config item: 'test.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: accessing unregistered config item: 'unregistered.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) $ cd .. diff --git a/tests/test-trusted.py b/tests/test-trusted.py --- a/tests/test-trusted.py +++ b/tests/test-trusted.py @@ -67,6 +67,13 @@ trusted)) u = uimod.ui.load() +# disable the configuration registration warning +# +# the purpose of this test is to check the old behavior, not to validate the +# behavior from registered item. so we silent warning related to unregisted +# config. +u.setconfig('devel', 'warn-config-unknown', False, 'test') +u.setconfig('devel', 'all-warnings', False, 'test') u.setconfig('ui', 'debug', str(bool(debug))) u.setconfig('ui', 'report_untrusted', str(bool(report))) u.readconfig('.hg/hgrc') @@ -157,6 +164,13 @@ print() print("# read trusted, untrusted, new ui, trusted") u = uimod.ui.load() +# disable the configuration registration warning +# +# the purpose of this test is to check the old behavior, not to validate the +# behavior from registered item. so we silent warning related to unregisted +# config. +u.setconfig('devel', 'warn-config-unknown', False, 'test') +u.setconfig('devel', 'all-warnings', False, 'test') u.setconfig('ui', 'debug', 'on') u.readconfig(filename) u2 = u.copy() diff --git a/tests/test-ui-config.py b/tests/test-ui-config.py --- a/tests/test-ui-config.py +++ b/tests/test-ui-config.py @@ -6,6 +6,15 @@ ) testui = uimod.ui.load() + +# disable the configuration registration warning +# +# the purpose of this test is to check the old behavior, not to validate the +# behavior from registered item. so we silent warning related to unregisted +# config. +testui.setconfig('devel',
Re: [PATCH 7 of 7] configitems: adds a developer warning when accessing undeclared configuration
On Mon, Oct 16, 2017 at 06:53:32PM +0200, Boris Feld wrote: > # HG changeset patch > # User Boris Feld> # Date 1508168487 -7200 > # Mon Oct 16 17:41:27 2017 +0200 > # Node ID 7a2c3832349499f8b00b9db64e6b87ff644faa9d > # Parent d64632aed1d71fd2750aca29fe09d8a2e86921cd > # EXP-Topic config.register.ready > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 7a2c38323494 > configitems: adds a developer warning when accessing undeclared configuration I've queued patches 1-6. This one I'm inclined to wait until the 4.5 cycle, given how annoyingly invasive it's going to be for third parties. Otherwise there's no released-hg transition window for extensions. What do you think? What about others? Durham, I suspect this will be particularly annoying for y'all? > > Now that all known options are declared, we setup a warning to make sure it > will > stay this way. > > We disable the warning in two tests checking other behavior with random > options. > > diff --git a/mercurial/configitems.py b/mercurial/configitems.py > --- a/mercurial/configitems.py > +++ b/mercurial/configitems.py > @@ -247,6 +247,9 @@ > coreconfigitem('devel', 'user.obsmarker', > default=None, > ) > +coreconfigitem('devel', 'warn-config-unknown', > +default=None, > +) > coreconfigitem('diff', 'nodates', > default=False, > ) > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -477,6 +477,10 @@ > > if item is not None: > alternates.extend(item.alias) > +else: > +msg = ("accessing unregistered config item: '%s.%s'") > +msg %= (section, name) > +self.develwarn(msg, 2, 'warn-config-unknown') > > if default is _unset: > if item is None: > diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t > --- a/tests/test-devel-warnings.t > +++ b/tests/test-devel-warnings.t > @@ -363,6 +363,8 @@ >> repo.ui.config('test', 'some', 'foo') >> repo.ui.config('test', 'dynamic', 'some-required-default') >> repo.ui.config('test', 'dynamic') > + > repo.ui.config('test', 'unregistered') > + > repo.ui.config('unregistered', 'unregistered') >> EOF > >$ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" > buggyconfig > @@ -372,5 +374,7 @@ >devel-warn: specifying a default value for a registered config item: > 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) >devel-warn: specifying a default value for a registered config item: > 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) >devel-warn: config item requires an explicit default value: 'test.dynamic' > at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) > + devel-warn: accessing unregistered config item: 'test.unregistered' at: > $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) > + devel-warn: accessing unregistered config item: > 'unregistered.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) > (glob) > >$ cd .. > diff --git a/tests/test-trusted.py b/tests/test-trusted.py > --- a/tests/test-trusted.py > +++ b/tests/test-trusted.py > @@ -67,6 +67,13 @@ > trusted)) > > u = uimod.ui.load() > +# disable the configuration registration warning > +# > +# the purpose of this test is to check the old behavior, not to validate > the > +# behavior from registered item. so we silent warning related to > unregisted > +# config. > +u.setconfig('devel', 'warn-config-unknown', False, 'test') > +u.setconfig('devel', 'all-warnings', False, 'test') > u.setconfig('ui', 'debug', str(bool(debug))) > u.setconfig('ui', 'report_untrusted', str(bool(report))) > u.readconfig('.hg/hgrc') > @@ -157,6 +164,13 @@ > print() > print("# read trusted, untrusted, new ui, trusted") > u = uimod.ui.load() > +# disable the configuration registration warning > +# > +# the purpose of this test is to check the old behavior, not to validate the > +# behavior from registered item. so we silent warning related to unregisted > +# config. > +u.setconfig('devel', 'warn-config-unknown', False, 'test') > +u.setconfig('devel', 'all-warnings', False, 'test') > u.setconfig('ui', 'debug', 'on') > u.readconfig(filename) > u2 = u.copy() > diff --git a/tests/test-ui-config.py b/tests/test-ui-config.py > --- a/tests/test-ui-config.py > +++ b/tests/test-ui-config.py > @@ -6,6 +6,15 @@ > ) > > testui = uimod.ui.load() > + > +# disable the configuration registration warning > +# > +# the purpose of this test is to check the old behavior, not to validate the > +# behavior from registered item. so we silent warning related to unregisted > +# config. > +testui.setconfig('devel', 'warn-config-unknown', False, 'test') > +testui.setconfig('devel', 'all-warnings',
Re: [PATCH 3 of 3] revlog-sparse-read: add a lower-threshold for read block size
On Mon, Oct 16, 2017 at 06:35:50PM +0200, Paul Morelle wrote: > # HG changeset patch > # User Paul Morelle> # Date 1507993541 -7200 > # Sat Oct 14 17:05:41 2017 +0200 > # Node ID cac7666538643b087500c09c757a1b5f28421fbb > # Parent fd6ea10467600ccdfc9f3491ad95da5cdb5b840d > # EXP-Topic optimized-read > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > cac766653864 > revlog-sparse-read: add a lower-threshold for read block size queued, thanks I'm a little nervous about bugs in this area, but it seems simple enough and is behind a config knob so it's easy for us to drop the whole feature in 4.4.1 if it causes problems. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 8 of 8 V2] phase: use a binary phase part to push through bundle2 (BC)
On Tue, Oct 17, 2017 at 03:52:42PM +0200, Boris Feld wrote: > We think that having this series in 4.4 release is quite important. We > added the new 'phases' bundle2 capability and associated pull support > in the 4.4 cycle. Not having push support in the same release (4.4) > means push support will not be covered by the new capability and we'll > have to distinct the two kinds of clients in the future. That is more > cumbersome to manage that we hoped when this series was written. > > Also (but not directly related), we have a 14 patches series that > improves the bookmark exchange by using a binary part (resolving also > the old regression https://bz.mercurial-scm.org/show_bug.cgi?id=5165) > but it depends on this one. > > I'm not sure we would have time to queue it, should I send it if this > one is queued? I'm extremely interested in getting 5165 fixed - how involved are the patches? Maybe give me a link here and I'll see if we should try and get the fix in... > > On Mon, 2017-10-16 at 20:23 +0200, Boris Feld wrote: > > # HG changeset patch > > # User Boris Feld> > # Date 1505929086 -7200 > > # Wed Sep 20 19:38:06 2017 +0200 > > # Node ID 76e192debcd8036c6695b56681ca096690322880 > > # Parent 9c084f14df72a2d511d414e0ecf50a086c0a2341 > > # EXP-Topic b2.phases.push > > # Available At https://bitbucket.org/octobus/mercurial-devel/ > > # hg pull https://bitbucket.org/octobus/mercurial-devel/ > > -r 76e192debcd8 > > phase: use a binary phase part to push through bundle2 (BC) > > > > The part we are using for pull is now used for push too. As we no > > longer use > > pushkey, pushkey hook are no longer triggered. This is an obvious > > backward > > incompatible change. We could artificially trigger the pushkey hook > > within the > > bundle2 part, but this seemed too hacky to me. > > > > An option would be to disable by default this new mechanism for a > > couple of > > versions to help people migrate to `txnclose-phase`. I took the > > liberal and > > optimistic path to just turn it on by default directly. > > > > .. bc:: > > > > Push no longer trigger a pushkey hook when updating phases. Use > > the new > > `txnclose-phase` and `txnclose-phase` hooks instead. > > (Apply when both server and client use version 4.4 or above). > > > > diff --git a/mercurial/exchange.py b/mercurial/exchange.py > > --- a/mercurial/exchange.py > > +++ b/mercurial/exchange.py > > @@ -806,9 +806,26 @@ > > if 'phases' in pushop.stepsdone: > > return > > b2caps = bundle2.bundle2caps(pushop.remote) > > -if 'pushkey' in b2caps: > > +ui = pushop.repo.ui > > + > > +legacyphase = 'phases' in ui.configlist('devel', > > 'legacy.exchange') > > +haspushkey = 'pushkey' in b2caps > > +hasphaseheads = 'heads' in b2caps.get('phases', ()) > > + > > +if hasphaseheads and not legacyphase: > > +_pushb2phaseheads(pushop, bundler) > > +elif haspushkey: > > _pushb2phasespushkey(pushop, bundler) > > > > +def _pushb2phaseheads(pushop, bundler): > > +"""push phase information through a bundle2 - pushkey part""" > > +pushop.stepsdone.add('phases') > > +if pushop.outdatedphases: > > +updates = [[] for p in phases.allphases] > > +updates[0].extend(h.node() for h in pushop.outdatedphases) > > +phasedata = phases.binaryencode(updates) > > +bundler.newpart('phase-heads', data=phasedata) > > + > > def _pushb2phasespushkey(pushop, bundler): > > """push phase information through a bundle2 - pushkey part""" > > pushop.stepsdone.add('phases') > > diff --git a/tests/test-acl.t b/tests/test-acl.t > > --- a/tests/test-acl.t > > +++ b/tests/test-acl.t > > @@ -97,7 +97,7 @@ > > bundle2-output-part: "check:phases" 24 bytes payload > > bundle2-output-part: "check:heads" streamed payload > > bundle2-output-part: "changegroup" (params: 1 mandatory) streamed > > payload > > - bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload > > + bundle2-output-part: "phase-heads" 24 bytes payload > > bundle2-input-bundle: with-transaction > > bundle2-input-part: "replycaps" supported > > bundle2-input-part: total payload size 168 > > @@ -117,17 +117,15 @@ > > adding quux/file.py revisions > > added 3 changesets with 3 changes to 3 files > > bundle2-input-part: total payload size 1553 > > - bundle2-input-part: "pushkey" (params: 4 mandatory) supported > > - pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955" > > + bundle2-input-part: "phase-heads" supported > > + bundle2-input-part: total payload size 24 > > bundle2-input-bundle: 4 parts total > > updating the branch cache > > - bundle2-output-bundle: "HG20", 2 parts total > > + bundle2-output-bundle: "HG20", 1 parts total > > bundle2-output-part: "reply:changegroup" (advisory) (params: 0 > > advisory) empty payload > > - bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty > >
Re: [PATCH 8 of 8 V2] phase: use a binary phase part to push through bundle2 (BC)
On Mon, Oct 16, 2017 at 08:23:49PM +0200, Boris Feld wrote: > # HG changeset patch > # User Boris Feld> # Date 1505929086 -7200 > # Wed Sep 20 19:38:06 2017 +0200 > # Node ID 76e192debcd8036c6695b56681ca096690322880 > # Parent 9c084f14df72a2d511d414e0ecf50a086c0a2341 > # EXP-Topic b2.phases.push > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 76e192debcd8 > phase: use a binary phase part to push through bundle2 (BC) Patches 1-7 are queued, with some copyediting on patch 5. If my comment below on the docstring is right, please follow up with a v3 of this? Thanks! > > The part we are using for pull is now used for push too. As we no longer use > pushkey, pushkey hook are no longer triggered. This is an obvious backward > incompatible change. We could artificially trigger the pushkey hook within the > bundle2 part, but this seemed too hacky to me. > > An option would be to disable by default this new mechanism for a couple of > versions to help people migrate to `txnclose-phase`. I took the liberal and > optimistic path to just turn it on by default directly. > > .. bc:: > >Push no longer trigger a pushkey hook when updating phases. Use the new Nit: triggers, not trigger. >`txnclose-phase` and `txnclose-phase` hooks instead. >(Apply when both server and client use version 4.4 or above). Nit: Applies not apply. > > diff --git a/mercurial/exchange.py b/mercurial/exchange.py > --- a/mercurial/exchange.py > +++ b/mercurial/exchange.py > @@ -806,9 +806,26 @@ > if 'phases' in pushop.stepsdone: > return > b2caps = bundle2.bundle2caps(pushop.remote) > -if 'pushkey' in b2caps: > +ui = pushop.repo.ui > + > +legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange') > +haspushkey = 'pushkey' in b2caps > +hasphaseheads = 'heads' in b2caps.get('phases', ()) > + > +if hasphaseheads and not legacyphase: > +_pushb2phaseheads(pushop, bundler) > +elif haspushkey: > _pushb2phasespushkey(pushop, bundler) > > +def _pushb2phaseheads(pushop, bundler): > +"""push phase information through a bundle2 - pushkey part""" Er - isn't this the non-pushkey flavor? > +pushop.stepsdone.add('phases') > +if pushop.outdatedphases: > +updates = [[] for p in phases.allphases] > +updates[0].extend(h.node() for h in pushop.outdatedphases) > +phasedata = phases.binaryencode(updates) > +bundler.newpart('phase-heads', data=phasedata) > + > def _pushb2phasespushkey(pushop, bundler): > """push phase information through a bundle2 - pushkey part""" > pushop.stepsdone.add('phases') > diff --git a/tests/test-acl.t b/tests/test-acl.t > --- a/tests/test-acl.t > +++ b/tests/test-acl.t > @@ -97,7 +97,7 @@ >bundle2-output-part: "check:phases" 24 bytes payload >bundle2-output-part: "check:heads" streamed payload >bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload > - bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload > + bundle2-output-part: "phase-heads" 24 bytes payload >bundle2-input-bundle: with-transaction >bundle2-input-part: "replycaps" supported >bundle2-input-part: total payload size 168 > @@ -117,17 +117,15 @@ >adding quux/file.py revisions >added 3 changesets with 3 changes to 3 files >bundle2-input-part: total payload size 1553 > - bundle2-input-part: "pushkey" (params: 4 mandatory) supported > - pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955" > + bundle2-input-part: "phase-heads" supported > + bundle2-input-part: total payload size 24 >bundle2-input-bundle: 4 parts total >updating the branch cache > - bundle2-output-bundle: "HG20", 2 parts total > + bundle2-output-bundle: "HG20", 1 parts total >bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) > empty payload > - bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload >bundle2-input-bundle: no-transaction >bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) > supported > - bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported > - bundle2-input-bundle: 1 parts total > + bundle2-input-bundle: 0 parts total >listing keys for "phases" >repository tip rolled back to revision 0 (undo push) >0:6675d58eff77 > @@ -162,7 +160,7 @@ >bundle2-output-part: "check:phases" 24 bytes payload >bundle2-output-part: "check:heads" streamed payload >bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload > - bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload > + bundle2-output-part: "phase-heads" 24 bytes payload >bundle2-input-bundle: with-transaction >bundle2-input-part: "replycaps" supported >bundle2-input-part: total payload size 168 > @@ -184,17 +182,15 @@ >calling hook
D785: context: also consider path conflicts when clearing unknown files
mbthomas added inline comments. INLINE COMMENTS > swhitaker wrote in context.py:1941 > This breaks test-audit-path.t on macOS. In the test "attack /tmp/test", we > call this codepath with f == '/tmp/test'. util.finddirs finds '/tmp', which > on macOS is a symlink to /private/tmp, so L1940 is true and on L1941 we try > to unlink /tmp. > > @mbthomas Is it intentional that we try to unlink symlinks to directories > here? If not, we can fix this with: > > -if wvfs.isfileorlink(p): > +if wvfs.isfileorlink(p) and not wvfs.isdir(p): It's intentional to unlink symlinks, but it should not be doing anything outside the vfs. This is missing a vfs.audit() call. I've created https://phab.mercurial-scm.org/D1157 to fix it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D785 To: mbthomas, #hg-reviewers, ryanmce Cc: swhitaker, ryanmce, kiilerix, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1157: context: audit paths before clearing unknown files and dirs
mbthomas created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Fix regression introduced in https://phab.mercurial-scm.org/D785. In some circumstances, context.clearunknown can be called before the path is audited. Audit the path before deleting any conflicting files. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1157 AFFECTED FILES mercurial/context.py tests/test-audit-path.t CHANGE DETAILS diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -124,8 +124,7 @@ abort: path contains illegal component: ../test (glob) [255] $ cat ../test/file - cat: ../test/file: No such file or directory - [1] + data attack /tmp/test diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1940,6 +1940,7 @@ """ wvfs = self._repo.wvfs f = self._path +wvfs.audit(f) if wvfs.isdir(f) and not wvfs.islink(f): wvfs.rmtree(f, forcibly=True) for p in reversed(list(util.finddirs(f))): To: mbthomas, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1156: tests: add test demonstrating regression in path audit
mbthomas created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY https://phab.mercurial-scm.org/D785 regressed behavior in path auditing: files can be deleted if they have a path that conflicts with a filename from a malicious remote or bundle. This test demonstrates the problem - the file should not have been deleted. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1156 AFFECTED FILES tests/test-audit-path.t CHANGE DETAILS diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -118,9 +118,14 @@ $ hg manifest -r3 ../test + $ mkdir ../test + $ echo data > ../test/file $ hg update -Cr3 abort: path contains illegal component: ../test (glob) [255] + $ cat ../test/file + cat: ../test/file: No such file or directory + [1] attack /tmp/test To: mbthomas, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 7 of 7 V3] obsfate: add obsfate to default mapfile
# HG changeset patch # User Boris Feld# Date 1507305216 -7200 # Fri Oct 06 17:53:36 2017 +0200 # Node ID b4e71a220342f65b3c75b534670137e836e3f7b9 # Parent f3a67648b948d83038f4b0fe351a81ee042f814f # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b4e71a220342 obsfate: add obsfate to default mapfile Use the verbosity aware template keyword introduced earlier. It has the nice property of being verbosity dependent but in order to customize the obsfate part, users will need to replace the lobsfate definition from default mapfile with the one using template functions (by copying the one from test-obsmarker- template.t for example). As it's a more advanced use-case, I'm more inclined to have the same code for the {obsfate} keyword, in the changeset printer and in the default mapfile for consistency. But, the definition in default mapfile could be replaced with one based on template filter to obsfate output customization if it is a big need for users. diff --git a/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default --- a/mercurial/templates/map-cmdline.default +++ b/mercurial/templates/map-cmdline.default @@ -2,10 +2,10 @@ # to replace some keywords with 'lkeyword', for 'labelled keyword' [templates] -changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{summary}\n' +changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lobsfate}{summary}\n' changeset_quiet = '{lnode}' -changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lfiles}{lfile_copies_switch}{description}\n' -changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{ltroubles}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n' +changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lobsfate}{lfiles}{lfile_copies_switch}{description}\n' +changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{ltroubles}{lobsfate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n' # File templates lfiles = '{if(files, @@ -76,6 +76,10 @@ status = '{status} {path}\n{if(copy, " {copy}\n")}' +# Obsfate templates, it would be removed once we introduce the obsfate +# template fragment +lobsfate = '{if(obsfate, "{label('log.obsfate', '{obsfate % "obsfate: {fate}\n"}')}")}' + [templatealias] labelcset(expr) = label(separate(" ", "log.changeset", diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -117,7 +117,27 @@ | @ changeset: 1:471f378eab4c |/ user:test |date:Thu Jan 01 00:00:00 1970 + - |obsfate: rewritten using amend as 3:d004c8f274b9 by test2 + |obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 + |summary: A0 + | + o changeset: 0:ea207398892e + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: ROOT + + + $ hg log -G -T "default" + o changeset: 3:d004c8f274b9 + | tag: tip + | parent: 0:ea207398892e + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: A2 + | + | @ changeset: 1:471f378eab4c + |/ user:test + |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 |summary: A0 | o changeset: 0:ea207398892e @@ -264,6 +284,71 @@ |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) o ea207398892e + + $ hg log -G -T "default" --hidden + @ changeset: 3:d004c8f274b9 + | tag: tip + | parent: 0:ea207398892e + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: A2 + | + | x changeset: 2:a468dc9b3633 + |/ parent: 0:ea207398892e + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 3:d004c8f274b9 by test2 + |summary: A1 + | + | x changeset: 1:471f378eab4c + |/ user:test + |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 2:a468dc9b3633 + |summary: A0 + | + o changeset: 0:ea207398892e + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: ROOT + + $ hg log -G -T "default" --hidden -v + @ changeset: 3:d004c8f274b9 + | tag: tip + | parent: 0:ea207398892e + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | files: A0 + | description: + |
[PATCH 5 of 7 V3] obsfate: only display date in verbose mode
# HG changeset patch # User Boris Feld# Date 1507556066 -7200 # Mon Oct 09 15:34:26 2017 +0200 # Node ID a2bbc21a142b192bde003f8df3adb71e13242ea1 # Parent b74d99227666d315c4eb34645f5362e6395ee5e5 # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a2bbc21a142b obsfate: only display date in verbose mode The date is also not that helpful in most cases but we show it in verbose mode. diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -822,15 +822,16 @@ # Date dates = markersdates(markers) -min_date = min(dates) -max_date = max(dates) +if verbose: +min_date = min(dates) +max_date = max(dates) -if min_date == max_date: -fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') -line.append(" (at %s)" % fmtmin_date) -else: -fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') -fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2') -line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date)) +if min_date == max_date: +fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') +line.append(" (at %s)" % fmtmin_date) +else: +fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') +fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2') +line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date)) return "".join(line) diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -100,7 +100,7 @@ o d004c8f274b9 | | @ 471f378eab4c - |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 (between 2001-04-19 04:25 + and 2009-02-13 23:31 +) + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 o ea207398892e $ hg up 'desc(A1)' --hidden @@ -219,18 +219,18 @@ @ d004c8f274b9 | | x a468dc9b3633 - |/ Obsfate: rewritten using amend as 3:d004c8f274b9 (at 2001-04-19 04:25 +) + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:a468dc9b3633 (at 2009-02-13 23:31 +) + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 o ea207398892e $ hg fatelogkw --hidden @ d004c8f274b9 | | x a468dc9b3633 - |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:a468dc9b3633 (at 2009-02-13 23:31 +) + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 o ea207398892e $ hg fatelogkw --hidden -v @@ -394,7 +394,7 @@ o 337fec4d2edc | | x 471597cad322 - |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a (at 1970-01-01 00:00 +) + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a o ea207398892e $ hg fatelogkw --hidden @@ -403,7 +403,7 @@ o 337fec4d2edc | | x 471597cad322 - |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a (at 1970-01-01 00:00 +) + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a o ea207398892e $ hg fatelogkw --hidden -v @@ -594,18 +594,18 @@ @ eb5a0daa2192 | | x 0dec01379d3b - | |Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) + | |Obsfate: rewritten as 3:eb5a0daa2192 | x 471f378eab4c - |/ Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten as 3:eb5a0daa2192 o ea207398892e $ hg fatelogkw --hidden @ eb5a0daa2192 | | x 0dec01379d3b - | |Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) + | |Obsfate: rewritten as 3:eb5a0daa2192 | x 471f378eab4c - |/ Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten as 3:eb5a0daa2192 o ea207398892e $ hg fatelogkw --hidden -v @@ -824,24 +824,24 @@ o 019fadeab383 | | x 65b757b745b9 - |/ Obsfate: rewritten using amend as 4:019fadeab383 (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten using amend as 4:019fadeab383 | @ fdf9bde5129a |/ | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:fdf9bde5129a (at 1970-01-01 00:00 +) - | Obsfate: rewritten using amend as 3:65b757b745b9 (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten using amend as 2:fdf9bde5129a + | Obsfate: rewritten using amend as 3:65b757b745b9 o ea207398892e $ hg fatelogkw --hidden o 019fadeab383 | | x 65b757b745b9 - |/ Obsfate: rewritten using amend as 4:019fadeab383 (at 1970-01-01 00:00 +) +
[PATCH 4 of 7 V3] obsfate: filter out current user if not in verbose
# HG changeset patch # User Boris Feld# Date 1507556052 -7200 # Mon Oct 09 15:34:12 2017 +0200 # Node ID b74d99227666d315c4eb34645f5362e6395ee5e5 # Parent fc484d70e64944dc3e918efdca08ec0ca8466c4d # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b74d99227666 obsfate: filter out current user if not in verbose Obsolescence is sometimes used only locally so the obs-marker users is always the same. Showing the user in this case does not bring much values. In the case where multiple users rewrite the commit, display the full list of users. Also show all users in verbose mode. diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -788,6 +788,10 @@ """ Build a obsfate string for a single successorset using all obsfate related function defined in obsutil """ +quiet = ui.quiet +verbose = ui.verbose +normal = not verbose and not quiet + line = [] # Verb @@ -805,8 +809,14 @@ # Users users = markersusers(markers) +# Filter out current user in not verbose mode to reduce amount of +# information +if not verbose: +currentuser = ui.username(acceptempty=True) +if len(users) == 1 and currentuser in users: +users = None -if users: +if (verbose or normal) and users: line.append(" by %s" % ", ".join(users)) # Date diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -219,9 +219,9 @@ @ d004c8f274b9 | | x a468dc9b3633 - |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 (at 2001-04-19 04:25 +) | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 (at 2009-02-13 23:31 +) o ea207398892e $ hg fatelogkw --hidden @@ -230,7 +230,7 @@ | x a468dc9b3633 |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 (at 2009-02-13 23:31 +) o ea207398892e $ hg fatelogkw --hidden -v @@ -394,7 +394,7 @@ o 337fec4d2edc | | x 471597cad322 - |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +) + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a (at 1970-01-01 00:00 +) o ea207398892e $ hg fatelogkw --hidden @@ -403,7 +403,7 @@ o 337fec4d2edc | | x 471597cad322 - |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +) + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a (at 1970-01-01 00:00 +) o ea207398892e $ hg fatelogkw --hidden -v @@ -594,18 +594,18 @@ @ eb5a0daa2192 | | x 0dec01379d3b - | |Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + | |Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) | x 471f378eab4c - |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) o ea207398892e $ hg fatelogkw --hidden @ eb5a0daa2192 | | x 0dec01379d3b - | |Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + | |Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) | x 471f378eab4c - |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten as 3:eb5a0daa2192 (at 1970-01-01 00:00 +) o ea207398892e $ hg fatelogkw --hidden -v @@ -824,24 +824,24 @@ o 019fadeab383 | | x 65b757b745b9 - |/ Obsfate: rewritten using amend as 4:019fadeab383 by test (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten using amend as 4:019fadeab383 (at 1970-01-01 00:00 +) | @ fdf9bde5129a |/ | x 471f378eab4c - |/ Obsfate: rewritten using amend as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +) - | Obsfate: rewritten using amend as 3:65b757b745b9 by test (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten using amend as 2:fdf9bde5129a (at 1970-01-01 00:00 +) + | Obsfate: rewritten using amend as 3:65b757b745b9 (at 1970-01-01 00:00 +) o ea207398892e $ hg fatelogkw --hidden o 019fadeab383 | | x 65b757b745b9 - |/ Obsfate: rewritten using amend as 4:019fadeab383 by test (at 1970-01-01 00:00 +) + |/ Obsfate: rewritten using amend as
[PATCH 6 of 7 V3] log: add obsfate by default in changeset printer
# HG changeset patch # User Boris Feld# Date 1507209918 -7200 # Thu Oct 05 15:25:18 2017 +0200 # Node ID f3a67648b948d83038f4b0fe351a81ee042f814f # Parent a2bbc21a142b192bde003f8df3adb71e13242ea1 # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f3a67648b948 log: add obsfate by default in changeset printer Having an obsfate by default in log will be useful for users to understand why they have obsolete and unstable changesets. Obsfate will only be shown for obsolete changesets, which only happens if people opt-in to experimental feature. But when obsolete changeset are visible, it is very useful to understand where they are. Having it in log could be sufficient for most people, so they don't have to learn a new command (like obslog which is itself useful in case of divergences). For example, when pulling and working directory parent become obsolete: $ hg pull ... working directory parent is obsolete! (f936c1697205) This message comes from the Evolve extension. Obsfate would comes handy: $ hg log -G o changeset: 2:6f91013c5136 | tag: tip | parent: 0:4ef7b558f3ec | user:Boris Feld | date:Mon Oct 09 16:00:27 2017 +0200 | summary: A | | @ changeset: 1:f936c1697205 |/ user:Boris Feld |date:Mon Oct 09 16:00:27 2017 +0200 |obsfate: rewritten using amend as 2:6f91013c5136 |summary: -A | o changeset: 0:feb4dd822b8c user:Boris Feld date:Tue Oct 09 16:00:00 2017 +0200 summary: ROOT And once we update, we don't have an obsolete changeset in the log anymore so we don't show obsfate anymore, most users won't see obsfate often if they don't have obsolete changeset often: @ changeset: 2:6f91013c5136 | tag: tip | parent: 0:4ef7b558f3ec | user:Boris Feld | date:Mon Oct 09 16:00:27 2017 +0200 | summary: A | o changeset: 0:feb4dd822b8c user:Boris Feld date:Tue Oct 09 16:00:00 2017 +0200 summary: ROOT diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1665,6 +1665,9 @@ self.ui.write(_("instability: %s\n") % ', '.join(instabilities), label='log.instability') +elif ctx.obsolete(): +self._showobsfate(ctx) + self._exthook(ctx) if self.ui.debugflag: @@ -1713,6 +1716,15 @@ self.showpatch(ctx, matchfn) +def _showobsfate(self, ctx): +obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui) + +if obsfate: +for obsfateline in obsfate: +# i18n: column positioning for "hg log" +self.ui.write(_("obsfate: %s\n") % obsfateline, + label='log.obsfate') + def _exthook(self, ctx): '''empty method used by extension as a hook point ''' diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -535,6 +535,7 @@ tag: tip user:test date:Thu Jan 01 00:00:00 1970 + + obsfate: pruned summary: . changeset: 0:eff892de26ec diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -58,11 +58,13 @@ |/ parent: 0:ea207398892e |user:test |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 3:d004c8f274b9 by test2 |summary: A1 | | x changeset: 1:471f378eab4c |/ user:test |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 2:a468dc9b3633 |summary: A0 | o changeset: 0:ea207398892e @@ -103,6 +105,26 @@ |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 o ea207398892e + + $ hg log -G --config ui.logtemplate= + o changeset: 3:d004c8f274b9 + | tag: tip + | parent: 0:ea207398892e + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: A2 + | + | @ changeset: 1:471f378eab4c + |/ user:test + |date:Thu Jan 01 00:00:00 1970 + + |obsfate: rewritten using amend as 3:d004c8f274b9 by test2 + |summary: A0 + | + o changeset: 0:ea207398892e + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: ROOT + $ hg up 'desc(A1)' --hidden 1 files updated, 0 files merged, 0 files removed, 0
[PATCH 1 of 7 V3] templatekw: introduce obsfate keyword
# HG changeset patch # User Boris Feld# Date 1507218176 -7200 # Thu Oct 05 17:42:56 2017 +0200 # Node ID fc6e8b2484a3eaedd9e4b8ec10f3728b57bfbebe # Parent 68e0bcb903572cb3641c1b1ac11bdcf47d4ff5ac # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fc6e8b2484a3 templatekw: introduce obsfate keyword Introduce an obsfate printer that uses all helpers functions defined in obsutil to get all the obsfate-related data and format a string according to the current format in test-obsmarker-template.t. Then, introduce an obsfate templatekw that uses the obsfateprinter to return a list of strings. The goal is not to replace existing obsfate template functions but to propose a default, good-enough and easily usable obsfate definition for end-users that don't want to customize it. Such output would ultimately get included in the default log output. Here are some output examples for a commit amended: rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +) Next patches will make the output dependent on the verbosity. Exemple of use-cases: For having the obsfate on a single-line between brackets: {if(obsfate, " [{join(obsfate, "; ")}]")} For having the obsfate in several lines: {if(obsfate, "{obsfate % " Obsfate: {fate}\n"}")} diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -783,3 +783,44 @@ if meta.get('operation')) return sorted(operations) + +def obsfateprinter(successors, markers, ui): +""" Build a obsfate string for a single successorset using all obsfate +related function defined in obsutil +""" +line = [] + +# Verb +line.append(successorsetverb(successors)) + +# Operations +operations = markersoperations(markers) +if operations: +line.append(" using %s" % ", ".join(operations)) + +# Successors +if successors: +fmtsuccessors = [successors.joinfmt(succ) for succ in successors] +line.append(" as %s" % ", ".join(fmtsuccessors)) + +# Users +users = markersusers(markers) + +if users: +line.append(" by %s" % ", ".join(users)) + +# Date +dates = markersdates(markers) + +min_date = min(dates) +max_date = max(dates) + +if min_date == max_date: +fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') +line.append(" (at %s)" % fmtmin_date) +else: +fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') +fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2') +line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date)) + +return "".join(line) diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -600,6 +600,24 @@ # rev and node are completely different from changeset's. return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex}) +@templatekeyword('obsfate') +def showobsfate(**args): +""" this function returns a list containing pre-formatted obsfate strings. + +This function will be replaced by templates fragments when we will have +the verbosity templatekw available. +""" +succsandmarkers = showsuccsandmarkers(**args) + +ui = args['ui'] + +values = [] + +for x in succsandmarkers: +values.append(obsutil.obsfateprinter(x['successors'], x['markers'], ui)) + +return showlist("fate", values, args) + def shownames(namespace, **args): """helper method to generate a template keyword for a namespace""" args = pycompat.byteskwargs(args) diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t --- a/tests/test-obsolete-distributed.t +++ b/tests/test-obsolete-distributed.t @@ -16,15 +16,8 @@ > evolution = all > [phases] > publish = False - > [templates] - > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}" - > obsfateverb = "{obsfateverb(successors)}" - > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}" - > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}" - > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}" - > obsfate = "{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}; " > [ui] - > logtemplate= {rev}:{node|short} {desc} {if(succsandmarkers, "[{succsandmarkers % "{obsfate}"}]")}\n + > logtemplate= {rev}:{node|short} {desc}{if(obsfate, " [{join(obsfate, "; ")}]")}\n > EOF Check distributed chain building @@ -63,7 +56,7 @@ | | o 2:7f6b0a6f5c25 c_A1 |/
[PATCH 2 of 7 V3] test: test obfate template keyword in test-obsmarker-template.t
# HG changeset patch # User Boris Feld# Date 1507302949 -7200 # Fri Oct 06 17:15:49 2017 +0200 # Node ID 89093dd3ab72c2b2e3b95f6a69414ab2a174c910 # Parent fc6e8b2484a3eaedd9e4b8ec10f3728b57bfbebe # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 89093dd3ab72 test: test obfate template keyword in test-obsmarker-template.t These test updates are pretty big by themselves so put it in a separate patch for easing the review process. diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -29,6 +29,7 @@ > {if(successorssets, "\n json: {successorssets|json}")}\n' > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers % "{obsfatetempl}"} \n" )}' > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers|json}\n")}' + > fatelogkw = log -G -T '{node|short}\n{if(obsfate, "{obsfate % " Obsfate: {fate}\n"}")}' > EOF Test templates on amended commit @@ -94,6 +95,14 @@ |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 (between 2001-04-19 04:25 + and 2009-02-13 23:31 +); o ea207398892e + + $ hg fatelogkw + o d004c8f274b9 + | + | @ 471f378eab4c + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 (between 2001-04-19 04:25 + and 2009-02-13 23:31 +) + o ea207398892e + $ hg up 'desc(A1)' --hidden 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -202,6 +211,37 @@ |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["operation", "amend"], ["user", "test"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}] o ea207398892e + +Check other fatelog implementations +--- + + $ hg fatelogkw --hidden -q + @ d004c8f274b9 + | + | x a468dc9b3633 + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) + | x 471f378eab4c + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) + o ea207398892e + + $ hg fatelogkw --hidden + @ d004c8f274b9 + | + | x a468dc9b3633 + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) + | x 471f378eab4c + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) + o ea207398892e + + $ hg fatelogkw --hidden -v + @ d004c8f274b9 + | + | x a468dc9b3633 + |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +) + | x 471f378eab4c + |/ Obsfate: rewritten using amend as 2:a468dc9b3633 by test (at 2009-02-13 23:31 +) + o ea207398892e + Test templates with splitted commit === @@ -345,6 +385,37 @@ |/ Obsfate: [{"markers": [["471597cad322d1f659bb169751be9133dad92ef3", ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]}] o ea207398892e +Check other fatelog implementations +--- + + $ hg fatelogkw --hidden -q + @ f257fde29c7a + | + o 337fec4d2edc + | + | x 471597cad322 + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +) + o ea207398892e + + $ hg fatelogkw --hidden + @ f257fde29c7a + | + o 337fec4d2edc + | + | x 471597cad322 + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +) + o ea207398892e + + $ hg fatelogkw --hidden -v + @ f257fde29c7a + | + o 337fec4d2edc + | + | x 471597cad322 + |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +) + o ea207398892e + + Test templates with folded commit = @@ -516,6 +587,36 @@ |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}] o ea207398892e +Check other fatelog implementations +--- + + $ hg fatelogkw --hidden -q + @ eb5a0daa2192 + | + | x 0dec01379d3b + | |Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + | x 471f378eab4c + |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +) + o ea207398892e + + $ hg fatelogkw --hidden + @ eb5a0daa2192 + | + | x 0dec01379d3b + | |Obsfate: rewritten as
[PATCH 3 of 7 V3] ui: add the possibility to returns None as username in ui
# HG changeset patch # User Boris Feld# Date 1507299827 -7200 # Fri Oct 06 16:23:47 2017 +0200 # Node ID fc484d70e64944dc3e918efdca08ec0ca8466c4d # Parent 89093dd3ab72c2b2e3b95f6a69414ab2a174c910 # EXP-Topic obsfatekeyword # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fc484d70e649 ui: add the possibility to returns None as username in ui In a later patch we want to retrieve the current username or None if it isn't defined. Add the acceptempty parameter instead of catching Abort. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -765,13 +765,15 @@ return feature not in exceptions return True -def username(self): +def username(self, acceptempty=False): """Return default username to be used in commits. Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL and stop searching if one of these is set. +If not found and acceptempty is True, returns None. If not found and ui.askusername is True, ask the user, else use ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname". +If no username could be found, raise an Abort error. """ user = encoding.environ.get("HGUSER") if user is None: @@ -780,6 +782,8 @@ user = os.path.expandvars(user) if user is None: user = encoding.environ.get("EMAIL") +if user is None and acceptempty: +return user if user is None and self.configbool("ui", "askusername"): user = self.prompt(_("enter a commit username:"), default=None) if user is None and not self.interactive(): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 08 of 11] configitems: register the full 'merge-tools' config and sub-options
On Mon, 16 Oct 2017 16:00:26 +0200, Boris Feld wrote: > On Fri, 2017-10-13 at 15:37 -0400, Augie Fackler wrote: > > On Fri, Oct 13, 2017 at 07:55:14PM +0200, Boris Feld wrote: > > > # HG changeset patch > > > # User Boris Feld> > > # Date 1507487833 -7200 > > > # Sun Oct 08 20:37:13 2017 +0200 > > > # Node ID 6ad9f6f42f33fe5efb78f76d39c41f28333144d6 > > > # Parent 0824a3519c14d643a81dd4f718846f15045772ec > > > # EXP-Topic config.register.ready > > > # Available At https://bitbucket.org/octobus/mercurial-devel/ > > > # hg pull https://bitbucket.org/octobus/mercurial-deve > > > l/ -r 6ad9f6f42f33 > > > configitems: register the full 'merge-tools' config and sub-options > > > > > > We register the merge-tools config section (which has an arbitrary > > > base config > > > value) and the possible sub-attribute. The sub-attribute has to be > > > registered > > > first or at the same time otherwise the '.*' item would shadow > > > them. > > > > > > diff --git a/mercurial/configitems.py b/mercurial/configitems.py > > > --- a/mercurial/configitems.py > > > +++ b/mercurial/configitems.py > > > @@ -498,6 +498,60 @@ > > > coreconfigitem('merge', 'preferancestor', > > > default=lambda: ['*'], > > > ) > > > +coreconfigitem('merge-tools', '.*', > > > +default=None, > > > +generic=True, > > > +) > > > > Shouldn't this be [^.]*, since a . means a sub-attribute? > > I think . are authorized in merge-tools definitions without meaning a > sub-attribute, so we cannot exclude it from matching. > > > > > > +coreconfigitem('merge-tools', r'.*\.args$', > > > +default="$local $base $other", > > > +generic=True, > > > +priority=-1, > > > +) Maybe it's too late to change, but if the match function were re.search(), we can easily write a suffix match without using greedy .* pattern. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D762: config: backout rename evolution config into stabilization
lothiraldan abandoned this revision. lothiraldan added a comment. I've resend as https://phab.mercurial-scm.org/D1146. I didn't put config directly under experimental but under experimental.evolution. Also I used the exact same configuration option names to make the series easier and more readable. We could always discuss new namespacing and new names later but the hard-work of splitting the config is done in the new series. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D762 To: lothiraldan, #hg-reviewers, quark Cc: quark, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1149: config: use 'experimental.evolution.create-markers'
lothiraldan created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Extract 'experimental.evolution' = createmarkers as 'experimental.evolution.createmarkers'. We keep the new option in the 'experimental.evolution' namespace in order to stay coherent with other options ('experimental.evolution.bundle-obsmarker' and 'experimental.evolution.track-operation') ease the renaming as possibly 'evolution.createmarkers'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1149 AFFECTED FILES tests/test-amend.t tests/test-bisect.t tests/test-bookmarks-pushpull.t tests/test-bundle2-exchange.t tests/test-bundle2-format.t tests/test-cache-abuse.t tests/test-clone.t tests/test-command-template.t tests/test-commandserver.t tests/test-commit-amend.t tests/test-glog.t tests/test-histedit-arguments.t tests/test-histedit-obsolete.t tests/test-lfconvert.t tests/test-log.t tests/test-obsolete-bounds-checking.t tests/test-obsolete-changeset-exchange.t tests/test-obsolete-checkheads.t tests/test-obsolete-divergent.t tests/test-obsolete-tag-cache.t tests/test-obsolete.t tests/test-phases.t tests/test-rebase-brute-force.t tests/test-rebase-obsolete.t tests/test-rebase-partial.t tests/test-revset.t tests/test-revset2.t tests/test-shelve.t tests/test-subrepo-missing.t tests/test-tag.t tests/test-uncommit.t tests/test-update-branches.t CHANGE DETAILS diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t --- a/tests/test-update-branches.t +++ b/tests/test-update-branches.t @@ -473,7 +473,7 @@ > [ui] > logtemplate={rev}:{node|short} {desc|firstline} > [experimental] - > stabilization=createmarkers + > evolution.createmarkers=True > EOF Test no-argument update to a successor of an obsoleted changeset diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -2,7 +2,8 @@ $ cat >> $HGRCPATH < [experimental] - > evolution=createmarkers, allowunstable + > evolution=allowunstable + > evolution.createmarkers=True > [extensions] > uncommit = > drawdag=$TESTDIR/drawdag.py diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -415,7 +415,8 @@ $ cat >> $HGRCPATH << EOF > [experimental] - > stabilization=createmarkers,exchange + > evolution=exchange + > evolution.createmarkers=True > EOF $ hg up e4d483960b9b --quiet $ echo aaa >>a diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t --- a/tests/test-subrepo-missing.t +++ b/tests/test-subrepo-missing.t @@ -76,7 +76,7 @@ > [phases] > publish=False > [experimental] - > stabilization=createmarkers + > evolution.createmarkers=True > EOF check that we can update parent repo with missing (amended) subrepo revision diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -696,7 +696,7 @@ $ cat >> $HGRCPATH << EOF > [experimental] - > stabilization=createmarkers + > evolution.createmarkers=True > EOF $ hg shelve shelved as default diff --git a/tests/test-revset2.t b/tests/test-revset2.t --- a/tests/test-revset2.t +++ b/tests/test-revset2.t @@ -1626,7 +1626,7 @@ $ cd repo1 $ cat <> .hg/hgrc > [experimental] - > stabilization = createmarkers + > evolution.createmarkers=True > EOF $ hg debugdrawdag <<'EOS' diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1794,7 +1794,7 @@ $ cd wdir-hashcollision $ cat <> .hg/hgrc > [experimental] - > stabilization = createmarkers + > evolution.createmarkers=True > EOF $ echo 0 > a $ hg ci -qAm 0 diff --git a/tests/test-rebase-partial.t b/tests/test-rebase-partial.t --- a/tests/test-rebase-partial.t +++ b/tests/test-rebase-partial.t @@ -7,7 +7,8 @@ > drawdag=$TESTDIR/drawdag.py > > [experimental] - > stabilization=createmarkers,allowunstable + > evolution=allowunstable + > evolution.createmarkers=True > > [alias] > tglog = log -G --template "{rev}: {desc}" diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -8,7 +8,8 @@ > [ui] > logtemplate= {rev}:{node|short} {desc|firstline} > [experimental] - > stabilization=createmarkers,allowunstable + > evolution=allowunstable + > evolution.createmarkers=True > [phases] > publish=False > [extensions] diff --git a/tests/test-rebase-brute-force.t b/tests/test-rebase-brute-force.t --- a/tests/test-rebase-brute-force.t +++ b/tests/test-rebase-brute-force.t @@ -3,7 +3,8 @@ > drawdag=$TESTDIR/drawdag.py > bruterebase=$TESTDIR/bruterebase.py > [experimental] - > evolution=createmarkers,allowunstable + >
D1155: config: gather allowdivergence under the evolution namespace
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Grouping all evolution related-config under the experimental.evolution namespace would helps the future migration outside [experimental]. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1155 AFFECTED FILES hgext/rebase.py mercurial/configitems.py mercurial/help/config.txt tests/test-rebase-obsolete.t CHANGE DETAILS diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -826,7 +826,7 @@ orphan: 1 changesets $ hg rebase -s 10 -d 12 abort: this rebase will cause divergences from: 121d9e3bc4c6 - (to force the rebase please set experimental.allowdivergence=True) + (to force the rebase please set experimental.evolution.allowdivergence=True) [255] $ hg log -G @ 14:73568ab6879d bar foo @@ -845,9 +845,9 @@ | o 0:4a2df7238c3b A -With experimental.allowdivergence=True, rebase can create divergence +With experimental.evolution.allowdivergence=True, rebase can create divergence - $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True + $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True rebasing 10:121d9e3bc4c6 "P" rebasing 14:73568ab6879d "bar foo" (tip) $ hg summary diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1707,7 +1707,7 @@ ``rebase`` -- -``allowdivergence`` +``evolution.allowdivergence`` Default to False, when True allow creating divergence when performing rebase of obsolete changesets. diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -297,9 +297,6 @@ coreconfigitem('email', 'reply-to', default=None, ) -coreconfigitem('experimental', 'allowdivergence', -default=False, -) coreconfigitem('experimental', 'archivemetatemplate', default=dynamicdefault, ) @@ -342,6 +339,10 @@ coreconfigitem('experimental', 'evolution', default=list, ) +coreconfigitem('experimental', 'evolution.allowdivergence', +default=False, +alias=[('experimental', 'allowdivergence')] +) coreconfigitem('experimental', 'evolution.allowunstable', default=None, ) diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1075,16 +1075,16 @@ """ # Obsolete node with successors not in dest leads to divergence divergenceok = ui.configbool('experimental', - 'allowdivergence') + 'evolution.allowdivergence') divergencebasecandidates = rebaseobsrevs - rebaseobsskipped if divergencebasecandidates and not divergenceok: divhashes = (str(repo[r]) for r in divergencebasecandidates) msg = _("this rebase will cause " "divergences from: %s") h = _("to force the rebase please set " - "experimental.allowdivergence=True") + "experimental.evolution.allowdivergence=True") raise error.Abort(msg % (",".join(divhashes),), hint=h) def successorrevs(unfi, rev): To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1150: config: use 'experimental.evolution.allowunstable'
lothiraldan created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Extract 'experimental.evolution' = allowunstable as 'experimental.evolution.allowunstable'. We keep the new option in the 'experimental.evolution' namespace in order to stay coherent with other options ('experimental.evolution.bundle-obsmarker' and 'experimental.evolution.track-operation') ease the renaming as possibly 'evolution.allowunstable'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1150 AFFECTED FILES tests/test-amend.t tests/test-check-commit.t tests/test-commit-amend.t tests/test-histedit-arguments.t tests/test-histedit-obsolete.t tests/test-rebase-brute-force.t tests/test-rebase-obsolete.t tests/test-rebase-partial.t tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -2,8 +2,8 @@ $ cat >> $HGRCPATH < [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > [extensions] > uncommit = > drawdag=$TESTDIR/drawdag.py diff --git a/tests/test-rebase-partial.t b/tests/test-rebase-partial.t --- a/tests/test-rebase-partial.t +++ b/tests/test-rebase-partial.t @@ -7,8 +7,8 @@ > drawdag=$TESTDIR/drawdag.py > > [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > > [alias] > tglog = log -G --template "{rev}: {desc}" diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -8,8 +8,8 @@ > [ui] > logtemplate= {rev}:{node|short} {desc|firstline} > [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > [phases] > publish=False > [extensions] diff --git a/tests/test-rebase-brute-force.t b/tests/test-rebase-brute-force.t --- a/tests/test-rebase-brute-force.t +++ b/tests/test-rebase-brute-force.t @@ -3,8 +3,8 @@ > drawdag=$TESTDIR/drawdag.py > bruterebase=$TESTDIR/bruterebase.py > [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > EOF $ init() { > N=`expr ${N:-0} + 1` diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t +++ b/tests/test-histedit-obsolete.t @@ -8,8 +8,8 @@ > [phases] > publish=False > [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > [extensions] > histedit= > rebase= diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t --- a/tests/test-histedit-arguments.t +++ b/tests/test-histedit-arguments.t @@ -496,8 +496,8 @@ $ cat >>$HGRCPATH < [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > EOF $ hg commit --amend -m 'allow this fold' $ hg histedit --continue diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -519,8 +519,8 @@ $ cat >> $HGRCPATH << EOF > [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > EOF Amend with no files changes diff --git a/tests/test-check-commit.t b/tests/test-check-commit.t --- a/tests/test-check-commit.t +++ b/tests/test-check-commit.t @@ -19,4 +19,3 @@ > fi > done - diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -180,8 +180,8 @@ $ cat >> $HGRCPATH < [experimental] - > evolution=allowunstable > evolution.createmarkers=True + > evolution.allowunstable=True > EOF $ hg amend To: lothiraldan, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1154: config: remove stabilization.* aliases
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Stabilization config items were never part of a release, remove them now that we cleaned up the evolution related configuration. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1154 AFFECTED FILES mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -341,7 +341,6 @@ ) coreconfigitem('experimental', 'evolution', default=list, -alias=[('experimental', 'stabilization')], ) coreconfigitem('experimental', 'evolution.allowunstable', default=None, @@ -354,11 +353,9 @@ ) coreconfigitem('experimental', 'evolution.bundle-obsmarker', default=False, -alias=[('experimental', 'stabilization.bundle-obsmarker')], ) coreconfigitem('experimental', 'evolution.track-operation', default=True, -alias=[('experimental', 'stabilization.track-operation')] ) coreconfigitem('experimental', 'maxdeltachainspan', default=-1, To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1148: config: replace experimental.stabilization by experimental.evolution
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We replace 'experimental.stabilization=all' by 'experimental.evolution=true' as we will extract individual config in their own config in later patches. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1148 AFFECTED FILES tests/test-drawdag.t tests/test-obsmarker-template.t tests/test-obsolete-bundle-strip.t tests/test-push-race.t tests/test-rebase-conflicts.t tests/test-rebase-dest.t tests/test-rebase-obsolete.t tests/test-rebase-scenario-global.t tests/test-strip.t tests/testlib/exchange-obsmarker-util.sh CHANGE DETAILS diff --git a/tests/testlib/exchange-obsmarker-util.sh b/tests/testlib/exchange-obsmarker-util.sh --- a/tests/testlib/exchange-obsmarker-util.sh +++ b/tests/testlib/exchange-obsmarker-util.sh @@ -26,7 +26,7 @@ # reduce output changes bundle2-output-capture=True # enable evolution -evolution=all +evolution=true [extensions] # we need to strip some changeset for some test cases diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -1280,7 +1280,7 @@ $ cd $TESTTMP/scmutilcleanup.obsstore $ cat >> .hg/hgrc < [experimental] - > stabilization=all + > evolution=true > stabilization.track-operation=1 > EOF @@ -1322,7 +1322,7 @@ $ cd issue5678 $ cat >> .hg/hgrc < [experimental] - > evolution=all + > evolution=true > EOF $ echo a > a $ hg ci -Aqm a diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t --- a/tests/test-rebase-scenario-global.t +++ b/tests/test-rebase-scenario-global.t @@ -968,7 +968,7 @@ > [extensions] > wraprebase=$TESTTMP/wraprebase.py > [experimental] - > stabilization=all + > evolution=true > EOF $ hg debugdrawdag <<'EOS' diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -735,7 +735,7 @@ | o 0:4a2df7238c3b A - $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.stabilization=all + $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true obsoleted 1 changesets $ hg rebase -d 6 -r "4::" rebasing 4:ff2c4d47b71d "C" @@ -763,7 +763,7 @@ $ hg add nonrelevant $ hg commit -m nonrelevant created new head - $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.stabilization=all + $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true obsoleted 1 changesets $ hg rebase -r . -d 10 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor @@ -886,7 +886,7 @@ $ printf "dummy" > L $ hg add L $ hg commit -m "dummy change" - $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.stabilization=all + $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true obsoleted 1 changesets $ hg log -G -r 16:: @@ -1205,7 +1205,7 @@ equivalents in destination $ hg init rbsrepo && cd rbsrepo $ echo "[experimental]" > .hg/hgrc - $ echo "stabilization=all" >> .hg/hgrc + $ echo "evolution=true" >> .hg/hgrc $ echo "rebaseskipobsolete=on" >> .hg/hgrc $ echo root > root && hg ci -Am root adding root diff --git a/tests/test-rebase-dest.t b/tests/test-rebase-dest.t --- a/tests/test-rebase-dest.t +++ b/tests/test-rebase-dest.t @@ -116,7 +116,7 @@ > maprevset=$TESTTMP/maprevset.py > [experimental] > rebase.multidest=true - > stabilization=all + > evolution=true > EOF $ rebasewithdag() { diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -397,7 +397,7 @@ $ hg update E -q $ echo 3 > B $ hg commit --amend -m E -A B -q - $ hg rebase -r B+D -d . --config experimental.stabilization=all + $ hg rebase -r B+D -d . --config experimental.evolution=true rebasing 1:112478962961 "B" (B) merging B warning: conflicts while merging B! (edit, then use 'hg resolve --mark') @@ -408,7 +408,7 @@ $ hg resolve -m (no more unresolved files) continue: hg rebase --continue - $ hg rebase --continue --config experimental.stabilization=none + $ hg rebase --continue --config experimental.evolution=none rebasing 1:112478962961 "B" (B) rebasing 3:f585351a92f8 "D" (D) warning: orphaned descendants detected, not stripping 112478962961 diff --git a/tests/test-push-race.t b/tests/test-push-race.t --- a/tests/test-push-race.t +++ b/tests/test-push-race.t @@ -108,7 +108,7 @@ > [phases] > publish = no > [experimental] - > stabilization = all + > evolution=true > [alias] > graph = log -G --rev 'sort(all(), "topo")' > EOF diff --git a/tests/test-obsolete-bundle-strip.t
D1152: config: rename stabilization.bundle-obsmarker
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We want to get rid of stabilization.* configuration, back out to the old configuration 'evolution.bundle-obsmarker'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1152 AFFECTED FILES tests/test-obsolete-bundle-strip.t tests/test-obsolete-changeset-exchange.t CHANGE DETAILS diff --git a/tests/test-obsolete-changeset-exchange.t b/tests/test-obsolete-changeset-exchange.t --- a/tests/test-obsolete-changeset-exchange.t +++ b/tests/test-obsolete-changeset-exchange.t @@ -88,7 +88,7 @@ check-that bundle can contain markers: - $ hg bundle --hidden --rev f89bcc95eba5 --base "f89bcc95eba5^" ../f89bcc95eba5-obs.hg --config experimental.stabilization.bundle-obsmarker=1 + $ hg bundle --hidden --rev f89bcc95eba5 --base "f89bcc95eba5^" ../f89bcc95eba5-obs.hg --config experimental.evolution.bundle-obsmarker=1 1 changesets found $ hg debugbundle ../f89bcc95eba5.hg Stream params: {Compression: BZ} diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t --- a/tests/test-obsolete-bundle-strip.t +++ b/tests/test-obsolete-bundle-strip.t @@ -18,7 +18,7 @@ > evolution=true > > # include obsmarkers in bundle - > stabilization.bundle-obsmarker = yes + > evolution.bundle-obsmarker = yes > > [extensions] > # needed for some tests To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1146: config: invert evolution-related configuration aliases
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We want to split the evolution-related configuration and back-out the renaming from evolution.* to stabilization.*. First invert the configuration and aliases, so next changesets will be cleaner. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1146 AFFECTED FILES mercurial/commands.py mercurial/configitems.py mercurial/obsolete.py CHANGE DETAILS diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -102,7 +102,7 @@ """Returns True if the given repository has the given obsolete option enabled. """ -result = set(repo.ui.configlist('experimental', 'stabilization')) +result = set(repo.ui.configlist('experimental', 'evolution')) if 'all' in result: return True @@ -1043,7 +1043,7 @@ # Operation metadata handling useoperation = repo.ui.configbool('experimental', -'stabilization.track-operation') +'evolution.track-operation') if useoperation and operation: metadata['operation'] = operation diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -339,6 +339,18 @@ coreconfigitem('experimental', 'editortmpinhg', default=False, ) +coreconfigitem('experimental', 'evolution', +default=list, +alias=[('experimental', 'stabilization')], +) +coreconfigitem('experimental', 'evolution.bundle-obsmarker', +default=False, +alias=[('experimental', 'stabilization.bundle-obsmarker')], +) +coreconfigitem('experimental', 'evolution.track-operation', +default=True, +alias=[('experimental', 'stabilization.track-operation')] +) coreconfigitem('experimental', 'maxdeltachainspan', default=-1, ) @@ -348,18 +360,6 @@ coreconfigitem('experimental', 'nonnormalparanoidcheck', default=False, ) -coreconfigitem('experimental', 'stabilization', -default=list, -alias=[('experimental', 'evolution')], -) -coreconfigitem('experimental', 'stabilization.bundle-obsmarker', -default=False, -alias=[('experimental', 'evolution.bundle-obsmarker')], -) -coreconfigitem('experimental', 'stabilization.track-operation', -default=True, -alias=[('experimental', 'evolution.track-operation')] -) coreconfigitem('experimental', 'exportableenviron', default=list, ) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1239,7 +1239,7 @@ contentopts = {'cg.version': cgversion} -if repo.ui.configbool('experimental', 'stabilization.bundle-obsmarker'): +if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'): contentopts['obsolescence'] = True if repo.ui.configbool('experimental', 'bundle-phases'): contentopts['phases'] = True To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1151: config: use 'experimental.evolution.exchange'
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Extract 'experimental.evolution' = exchange as 'experimental.evolution.exchange'. We keep the new option in the 'experimental.evolution' namespace in order to stay coherent with other options ('experimental.evolution.bundle-obsmarker' and 'experimental.evolution.track-operation') ease the renaming as possibly 'evolution.exchange'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1151 AFFECTED FILES tests/test-bookmarks-pushpull.t tests/test-bundle2-exchange.t tests/test-obsolete-bounds-checking.t tests/test-obsolete.t tests/test-tag.t CHANGE DETAILS diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -415,7 +415,7 @@ $ cat >> $HGRCPATH << EOF > [experimental] - > evolution=exchange + > evolution.exchange = True > evolution.createmarkers=True > EOF $ hg up e4d483960b9b --quiet diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -907,7 +907,7 @@ reenable for later test $ echo '[experimental]' >> $HGRCPATH - $ echo "evolution=exchange" >> $HGRCPATH + $ echo "evolution.exchange=True" >> $HGRCPATH $ echo "evolution.createmarkers=True" >> $HGRCPATH $ rm hg.pid access.log errors.log diff --git a/tests/test-obsolete-bounds-checking.t b/tests/test-obsolete-bounds-checking.t --- a/tests/test-obsolete-bounds-checking.t +++ b/tests/test-obsolete-bounds-checking.t @@ -7,8 +7,8 @@ > [extensions] > amend = > [experimental] - > stabilization=exchange > evolution.createmarkers=True + > evolution.exchange=True > EOF $ hg init tmpa $ cd tmpa diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -15,8 +15,8 @@ $ cat >> $HGRCPATH << EOF > [experimental] - > evolution=exchange > evolution.createmarkers=True + > evolution.exchange=True > bundle2-output-capture=True > [ui] > ssh="$PYTHON" "$TESTDIR/dummyssh" diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t +++ b/tests/test-bookmarks-pushpull.t @@ -6,8 +6,8 @@ > [phases] > publish=False > [experimental] - > evolution=exchange > evolution.createmarkers=True + > evolution.exchange=True > EOF $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"' To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1147: config: update evolution-related config
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Update the evolution helpers function to support both old-style configuration and new-style configuration: experimental.evolution=all is renamed into experimental.evolution=true experimental.evolution=createmarkers is renamed into experimental.evolution.createmarkers=true experimental.evolution=allowunstable is renamed into experimental.evolution.allowunstable=true experimental.evolution=exchange is renamed into experimental.evolution.exchange=true We choose to not rename individual config options; keeping the same names would easy the transition for users but it's something that could be easily done in the future. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1147 AFFECTED FILES mercurial/configitems.py mercurial/obsolete.py CHANGE DETAILS diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -98,26 +98,54 @@ allowunstableopt = 'allowunstable' exchangeopt = 'exchange' +def _getoptionvalue(repo, option): +"""Returns True if the given repository has the given obsolete option +enabled. +""" +configkey = 'evolution.%s' % option +newconfig = repo.ui.configbool('experimental', configkey) + +# Return the value only if defined +if newconfig is not None: +return newconfig + +# Fallback on generic option +try: +return repo.ui.configbool('experimental', 'evolution') +except (error.ConfigError, AttributeError): +# Fallback on old-fashion config +# inconsistent config: experimental.evolution +result = set(repo.ui.configlist('experimental', 'evolution')) + +if 'all' in result: +return True + +# For migration purposes, temporarily return true if the config hasn't +# been set but _enabled is true. +if len(result) == 0 and _enabled: +return True + +# Temporary hack for next check +newconfig = repo.ui.config('experimental', 'evolution.createmarkers') +if newconfig: +result.add('createmarkers') + +return option in result + def isenabled(repo, option): """Returns True if the given repository has the given obsolete option enabled. """ -result = set(repo.ui.configlist('experimental', 'evolution')) -if 'all' in result: -return True - -# For migration purposes, temporarily return true if the config hasn't been -# set but _enabled is true. -if len(result) == 0 and _enabled: -return True +createmarkersvalue = _getoptionvalue(repo, createmarkersopt) +unstabluevalue = _getoptionvalue(repo, allowunstableopt) +exchangevalue = _getoptionvalue(repo, exchangeopt) # createmarkers must be enabled if other options are enabled -if ((allowunstableopt in result or exchangeopt in result) and -not createmarkersopt in result): +if ((unstabluevalue or exchangevalue) and not createmarkersvalue): raise error.Abort(_("'createmarkers' obsolete option must be enabled " - "if other obsolete options are enabled")) +"if other obsolete options are enabled")) -return option in result +return _getoptionvalue(repo, option) ### obsolescence marker flag diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -343,6 +343,15 @@ default=list, alias=[('experimental', 'stabilization')], ) +coreconfigitem('experimental', 'evolution.allowunstable', +default=None, +) +coreconfigitem('experimental', 'evolution.createmarkers', +default=None, +) +coreconfigitem('experimental', 'evolution.exchange', +default=None, +) coreconfigitem('experimental', 'evolution.bundle-obsmarker', default=False, alias=[('experimental', 'stabilization.bundle-obsmarker')], To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1145: templater: use pycompat.sysbytes to bytes-ify some __name__ attrs
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Spotted by yuya in review of https://phab.mercurial-scm.org/rHGe87e62b7fc0bf6debd4db89e3a902eafb97dcb98. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1145 AFFECTED FILES mercurial/templater.py CHANGE DETAILS diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -427,9 +427,10 @@ sym = findsymbolicname(arg) if sym: msg = (_("template filter '%s' is not compatible with keyword '%s'") - % (filt.__name__.encode('ascii'), sym)) + % (pycompat.sysbytes(filt.__name__), sym)) else: -msg = _("incompatible use of template filter '%s'") % filt.__name__ +msg = _("incompatible use of template filter '%s'") % ( +pycompat.sysbytes(filt.__name__)) raise error.Abort(msg) def buildmap(exp, context): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1099: dagutil: use a listcomp instead of a map()
durin42 added a comment. Oh, I always forget maplist() exists. Probably doesn't matter for this case. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1099 To: durin42, #hg-reviewers, ryanmce Cc: yuja, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1099: dagutil: use a listcomp instead of a map()
yuja added a comment. I have no preference, but pycompat.maplist() could be used. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1099 To: durin42, #hg-reviewers, ryanmce Cc: yuja, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink
durin42 added a comment. No, that sounds fair, Phil should resend (as a new differential ID) when the issue is sorted. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1122 To: phillco, #hg-reviewers, durin42 Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1136: templatefilters: defend against evil unicode strs in json filter
durin42 updated this revision to Diff 2917. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1136?vs=2886=2917 REVISION DETAIL https://phab.mercurial-scm.org/D1136 AFFECTED FILES mercurial/templatefilters.py CHANGE DETAILS diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -233,6 +233,13 @@ return pycompat.bytestr(obj) elif isinstance(obj, bytes): return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid) +elif isinstance(obj, str): +# This branch is unreachable on Python 2, because bytes == str +# and we'll return in the next-earlier block in the elif +# ladder. On Python 3, this helps us catch bugs before they +# hurt someone. +raise error.ProgrammingError( +r'Mercurial only does output with bytes on Python 3: %r' % obj) elif util.safehasattr(obj, 'keys'): out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), json(v, paranoid)) To: durin42, #hg-reviewers, yuja Cc: yuja, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
durin42 updated this revision to Diff 2916. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1133?vs=2883=2916 REVISION DETAIL https://phab.mercurial-scm.org/D1133 AFFECTED FILES contrib/clang-format-blacklist tests/test-check-clang-format.t CHANGE DETAILS diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t new file mode 100644 --- /dev/null +++ b/tests/test-check-clang-format.t @@ -0,0 +1,10 @@ +#require clang-format test-repo + + $ . "$TESTDIR/helpers-testrepo.sh" + + $ cd "$TESTDIR"/.. + $ for f in `testrepohg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do + > clang-format --style file $f > $f.formatted + > cmp $f $f.formatted || diff -u $f $f.formatted + > rm $f.formatted + > done diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist new file mode 100644 --- /dev/null +++ b/contrib/clang-format-blacklist @@ -0,0 +1,70 @@ +# Files that just need to be migrated to the formatter. +# Do not add new files here! +contrib/chg/chg.c +contrib/chg/hgclient.c +contrib/chg/hgclient.h +contrib/chg/procutil.c +contrib/chg/procutil.h +contrib/chg/util.c +contrib/chg/util.h +contrib/hgsh/hgsh.c +mercurial/cext/base85.c +mercurial/cext/bdiff.c +mercurial/cext/charencode.c +mercurial/cext/charencode.h +mercurial/cext/diffhelpers.c +mercurial/cext/dirs.c +mercurial/cext/manifest.c +mercurial/cext/mpatch.c +mercurial/cext/osutil.c +mercurial/cext/parsers.c +mercurial/cext/pathencode.c +mercurial/cext/revlog.c +# Vendored code that we should never format: +contrib/python-zstandard/c-ext/bufferutil.c +contrib/python-zstandard/c-ext/compressiondict.c +contrib/python-zstandard/c-ext/compressionparams.c +contrib/python-zstandard/c-ext/compressionwriter.c +contrib/python-zstandard/c-ext/compressobj.c +contrib/python-zstandard/c-ext/compressor.c +contrib/python-zstandard/c-ext/compressoriterator.c +contrib/python-zstandard/c-ext/constants.c +contrib/python-zstandard/c-ext/decompressionwriter.c +contrib/python-zstandard/c-ext/decompressobj.c +contrib/python-zstandard/c-ext/decompressor.c +contrib/python-zstandard/c-ext/decompressoriterator.c +contrib/python-zstandard/c-ext/frameparams.c +contrib/python-zstandard/c-ext/python-zstandard.h +contrib/python-zstandard/zstd.c +contrib/python-zstandard/zstd/common/bitstream.h +contrib/python-zstandard/zstd/common/entropy_common.c +contrib/python-zstandard/zstd/common/error_private.c +contrib/python-zstandard/zstd/common/error_private.h +contrib/python-zstandard/zstd/common/fse.h +contrib/python-zstandard/zstd/common/fse_decompress.c +contrib/python-zstandard/zstd/common/huf.h +contrib/python-zstandard/zstd/common/mem.h +contrib/python-zstandard/zstd/common/pool.c +contrib/python-zstandard/zstd/common/pool.h +contrib/python-zstandard/zstd/common/threading.c +contrib/python-zstandard/zstd/common/threading.h +contrib/python-zstandard/zstd/common/xxhash.c +contrib/python-zstandard/zstd/common/xxhash.h +contrib/python-zstandard/zstd/common/zstd_common.c +contrib/python-zstandard/zstd/common/zstd_errors.h +contrib/python-zstandard/zstd/common/zstd_internal.h +contrib/python-zstandard/zstd/compress/fse_compress.c +contrib/python-zstandard/zstd/compress/huf_compress.c +contrib/python-zstandard/zstd/compress/zstd_compress.c +contrib/python-zstandard/zstd/compress/zstd_opt.h +contrib/python-zstandard/zstd/compress/zstdmt_compress.c +contrib/python-zstandard/zstd/compress/zstdmt_compress.h +contrib/python-zstandard/zstd/decompress/huf_decompress.c +contrib/python-zstandard/zstd/decompress/zstd_decompress.c +contrib/python-zstandard/zstd/dictBuilder/cover.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.h +contrib/python-zstandard/zstd/dictBuilder/zdict.c +contrib/python-zstandard/zstd/dictBuilder/zdict.h +contrib/python-zstandard/zstd/zstd.h +hgext/fsmonitor/pywatchman/bser.c To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
durin42 added inline comments. INLINE COMMENTS > ryanmce wrote in test-check-clang-format.t:1 > This test fails for me with errors about lz4revlog. > > It feels like what we need here is a change similar to > https://phab.mercurial-scm.org/rHG6c113a7dec52be38927b16962282ea660de0b03c, > where we use the system hg to examine the local repository. Please reuse the > `syshg` function here. Derp, this is done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1096: releasenotes: make the import of fuzzywuzzy optional
This revision was automatically updated to reflect the committed changes. Closed by commit rHG44bd29168d14: releasenotes: make the import of fuzzywuzzy optional (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1096?vs=2830=2912 REVISION DETAIL https://phab.mercurial-scm.org/D1096 AFFECTED FILES hgext/releasenotes.py CHANGE DETAILS diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -218,7 +218,12 @@ """ Returns false when note fragment can be merged to existing notes. """ -import fuzzywuzzy.fuzz as fuzz +try: +import fuzzywuzzy.fuzz as fuzz +fuzz.token_set_ratio +except ImportError: +return True + merge = True for bullet in existingnotes: score = fuzz.token_set_ratio(incoming_str, bullet) To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1097: releasenotes: don't abort is there is a bad formatted entry for releasenotes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa542ad320adb: releasenotes: dont abort is there is a bad formatted entry for releasenotes (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1097?vs=2833=2913 REVISION DETAIL https://phab.mercurial-scm.org/D1097 AFFECTED FILES hgext/releasenotes.py CHANGE DETAILS diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -24,6 +24,7 @@ config, error, minirst, +node, registrar, scmutil, util, @@ -325,9 +326,8 @@ # TODO consider using title as paragraph for more concise notes. if not paragraphs: -raise error.Abort(_('could not find content for release note ' -'%s') % directive) - +repo.ui.warn(_("error parsing releasenotes for revision: " + "'%s'\n") % node.hex(ctx.node())) if title: notes.addtitleditem(directive, title, paragraphs) else: To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel