[PATCH] grep: restore usage of --include/--exclude options
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1706834135 18000 # Thu Feb 01 19:35:35 2024 -0500 # Node ID e9a040016017d5cd001119c4aff23d4ce343e572 # Parent 99869dcf3ba06679d73db591a87e739d035770be grep: restore usage of --include/--exclude options The refactor in 4a73df6eb67d accidentally forgot to transform the opts argument for walkopts into a byteskwargs. This resulted in its options being ignored. In particular, the -X/-I pair of options was missing. A simple fix restores its usage. Tests included, of course. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3680,7 +3680,7 @@ def grep(ui, repo, pattern, *pats, **opt wopts = logcmdutil.walkopts( pats=pats, -opts=opts, +opts=pycompat.byteskwargs(opts), revspec=opts['rev'], include_pats=opts['include'], exclude_pats=opts['exclude'], diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -525,6 +525,23 @@ Test wdir port2:2147483647:deport port2:2147483647:wport +Testing include/exclude + + $ hg cp port tort + $ hg grep port -X tort + port:export + port:vaportight + port:import/export + port2:export + port2:vaportight + port2:import/export + port2:deport + port2:wport + $ hg grep port -I tort + tort:export + tort:vaportight + tort:import/export + $ cd .. $ hg init t2 $ cd t2 ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] dispatch: properly import custom debugger
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1696362635 14400 # Tue Oct 03 15:50:35 2023 -0400 # Node ID 1ace547f92f232363f54a6759f3005fc6cb21157 # Parent 752c5a5b73c687588ad0f52a7d9d3e0242709a06 dispatch: properly import custom debugger The __import__ command takes strings, not bytestrings. I'm probably the only person who ever used this feature, but I'd much rather debug hg with pudb than with pdb. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -413,7 +413,7 @@ def _runcatch(req): # debugging has been requested with demandimport.deactivated(): try: -debugmod = __import__(debugger) +debugmod = __import__(debugger.decode('utf8')) except ImportError: pass # Leave debugmod = pdb ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] histedit: fix diff colors
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1666906442 14400 # Thu Oct 27 17:34:02 2022 -0400 # Node ID 28cad0a7eb26a3bb0edd4623d1ec1c9169eb49e2 # Parent dd42156b6441f6b8356100b4228fa16fbf95f669 histedit: fix diff colors The problem here is that indexing a bytestring gives you integers, not chars, so the comparison to b'+' ends up being wrong. We don't really have a way to test curses output, so no tests to verify the correctness of this behaviour. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1427,11 +1427,11 @@ pgup/K: move patch up, pgdn/J: move patc for y in range(0, length): line = output[y] if diffcolors: -if line and line[0] == b'+': +if line.startswith(b'+'): win.addstr( y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE) ) -elif line and line[0] == b'-': +elif line.startswith(b'-'): win.addstr( y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE) ) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] histedit: fix diff colors
On Thu, 2022-10-27 at 17:37 -0400, Jordi Gutiérrez Hermoso wrote: > On Tue, 2022-10-25 at 21:48 +0200, Joerg Sonnenberger wrote: > > Do we still need the "line and" part of the check? > > Good call, no longer necessary. Will fix in v2, along with a test. Wait, do we have a way to test curses output? ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] histedit: fix diff colors
On Tue, 2022-10-25 at 21:48 +0200, Joerg Sonnenberger wrote: > Do we still need the "line and" part of the check? Good call, no longer necessary. Will fix in v2, along with a test. ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] histedit: fix diff colors
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 145456 14400 # Mon Oct 24 17:04:16 2022 -0400 # Node ID 5287d8898362935f06b482b236ca6ba948c6850d # Parent f68d285158b21d7d13c2a70c8db85e83a83ee392 histedit: fix diff colors I don't know what was up here, but seems like checking for the first byte isn't the same thing as "startswith", so the colours in chistedit diffs were broken. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1428,11 +1428,11 @@ pgup/K: move patch up, pgdn/J: move patc for y in range(0, length): line = output[y] if diffcolors: -if line and line[0] == b'+': +if line and line.startswith(b'+'): win.addstr( y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE) ) -elif line and line[0] == b'-': +elif line and line.startswith(b'-'): win.addstr( y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE) ) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] help: properly document the default pattern
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550269232 18000 # Fri Feb 15 17:20:32 2019 -0500 # Node ID e5b62cbab03e443841b23a333aac035ad3987fbf # Parent d3ec8201610485fa8bfda40771869ae67bfc6404 help: properly document the default pattern The default isn't to glob. It's relpath, which does no globbing at all. Thus most commands and options like -X/-I and hg files require `glob:` in front of them to actually do any globbing. I think long ago the default was to glob, but that hasn't been true for a long time. diff --git a/mercurial/helptext/patterns.txt b/mercurial/helptext/patterns.txt --- a/mercurial/helptext/patterns.txt +++ b/mercurial/helptext/patterns.txt @@ -1,8 +1,10 @@ Mercurial accepts several notations for identifying one or more files at a time. -By default, Mercurial treats filenames as shell-style extended glob -patterns. +By default, Mercurial treats filenames verbatim without pattern +matching, relative to the current working directory. Note that your +system shell might perform pattern matching of its own before passing +filenames into Mercurial. Alternate pattern notations must be specified explicitly. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] largefiles: properly pass kwargs into url.open
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1612475986 18000 # Thu Feb 04 16:59:46 2021 -0500 # Node ID fee215d5eb63abf93c50de4355fbd46123f50cba # Parent 95b276283b671cd835a2a0918f4297eb2baab425 largefiles: properly pass kwargs into url.open The url.open function has acquired a lot of kwargs over the years. When running `hg import http://example.com/hg/diff/1`, since at least a708e1e4d7a8 in March, 2018, the calling sites for url.open try to pass a `sendaccept` parameter that largefiles' override doesn't accept. Currently that stack traces something like this: Traceback (most recent call last): File "/tmp/hgtests.sv744r5t/install/bin/hg", line 59, in dispatch.run() File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 143, in run status = dispatch(req) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 245, in dispatch status = _rundispatch(req) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 289, in _rundispatch ret = _runcatch(req) or 0 File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 465, in _runcatch return _callcatch(ui, _runcatchfunc) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 475, in _callcatch return scmutil.callcatch(ui, func) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/scmutil.py", line 155, in callcatch return func() File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 455, in _runcatchfunc return _dispatch(req) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 1259, in _dispatch lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 913, in runcommand ret = _runcommand(ui, options, cmd, d) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 1270, in _runcommand return cmdfunc() File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/dispatch.py", line 1256, in d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/util.py", line 1867, in check return func(*args, **kwargs) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/commands.py", line 4184, in import_ patchfile = hg.openpath(ui, patchurl, sendaccept=False) File "/tmp/hgtests.sv744r5t/install/lib/python/mercurial/hg.py", line 181, in openpath return url.open(ui, path, sendaccept=sendaccept) TypeError: openlargefile() got an unexpected keyword argument 'sendaccept' So, just accept and pass along any kwargs of the overridden function. diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1853,7 +1853,7 @@ def upgraderequirements(orig, repo): @eh.wrapfunction(urlmod, b'open') -def openlargefile(orig, ui, url_, data=None): +def openlargefile(orig, ui, url_, data=None, **kwargs): if url_.startswith(_lfscheme): if data: msg = b"cannot use data on a 'largefile://' url" @@ -1861,4 +1861,4 @@ def openlargefile(orig, ui, url_, data=N lfid = url_[len(_lfscheme) :] return storefactory.getlfile(ui, lfid) else: -return orig(ui, url_, data=data) +return orig(ui, url_, data=data, **kwargs) diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t --- a/tests/test-hgweb-diffs.t +++ b/tests/test-hgweb-diffs.t @@ -1138,6 +1138,21 @@ test import rev as raw-rev $ cd test1 $ hg import -q --bypass --exact http://localhost:$HGPORT/rev/1 +repeat test above, with largefiles enabled + + $ cd .. + $ rm -r test1 + $ hg clone -r0 test test1 + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + new changesets 0cd96de13884 + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd test1 + $ hg import --config extensions.largefiles= -q --bypass --exact http://localhost:$HGPORT/rev/1 + raw revision with diff block numbers $ killdaemons.py ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] hgweb: fix error in docstring
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 157616 18000 # Thu Dec 12 11:41:28 2019 -0500 # Node ID e89a23f05828dc81d5f9f51994544d89fe7a7c4f # Parent faab1971e30741d00b3d0a44548086e6203beca3 hgweb: fix error in docstring Despite the subtle semantic difference, this sentence really meant to say "overridden", not "overwritten". diff --git a/mercurial/helptext/hgweb.txt b/mercurial/helptext/hgweb.txt --- a/mercurial/helptext/hgweb.txt +++ b/mercurial/helptext/hgweb.txt @@ -61,7 +61,7 @@ The web server has a default style assoc a collection of named templates. Each template is used to render a specific piece of data, such as a changeset or diff. -The style for the current request can be overwritten two ways. First, +The style for the current request can be overridden two ways. First, if ``{command}`` contains a hyphen (``-``), the text before the hyphen defines the style. For example, ``/atom-log`` will render the ``log`` command handler with the ``atom`` style. The second way to set the ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] crecord: rewrite help string to avoid mentioning "crecord"
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1576168650 18000 # Thu Dec 12 11:37:30 2019 -0500 # Node ID faab1971e30741d00b3d0a44548086e6203beca3 # Parent 49fa0b31ee1d84c44eab951f36fb7386e3fced22 crecord: rewrite help string to avoid mentioning "crecord" Despite its heritage, "crecord" is now mostly Mercurial-internal jargon. I find it better to call it "the curses hunk selector". Also slightly rewrote the part about which commands can use it. While I do believe that commit, shelve, and revert are the only commands in core that can use it, Evolve also adds at least amend and uncommit to the list. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1615,12 +1615,13 @@ class curseschunkselector(object): helptext = _( """[press any key to return to the patch-display] -crecord allows you to interactively choose among the changes you have made, -and confirm only those changes you select for further processing by the command -you are running (commit/shelve/revert), after confirming the selected -changes, the unselected changes are still present in your working copy, so you -can use crecord multiple times to split large changes into smaller changesets. -the following are valid keystrokes: +The curses hunk selector allows you to interactively choose among the +changes you have made, and confirm only those changes you select for +further processing by the command you are running (such as commit, +shelve, or revert). After confirming the selected changes, the +unselected changes are still present in your working copy, so you can +use the hunk selector multiple times to split large changes into +smaller changesets. the following are valid keystrokes: x [space] : (un-)select item ([~]/[x] = partly/fully applied) [enter] : (un-)select item and go to next item of same type ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] crecord: repurpose "a" key to toggle all selections (BC)
On Wed, 2019-12-11 at 10:41 +0100, Denis Laxalde wrote: Jordi Gutiérrez Hermoso a écrit : > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso > > # Date 1576015329 18000 > > # Tue Dec 10 17:02:09 2019 -0500 > > # Node ID bd10bc4bdb994b875040c0c58f1c341df66ddd46 > > # Parent ce088b38f92b6d480df2072dc45fb068443758dd > > crecord: repurpose "a" key to toggle all selections (BC) > > > Also this 'amend mode' seems only useful for 'commit --interactive'; > but it's currently also available for other interactive commands > (e.g. 'revert --interactive', which makes no sense) so it's already > weird. Oh, right, I forgot about that. I've amended my commit message to also include this point. > Does "pretty harmless" mean that you can actually toggle back to the > previous selection? Yeah, all selections get flipped. Just hit "a" again to the same state before you flipped them. Honestly, the time I would use this most is when everything is selected so I can start from zero selections. I so very often reach for "A" at the beginning of my hunk selecting but accidentally hit "a" and then I panic 'cause I forget what state it's in, so I just quit the hunk selector and start over again from the command line. > Also, this breaks tests in test-commit-interactive-curses.t (and it'd be > nice to have some new test for the new feature). Oh, oops. I thought I had ran the tests. There, tests fixed, and I wrote a new test for toggling all lines. > > diff --git a/mercurial/crecord.py b/mercurial/crecord.py > > --- a/mercurial/crecord.py > > +++ b/mercurial/crecord.py > > @@ -990,6 +990,13 @@ class curseschunkselector(object): > > self.toggleapply(item) > > self.waslasttoggleallapplied = not self.waslasttoggleallapplied > > > > +def flipselections(self): > > +b"flip all selections" > > Triple " without 'b' would be nicer. Fixed. Thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V2] crecord: remove toggleamend
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1576015629 18000 # Tue Dec 10 17:07:09 2019 -0500 # Node ID 80c8a53c2fcc2aeb510f60fee74ab25b68d59a15 # Parent 5b6b8f718cbfc70202537aa38f0179cb6f8275a8 crecord: remove toggleamend Previous commit removed its only calling site. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1766,32 +1766,6 @@ are you sure you want to review/edit and else: return False -def toggleamend(self, opts, test): -"""Toggle the amend flag. - -When the amend flag is set, a commit will modify the most recently -committed changeset, instead of creating a new changeset. Otherwise, a -new changeset will be created (the normal commit behavior). -""" - -if opts.get(b'amend') is None: -opts[b'amend'] = True -msg = _( -b"Amend option is turned on -- committing the currently " -b"selected changes will not create a new changeset, but " -b"instead update the most recently committed changeset.\n\n" -b"Press any key to continue." -) -elif opts.get(b'amend') is True: -opts[b'amend'] = None -msg = _( -b"Amend option is turned off -- committing the currently " -b"selected changes will create a new changeset.\n\n" -b"Press any key to continue." -) -if not test: -self.confirmationwindow(msg) - def recenterdisplayedarea(self): """ once we scrolled with pg up pg down we can be pointing outside of the ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 V2] crecord: repurpose "a" key to toggle all selections (BC)
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1576015329 18000 # Tue Dec 10 17:02:09 2019 -0500 # Node ID 5b6b8f718cbfc70202537aa38f0179cb6f8275a8 # Parent ce088b38f92b6d480df2072dc45fb068443758dd crecord: repurpose "a" key to toggle all selections (BC) I really don't like "a". I keep accidentally hitting it when I actually want "A", and then I'm suddenly in a state I don't want to be in. There's a big wall of text telling me that I've turned amend mode on or off (which one was I orginally in?), and this seems very useless. If I wanted to amend or not, I would have chosen that from the command-line, not change my mind after I've already started picking hunks apart. Furthermore, for most uses of the hunk selector (revert, uncommit, shelve/unshelve), this amend toggle doesn't make sense. It seems much better to repurpose this key to be a "weaker" version of "A". It toggles all selections. This is pretty harmless if hit accidentally, (can just hit "a" again to toggle everything and undo it), and has immediate visual feedback that something happened: all the x's and blank spaces get switched around. And unlike with amend, the current flipped state is also immediately visible without having to read a wall of text. I'm calling this a BC, however, because somewhere, someone out there has probably really fallen in love with the old use of "a" and will get angry that we took it away. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -990,6 +990,16 @@ class curseschunkselector(object): self.toggleapply(item) self.waslasttoggleallapplied = not self.waslasttoggleallapplied +def flipselections(self): +""" +Flip all selections. Every selected line is unselected and vice +versa. +""" +for header in self.headerlist: +for hunk in header.allchildren(): +for line in hunk.allchildren(): +self.toggleapply(line) + def toggleallbetween(self): """toggle applied on or off for all items in range [lastapplied, current]. """ @@ -1637,7 +1647,7 @@ the following are valid keystrokes: ctrl-l : scroll the selected line to the top of the screen m : edit / resume editing the commit message e : edit the currently selected hunk - a : toggle amend mode, only with commit -i + a : toggle all selections c : confirm selected changes r : review/edit and confirm selected changes q : quit without confirming (no changes will be made) @@ -1913,7 +1923,7 @@ are you sure you want to review/edit and elif keypressed in ["q"]: raise error.Abort(_(b'user quit')) elif keypressed in ['a']: -self.toggleamend(self.opts, test) +self.flipselections() elif keypressed in ["c"]: return True elif keypressed in ["r"]: diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t +++ b/tests/test-commit-interactive-curses.t @@ -95,7 +95,7 @@ Committing only one hunk while aborting - unfold it - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike) - toggle the second hunk -- toggle on and off the amend mode (to check that it toggles off) +- toggle all lines twice (to check that it does nothing) - edit the hunk and quit the editor immediately with non-zero status - commit @@ -193,20 +193,39 @@ Newly added files can be selected with t $ hg st ? testModeCommands -Amend option works +Test toggling all selections works + +- Change one line +- Add an extra line at the end +- Unselect all +- Select the extra line at the end +- Toggle all selections (so the extra line at the is unselected and the modified line is selected) +- Commit + $ echo "hello world" > x - $ hg diff -c . - diff -r a6735021574d -r 2b0e9be4d336 x - --- /dev/nullThu Jan 01 00:00:00 1970 + + $ echo "goodbye world" >> x + $ hg diff + diff -r 2b0e9be4d336 x + --- a/x Thu Jan 01 00:00:00 1970 + +++ b/x Thu Jan 01 00:00:00 1970 + - @@ -0,0 +1,1 @@ - +hello + @@ -1,1 +1,2 @@ + -hello + +hello world + +goodbye world $ cat <testModeCommands + > f + > j + > x + > j + > j + > j + > x > a > c > EOF - $ hg commit -i -m "newly added file" -d "0 0" + $ hg commit -i --amend -m "newly added file" -d "0 0" x saved backup bundle to $TESTTMP/a/.hg
[PATCH 1 of 2] crecord: repurpose "a" key to toggle all selections (BC)
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1576015329 18000 # Tue Dec 10 17:02:09 2019 -0500 # Node ID bd10bc4bdb994b875040c0c58f1c341df66ddd46 # Parent ce088b38f92b6d480df2072dc45fb068443758dd crecord: repurpose "a" key to toggle all selections (BC) I really don't like "a". I keep accidentally hitting it when I actually want "A", and then I'm suddenly in a state I don't want to be in. There's a big wall of text telling me that I've turned amend mode on or off (which one was I orginally in?), and this seems very useless. If I wanted to amend or not, I would have chosen that from the command-line, not change my mind after I've already started picking hunks apart. It seems much better to repurpose this key to be a "weaker" version of "A". It toggles all selections. This is pretty harmless if hit accidentally, (can just hit "a" again to undo it), and has immediate visual feedback that something happened: all the x's and blank spaces get switched around. And unlike with amend, the current flipped state is also immediately visible without having to read a wall of text. I'm calling this a BC, however, because somewhere, someone out there has probably really fallen in love with the old use of "a" and will get angry that we took it away. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -990,6 +990,13 @@ class curseschunkselector(object): self.toggleapply(item) self.waslasttoggleallapplied = not self.waslasttoggleallapplied +def flipselections(self): +b"flip all selections" +for header in self.headerlist: +for hunk in header.allchildren(): +for line in hunk.allchildren(): +self.toggleapply(line) + def toggleallbetween(self): """toggle applied on or off for all items in range [lastapplied, current]. """ @@ -1637,7 +1644,7 @@ the following are valid keystrokes: ctrl-l : scroll the selected line to the top of the screen m : edit / resume editing the commit message e : edit the currently selected hunk - a : toggle amend mode, only with commit -i + a : toggle all selections c : confirm selected changes r : review/edit and confirm selected changes q : quit without confirming (no changes will be made) @@ -1913,7 +1920,7 @@ are you sure you want to review/edit and elif keypressed in ["q"]: raise error.Abort(_(b'user quit')) elif keypressed in ['a']: -self.toggleamend(self.opts, test) +self.flipselections() elif keypressed in ["c"]: return True elif keypressed in ["r"]: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] crecord: remove toggleamend
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1576015629 18000 # Tue Dec 10 17:07:09 2019 -0500 # Node ID fa825ca77328e397df683a91c8beeca7060bf726 # Parent bd10bc4bdb994b875040c0c58f1c341df66ddd46 crecord: remove toggleamend Previous commit removed its only calling site. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1763,32 +1763,6 @@ are you sure you want to review/edit and else: return False -def toggleamend(self, opts, test): -"""Toggle the amend flag. - -When the amend flag is set, a commit will modify the most recently -committed changeset, instead of creating a new changeset. Otherwise, a -new changeset will be created (the normal commit behavior). -""" - -if opts.get(b'amend') is None: -opts[b'amend'] = True -msg = _( -b"Amend option is turned on -- committing the currently " -b"selected changes will not create a new changeset, but " -b"instead update the most recently committed changeset.\n\n" -b"Press any key to continue." -) -elif opts.get(b'amend') is True: -opts[b'amend'] = None -msg = _( -b"Amend option is turned off -- committing the currently " -b"selected changes will create a new changeset.\n\n" -b"Press any key to continue." -) -if not test: -self.confirmationwindow(msg) - def recenterdisplayedarea(self): """ once we scrolled with pg up pg down we can be pointing outside of the ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] hgweb: add diffs to the json changeset template
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1573851536 18000 # Fri Nov 15 15:58:56 2019 -0500 # Node ID df8d762ab0683fb2fe337952b906e2944f89aaa2 # Parent 6a9122d3cd3639ddacb8768c573ea9eaeb9a6a33 hgweb: add diffs to the json changeset template While it's possible to get the diff for each file individually via an obscure url that I'm not even sure is documented, (e.g. diff/{rev}/{filename}?style=json ), it is more convenient to provide the full diff from the changeset view. This is already normally computed for other non-JSON templates, so it seems like an oversight to omit it for the JSON one. The output format is a bit unwieldy but it's consistent with the existing format output by the aforementioned obscure url. diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -66,6 +66,7 @@ changeset = '\{ "user": {author|utf8|json}, "parents": [{join(parent%changesetparent, ", ")}], "files": [{join(files, ", ")}], + "diff": [{join(diff, ", ")}], "phase": {phase|json} }' changesetbranch = '{name|utf8|json}' diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -782,6 +782,7 @@ changeset/ renders the tip changeset 0 ], "desc": "merge test-branch into default", +"diff": [], "files": [ { "file": "foo-new", @@ -813,6 +814,58 @@ changeset/{revision} shows tags 0 ], "desc": "move foo", +"diff": [ + { +"blockno": 1, +"lines": [ + { +"l": "--- a/foo\tThu Jan 01 00:00:00 1970 +\n", +"n": 1, +"t": "-" + }, + { +"l": "+++ /dev/null\tThu Jan 01 00:00:00 1970 +\n", +"n": 2, +"t": "+" + }, + { +"l": "@@ -1,1 +0,0 @@\n", +"n": 3, +"t": "@" + }, + { +"l": "-bar\n", +"n": 4, +"t": "-" + } +] + }, + { +"blockno": 2, +"lines": [ + { +"l": "--- /dev/null\tThu Jan 01 00:00:00 1970 +\n", +"n": 1, +"t": "-" + }, + { +"l": "+++ b/foo-new\tThu Jan 01 00:00:00 1970 +\n", +"n": 2, +"t": "+" + }, + { +"l": "@@ -0,0 +1,1 @@\n", +"n": 3, +"t": "@" + }, + { +"l": "+bar\n", +"n": 4, +"t": "+" + } +] + } +], "files": [ { "file": "foo", @@ -849,6 +902,38 @@ changeset/{revision} shows bookmarks 0 ], "desc": "modify da/foo", +"diff": [ + { +"blockno": 1, +"lines": [ + { +"l": "--- a/da/foo\tThu Jan 01 00:00:00 1970 +\n", +"n": 1, +"t": "-" + }, + { +"l": "+++ b/da/foo\tThu Jan 01 00:00:00 1970 +\n", +"n": 2, +"t": "+" + }, + { +"l": "@@ -1,1 +1,1 @@\n", +"n": 3, +"t": "@" + }, + { +"l": "-foo\n", +"n": 4, +"t": "-" + }, + { +"l": "+bar\n", +"n": 5, +"t": "+" + } +] + } +], "files": [ { "file": "da/foo", @@ -877,6 +962,38 @@ changeset/{revision} shows branches 0 ], "desc": "create test branch", +"diff": [ + { +"blockno": 1, +"lines": [ + { +"l": "--- a/foo\tThu Jan 01 00:00:00 1970 +\n", +"n": 1, +"t": "-" + }, + { +"l": "+++ b/foo\tThu Jan 01 00:00:00 1970 +\n", +"n": 2, +"t": "+" + }, + { +"l": "@@ -1,1 +1,1 @@\n", +"n": 3, +"t": "@" + }, + { +"l": "-foo\n", +"n": 4, +"t": "-" + }, + { +"l": "+branch\n", +"n": 5, +"t": "+" + } +] + } +], "files": [ { "file": "foo", ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] hgweb: add a status property to file list context
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1573851721 18000 # Fri Nov 15 16:02:01 2019 -0500 # Node ID 66854dfbde7f2191ff3da155872ac15f1b8e6934 # Parent 303bf312d5edfab57ee03dd7f645b44d105b8bd3 hgweb: add a status property to file list context The web templates merely indicate if files touched by this revision are in the commit or not, i.e. if they are removed. It would be helpful to have more context and also indicate whether the files are added, modified, or removed. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -541,8 +541,15 @@ def symrevorshortnode(req, ctx): def _listfilesgen(context, ctx, stripecount): parity = paritygen(stripecount) +filesadded = ctx.filesadded() for blockno, f in enumerate(ctx.files()): -template = b'filenodelink' if f in ctx else b'filenolink' +if f not in ctx: +status = b'removed' +elif f in filesadded: +status = b'added' +else: +status = b'modified' +template = b'filenolink' if status == b'removed' else b'filenodelink' yield context.process( template, { @@ -550,6 +557,7 @@ def _listfilesgen(context, ctx, stripeco b'file': f, b'blockno': blockno + 1, b'parity': next(parity), +b'status': status, }, ) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] hgweb: add files to the json changeset template
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1573851385 18000 # Fri Nov 15 15:56:25 2019 -0500 # Node ID 6a9122d3cd3639ddacb8768c573ea9eaeb9a6a33 # Parent 66854dfbde7f2191ff3da155872ac15f1b8e6934 hgweb: add files to the json changeset template As far as I can tell, it's currently impossible via JSON to figure out what files are touched by a particular revision. Reusing the filenodelink and filenolink templates from the other hgweb templates should provide this information. diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -65,6 +65,7 @@ changeset = '\{ "tags": [{join(changesettag, ", ")}], "user": {author|utf8|json}, "parents": [{join(parent%changesetparent, ", ")}], + "files": [{join(files, ", ")}], "phase": {phase|json} }' changesetbranch = '{name|utf8|json}' @@ -229,8 +230,11 @@ help = '\{ "topic": {topic|utf8|json}, "rawdoc": {doc|utf8|json} }' -filenodelink = '' -filenolink = '' +filenodelink = '\{ + "file": {file|json}, + "status": {status|json} + }' +filenolink = '{filenodelink}' index = '\{ "entries": [{join(entries%indexentry, ", ")}] }' diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -782,6 +782,12 @@ changeset/ renders the tip changeset 0 ], "desc": "merge test-branch into default", +"files": [ + { +"file": "foo-new", +"status": "modified" + } +], "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7", "parents": [ "ceed296fe500c3fac9541e31dad860cb49c89e45", @@ -807,6 +813,16 @@ changeset/{revision} shows tags 0 ], "desc": "move foo", +"files": [ + { +"file": "foo", +"status": "removed" + }, + { +"file": "foo-new", +"status": "added" + } +], "node": "78896eb0e102174ce9278438a95e12543e4367a7", "parents": [ "8d7c456572acf3557e8ed8a07286b10c408bcec5" @@ -833,6 +849,12 @@ changeset/{revision} shows bookmarks 0 ], "desc": "modify da/foo", +"files": [ + { +"file": "da/foo", +"status": "modified" + } +], "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5", "parents": [ "f8bbb9024b10f93cdbb8d940337398291d40dea8" @@ -855,6 +877,12 @@ changeset/{revision} shows branches 0 ], "desc": "create test branch", +"files": [ + { +"file": "foo", +"status": "modified" + } +], "node": "6ab967a8ab3489227a83f80e920faa039a71819f", "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3 V2] histedit: render a rolled up description using the proper roll colours
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572477597 14400 # Wed Oct 30 19:19:57 2019 -0400 # Node ID edc9a7a388b6f939c9464e426fee3de31d005ca7 # Parent b2db799c5a1d3a66961246f9c7598db3dc63c4de histedit: render a rolled up description using the proper roll colours Users have rightfully complained that the old behaviour of completely removing the description of a rolled commit makes it difficult to remember what was in that commit. Instead, we now render the removed description in red. I couldn't think of a simpler way to do this. You can't just combine existing curses colours into new effects; only secondary effects like bold or underline can be logically OR'ed to generate a combined text effect. It seems easier to just redundantly keep track of what the roll colour should be. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1497,9 +1497,12 @@ pgup/K: move patch up, pgdn/J: move patc rulesscr.addstr(y, 0, b" ", curses.color_pair(COLOR_WARN)) else: rulesscr.addstr(y, 0, b" ", curses.COLOR_BLACK) + if y + start == selected: +rollcolor = COLOR_ROLL_SELECTED addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_SELECTED)) elif y + start == pos: +rollcolor = COLOR_ROLL_CURRENT addln( rulesscr, y, @@ -1508,7 +1511,13 @@ pgup/K: move patch up, pgdn/J: move patc curses.color_pair(COLOR_CURRENT) | curses.A_BOLD, ) else: +rollcolor = COLOR_ROLL addln(rulesscr, y, 2, rule) + +if rule.action == b'roll': +rulesscr.addstr(y, 2 + len(rule.prefix), rule.desc, +curses.color_pair(rollcolor)) + rulesscr.noutrefresh() def renderstring(win, state, output, diffcolors=False): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3 V2] histedit: define new colour pairs for roll action
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572478497 14400 # Wed Oct 30 19:34:57 2019 -0400 # Node ID b2db799c5a1d3a66961246f9c7598db3dc63c4de # Parent 0ad29bd65ab45822e2e2a6630860269832aca2fe histedit: define new colour pairs for roll action Red seems like a good colour to indicate removal, since that's the colour we use in diffs. We need three varieties with three different backgrounds corresponding to the possible ways we can display a rule. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1056,6 +1056,7 @@ ACTION_LABELS = { COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 COLOR_DIFF_ADD_LINE, COLOR_DIFF_DEL_LINE, COLOR_DIFF_OFFSET = 6, 7, 8 +COLOR_ROLL, COLOR_ROLL_CURRENT, COLOR_ROLL_SELECTED = 9, 10, 11 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1392,6 +1393,9 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) +curses.init_pair(COLOR_ROLL, curses.COLOR_RED, -1) +curses.init_pair(COLOR_ROLL_CURRENT, curses.COLOR_BLACK, curses.COLOR_MAGENTA) +curses.init_pair(COLOR_ROLL_SELECTED, curses.COLOR_RED, curses.COLOR_WHITE) # don't display the cursor try: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3 V2] histeditrule: split __bytes__ property into prefix and desc
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572478029 14400 # Wed Oct 30 19:27:09 2019 -0400 # Node ID 0ad29bd65ab45822e2e2a6630860269832aca2fe # Parent ab9b0a20b9e6b7f1f16f643486ff20a6d44ca2d5 histeditrule: split __bytes__ property into prefix and desc In order to be able to colourise the description of the rule, we need to have it as a separate bytestring. Curses doesn't make it easy to take existing text on the screen and give it different properties; we can only add new text with new properties. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1119,32 +1119,42 @@ class histeditrule(object): self.conflicts = [] def __bytes__(self): -# Some actions ('fold' and 'roll') combine a patch with a previous one. -# Add a marker showing which patch they apply to, and also omit the -# description for 'roll' (since it will get discarded). Example display: +# Example display of several histeditrules: # # #10 pick 316392:06a16c25c053 add option to skip tests -# #11 ^roll 316393:71313c964cc5 +# #11 ^roll 316393:71313c964cc5 oops a fixup commit # #12 pick 316394:ab31f3973b0d include mfbt for mozilla-config.h # #13 ^fold 316395:14ce5803f4c3 fix warnings # # The carets point to the changeset being folded into ("roll this # changeset into the changeset above"). +return b'%s%s' % (self.prefix, self.desc) + +__str__ = encoding.strmethod(__bytes__) + +@property +def prefix(self): +# Some actions ('fold' and 'roll') combine a patch with a +# previous one. Add a marker showing which patch they apply +# to. action = ACTION_LABELS.get(self.action, self.action) + h = self.ctx.hex()[0:12] r = self.ctx.rev() -desc = self.ctx.description().splitlines()[0].strip() -if self.action == b'roll': -desc = b'' -return b"#%s %s %d:%s %s" % ( + +return b"#%s %s %d:%s " % ( (b'%d' % self.origpos).ljust(2), action.ljust(6), r, -h, -desc, +h ) -__str__ = encoding.strmethod(__bytes__) +@property +def desc(self): +# This is split off from the prefix property so that we can +# separately make the description for 'roll' red (since it +# will get discarded). +return self.ctx.description().splitlines()[0].strip() def checkconflicts(self, other): if other.pos > self.pos and other.origpos <= self.origpos: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] histedit: render a rolled up description using the proper roll colours
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572477597 14400 # Wed Oct 30 19:19:57 2019 -0400 # Node ID 4d0d2d692de029b4838d8fc12a48004749db9480 # Parent 47446180a5ee16af1c90bb20a8dca92fa9d5f794 histedit: render a rolled up description using the proper roll colours Users have rightfully complained that the old behaviour of completely removing the description of a rolled commit makes it difficult to remember what was in that commit. Instead, we now render the removed description in red. I couldn't think of a simpler way to do this. You can't just combine existing curses colours into new effects; only secondary effects like bold or underline can be logically OR'ed to generate a combined text effect. It seems easier to just redundantly keep track of what the roll colour should be. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1497,9 +1497,12 @@ pgup/K: move patch up, pgdn/J: move patc rulesscr.addstr(y, 0, b" ", curses.color_pair(COLOR_WARN)) else: rulesscr.addstr(y, 0, b" ", curses.COLOR_BLACK) + if y + start == selected: +rollcolor = COLOR_ROLL_SELECTED addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_SELECTED)) elif y + start == pos: +rollcolor = COLOR_ROLL_CURRENT addln( rulesscr, y, @@ -1508,7 +1511,12 @@ pgup/K: move patch up, pgdn/J: move patc curses.color_pair(COLOR_CURRENT) | curses.A_BOLD, ) else: +rollcolor = COLOR_ROLL addln(rulesscr, y, 2, rule) + +if rule.action == b'roll': +rulesscr.addstr(y, 2 + len(rule.prefix), rule.desc, curses.color_pair(rollcolor)) + rulesscr.noutrefresh() def renderstring(win, state, output, diffcolors=False): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] histeditrule: split __str__ property into prefix and desc
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572478029 14400 # Wed Oct 30 19:27:09 2019 -0400 # Node ID 45aea2365bcb5f89d20bb1907d75175246da3d05 # Parent ab9b0a20b9e6b7f1f16f643486ff20a6d44ca2d5 histeditrule: split __str__ property into prefix and desc In order to be able to colourise the description of the rule, we need to have it as a separate string. Curses doesn't make it easy to take existing text on the screen and give it different properties; we can only add new text with new properties. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1119,33 +1119,43 @@ class histeditrule(object): self.conflicts = [] def __bytes__(self): -# Some actions ('fold' and 'roll') combine a patch with a previous one. -# Add a marker showing which patch they apply to, and also omit the -# description for 'roll' (since it will get discarded). Example display: +# Example display of several histeditrules: # # #10 pick 316392:06a16c25c053 add option to skip tests -# #11 ^roll 316393:71313c964cc5 +# #11 ^roll 316393:71313c964cc5 oops a fixup commit # #12 pick 316394:ab31f3973b0d include mfbt for mozilla-config.h # #13 ^fold 316395:14ce5803f4c3 fix warnings # # The carets point to the changeset being folded into ("roll this # changeset into the changeset above"). +return b'{}{}'.format(self.prefix, self.desc) + +@property +def prefix(self): +# Some actions ('fold' and 'roll') combine a patch with a +# previous one. Add a marker showing which patch they apply +# to. action = ACTION_LABELS.get(self.action, self.action) + h = self.ctx.hex()[0:12] r = self.ctx.rev() -desc = self.ctx.description().splitlines()[0].strip() -if self.action == b'roll': -desc = b'' -return b"#%s %s %d:%s %s" % ( + +return b"#%s %s %d:%s " % ( (b'%d' % self.origpos).ljust(2), action.ljust(6), r, -h, -desc, +h ) __str__ = encoding.strmethod(__bytes__) +@property +def desc(self): +# This is split off from the prefix property so that we can +# separately make the description for 'roll' red (since it +# will get discarded). +return self.ctx.description().splitlines()[0].strip() + def checkconflicts(self, other): if other.pos > self.pos and other.origpos <= self.origpos: if set(other.ctx.files()) & set(self.ctx.files()) != set(): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] histedit: define new colour pairs for roll action
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1572478497 14400 # Wed Oct 30 19:34:57 2019 -0400 # Node ID 47446180a5ee16af1c90bb20a8dca92fa9d5f794 # Parent 45aea2365bcb5f89d20bb1907d75175246da3d05 histedit: define new colour pairs for roll action Red seems like a good colour to indicate removal, since that's the colour we use in diffs. We need three varieties with three different backgrounds corresponding to the possible ways we can display a rule. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1056,6 +1056,7 @@ ACTION_LABELS = { COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 COLOR_DIFF_ADD_LINE, COLOR_DIFF_DEL_LINE, COLOR_DIFF_OFFSET = 6, 7, 8 +COLOR_ROLL, COLOR_ROLL_CURRENT, COLOR_ROLL_SELECTED = 9, 10, 11 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1392,6 +1393,9 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) +curses.init_pair(COLOR_ROLL, curses.COLOR_RED, -1) +curses.init_pair(COLOR_ROLL_CURRENT, curses.COLOR_BLACK, curses.COLOR_MAGENTA) +curses.init_pair(COLOR_ROLL_SELECTED, curses.COLOR_RED, curses.COLOR_WHITE) # don't display the cursor try: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7146: [RFC] grep: add config option to grep PWD by default
JordiGH added a comment. I will repeat my position as stated on IRC. I am against this change because, 1. it's inconsistent with shelve, commit, addremove, status, diff and all other operations that by default work on the entire repo 2. it's difficult to go from this proposed default to grepping the entire repo 3. it's easy and natural for the user to add this dot themselves 4. there's no permanent consequence if the user accidentally greps the whole repo; only a little bit of extra output and some CPU wasted REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7146/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7146 To: pulkit, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] grep: warn on censored revisions instead of erroring out
On Tue, 2019-10-22 at 10:39 +0900, Yuya Nishihara wrote: > On Mon, 21 Oct 2019 16:10:58 -0400, Jordi Gutiérrez Hermoso wrote: > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso > > # Date 1571688404 14400 > > # Mon Oct 21 16:06:44 2019 -0400 > > # Node ID 608193de8560218cc27032977bc380cb8dc0f3f8 > > # Parent d782cce137fd1d50cccfecf8ccb17a623fde8800 > > grep: warn on censored revisions instead of erroring out > > Can you add some tests? Done. > Might be better to fail if censor.policy != ignore. I can't see why anyone could want grep to error out early, so I'm going to keep it as is and I propose an addendum to the censor docs instead. > Nit: messages are all lowercase in general. [..] > Nit: filename must be bytes. bytestr() shouldn't be needed. Fixed and fixed. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 V2] grep: warn on censored revisions instead of erroring out
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1571752600 14400 # Tue Oct 22 09:56:40 2019 -0400 # Node ID 386e0a956ae57a95d62330c95497d7460761f3fd # Parent d782cce137fd1d50cccfecf8ccb17a623fde8800 grep: warn on censored revisions instead of erroring out We need most of the grep logic to go through in case we encounter a censored revision, so we just return a None body for a censored node, and we stop just short of trying to record matches with the contents of that censored body. The other parts such as recording that the censored file has been considered at this revision needs to go into the proper dicts. I have also gotten weary of all the abbreviations, so while I did a small refactor to move the file-data-getting operation into a common function, I also expanded the abbreviations of the relevant variables within this little function. Hopefully some day this helps someone figure out what all the abbreviations mean. Although the censoring docs currently state that some commands error out or are ignored depending on the `censor.policy` config, I cannot see a benefit for grep to ever stop dead in its tracks when a censored revision is encountered. I will also amend the docs to indicate that some commands, such as grep, unconditionally ignore censored revisions. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3440,6 +3440,9 @@ def grep(ui, repo, pattern, *pats, **opt def grepbody(fn, rev, body): matches[rev].setdefault(fn, []) m = matches[rev][fn] +if body is None: +return + for lnum, cstart, cend, line in matchlines(body): s = linestate(line, lnum, cstart, cend) m.append(s) @@ -3575,6 +3578,22 @@ def grep(ui, repo, pattern, *pats, **opt getrenamed = scmutil.getrenamedfn(repo) +def get_file_content(filename, filelog, filenode, context, revision): +try: +content = filelog.read(filenode) +except error.WdirUnsupported: +content = context[filename].data() +except error.CensoredNodeError: +content = None +ui.warn( +_(b'cannot search in censored file: %(filename)s:%(revnum)s\n') +% { +'filename': filename, +'revnum': pycompat.bytestr(revision), +} +) +return content + def prep(ctx, fns): rev = ctx.rev() pctx = ctx.p1() @@ -3601,17 +3620,15 @@ def grep(ui, repo, pattern, *pats, **opt files.append(fn) if fn not in matches[rev]: -try: -content = flog.read(fnode) -except error.WdirUnsupported: -content = ctx[fn].data() +content = get_file_content(fn, flog, fnode, ctx, rev) grepbody(fn, rev, content) pfn = copy or fn if pfn not in matches[parent]: try: -fnode = pctx.filenode(pfn) -grepbody(pfn, parent, flog.read(fnode)) +pfnode = pctx.filenode(pfn) +pcontent = get_file_content(pfn, flog, pfnode, pctx, parent) +grepbody(pfn, parent, pcontent) except error.LookupError: pass diff --git a/tests/test-censor.t b/tests/test-censor.t --- a/tests/test-censor.t +++ b/tests/test-censor.t @@ -442,6 +442,33 @@ Censored nodes can be bundled up and unb checking files checked 14 changesets with 15 changes to 2 files +Grepping only warns, doesn't error out + + $ cd ../rpull + $ hg grep 'Normal file' + bystander:Normal file v2 + $ hg grep nothing + target:Re-sanitized; nothing to see here + $ hg grep --diff 'Normal file' + cannot search in censored file: target:7 + cannot search in censored file: target:10 + cannot search in censored file: target:12 + bystander:6:-:Normal file v2 + cannot search in censored file: target:1 + cannot search in censored file: target:2 + cannot search in censored file: target:3 + bystander:2:-:Normal file here + bystander:2:+:Normal file v2 + bystander:0:+:Normal file here + $ hg grep --diff nothing + cannot search in censored file: target:7 + cannot search in censored file: target:10 + cannot search in censored file: target:12 + target:13:+:Re-sanitized; nothing to see here + cannot search in censored file: target:1 + cannot search in censored file: target:2 + cannot search in censored file: target:3 + Censored nodes can be imported on top of censored nodes, consecutively $ hg init ../rimport ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V2] censor: document that some commands simply ignore censored data
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1571752908 14400 # Tue Oct 22 10:01:48 2019 -0400 # Node ID 2bf40680a6362c44c183f17572f24d6ec086a3c6 # Parent 386e0a956ae57a95d62330c95497d7460761f3fd censor: document that some commands simply ignore censored data I can't see a benefit for hg grep to ever error out early when it encounters censored data. diff --git a/hgext/censor.py b/hgext/censor.py --- a/hgext/censor.py +++ b/hgext/censor.py @@ -23,6 +23,10 @@ simply fail when asked to produce censor ``hg update``, must be capable of tolerating censored data to continue to function in a meaningful way. Such commands only tolerate censored file revisions if they are allowed by the "censor.policy=ignore" config option. + +A few informative commands such as ``hg grep`` will unconditionally +ignore censored data and merely report that it was encountered. + """ from __future__ import absolute_import ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] grep: warn on censored revisions instead of erroring out
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1571688404 14400 # Mon Oct 21 16:06:44 2019 -0400 # Node ID 608193de8560218cc27032977bc380cb8dc0f3f8 # Parent d782cce137fd1d50cccfecf8ccb17a623fde8800 grep: warn on censored revisions instead of erroring out We need most of the grep logic to go through in case we encounter a censored revision, so we just return a None body for a censored node, and we stop just short of trying to record matches with the contents of that censored body. The other parts such as recording that the censored file has been considered at this revision needs to go into the proper dicts. I have also gotten weary of all the abbreviations, so while I did a small refactor to move the file-data-getting operation into a common function, I also expanded the abbreviations of the relevant variables within this little function. Hopefully some day this helps someone figure out what all the abbreviations mean. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3440,6 +3440,9 @@ def grep(ui, repo, pattern, *pats, **opt def grepbody(fn, rev, body): matches[rev].setdefault(fn, []) m = matches[rev][fn] +if body is None: +return + for lnum, cstart, cend, line in matchlines(body): s = linestate(line, lnum, cstart, cend) m.append(s) @@ -3575,6 +3578,22 @@ def grep(ui, repo, pattern, *pats, **opt getrenamed = scmutil.getrenamedfn(repo) +def get_file_content(filename, filelog, filenode, context, revision): +try: +content = filelog.read(filenode) +except error.WdirUnsupported: +content = context[filename].data() +except error.CensoredNodeError: +content = None +ui.warn( +_(b'Cannot search in censored file: %(filename)s:%(revnum)s\n') +% { +'filename': pycompat.bytestr(filename), +'revnum': pycompat.bytestr(revision), +} +) +return content + def prep(ctx, fns): rev = ctx.rev() pctx = ctx.p1() @@ -3601,17 +3620,15 @@ def grep(ui, repo, pattern, *pats, **opt files.append(fn) if fn not in matches[rev]: -try: -content = flog.read(fnode) -except error.WdirUnsupported: -content = ctx[fn].data() +content = get_file_content(fn, flog, fnode, ctx, rev) grepbody(fn, rev, content) pfn = copy or fn if pfn not in matches[parent]: try: -fnode = pctx.filenode(pfn) -grepbody(pfn, parent, flog.read(fnode)) +pfnode = pctx.filenode(pfn) +pcontent = get_file_content(pfn, flog, pfnode, pctx, parent) +grepbody(pfn, parent, pcontent) except error.LookupError: pass ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7000: grep: enable all-files by default (BC)
JordiGH added a comment. Wait, I found some problems, here is an amendment: # HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1571411921 14400 # Fri Oct 18 11:18:41 2019 -0400 # Node ID 60eb1feadbeebd2ddab16e0d1b4566dbf216333c # Parent 8c0fe77f47c5956681238b79dc15093c92e79395 grep: update docs to reflect new --all-files default These docs no longer even mention the old weird behaviour that was poorly understood and underutilised. I think this undocumentation effectively deprecates it. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3276,7 +3276,7 @@ statemod.addunfinished( b'diff', None, _( -b'print all revisions when the term was introduced ' +b'search revision differences for when the pattern was added ' b'or removed' ), ), @@ -3302,7 +3302,7 @@ statemod.addunfinished( b'r', b'rev', [], -_(b'only search files changed within revision range'), +_(b'search files changed within revision range'), _(b'REV'), ), ( @@ -3324,23 +3324,27 @@ statemod.addunfinished( intents={INTENT_READONLY}, ) def grep(ui, repo, pattern, *pats, **opts): -"""search revision history for a pattern in specified files - -Search revision history for a regular expression in the specified -files or the entire project. - -By default, grep prints the most recent revision number for each -file in which it finds a match. To get it to print every revision -that contains a change in match status ("-" for a match that becomes -a non-match, or "+" for a non-match that becomes a match), use the ---diff flag. +"""search for a pattern in specified files + +Search the working directory or revision history for a regular +expression in the specified files for the entire project. + +By default, grep searches the repository files in the working +directory and prints the files where it finds a match. To specify +historical revisions instead of the working directory, use the +--rev flag. + +To search instead historical revision differences that contains a +change in match status ("-" for a match that becomes a non-match, +or "+" for a non-match that becomes a match), use the --diff flag. PATTERN can be any Python (roughly Perl-compatible) regular expression. -If no FILEs are specified (and -f/--follow isn't set), all files in -the repository are searched, including those that don't exist in the -current branch or have been deleted in a prior changeset. +If no FILEs are specified and the --rev flag isn't supplied, all +files in the working directory are searched. When using the --rev +flag and specifying FILEs, use the --follow argument to also +follow the specified FILEs across renames and copies. .. container:: verbose @@ -3363,6 +3367,7 @@ def grep(ui, repo, pattern, *pats, **opt See :hg:`help templates.operators` for the list expansion syntax. Returns 0 if a match is found, 1 otherwise. + """ opts = pycompat.byteskwargs(opts) diff = opts.get(b'all') or opts.get(b'diff') REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7000/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7000 To: khanchi97, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7000: grep: enable all-files by default (BC)
JordiGH added a comment. In D7000#103065 <https://phab.mercurial-scm.org/D7000#103065>, @khanchi97 wrote: > Sure :) How about something like this? # HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1571411921 14400 # Fri Oct 18 11:18:41 2019 -0400 # Node ID 86cafc9dec2660561f65ec17d043f3117767a9a8 # Parent 8c0fe77f47c5956681238b79dc15093c92e79395 grep: update docs to reflect new --all-files default These docs no longer even mention the old weird behaviour that was poorly understood and underutilised. I think this undocumentation effectively deprecates it. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3276,7 +3276,7 @@ statemod.addunfinished( b'diff', None, _( -b'print all revisions when the term was introduced ' +b'search commit differences for when the term was added ' b'or removed' ), ), @@ -3302,7 +3302,7 @@ statemod.addunfinished( b'r', b'rev', [], -_(b'only search files changed within revision range'), +_(b'search files changed within revision range'), _(b'REV'), ), ( @@ -3324,16 +3324,19 @@ statemod.addunfinished( intents={INTENT_READONLY}, ) def grep(ui, repo, pattern, *pats, **opts): -"""search revision history for a pattern in specified files - -Search revision history for a regular expression in the specified -files or the entire project. - -By default, grep prints the most recent revision number for each -file in which it finds a match. To get it to print every revision -that contains a change in match status ("-" for a match that becomes -a non-match, or "+" for a non-match that becomes a match), use the ---diff flag. +"""search for a pattern in specified files + +Search the working directory or revision history for a regular +expression in the specified files or the entire project. + +By default, grep searches the repository files in the working +directory and prints the files where it finds a match. To specify +historical revisions instead of the working directory, use the +--rev flag. + +To search instead historical revision differences that contains a +change in match status ("-" for a match that becomes a non-match, +or "+" for a non-match that becomes a match), use the --diff flag. PATTERN can be any Python (roughly Perl-compatible) regular expression. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7000/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7000 To: khanchi97, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7000: grep: enable all-files by default (BC)
JordiGH added a comment. The docstring needs a significant update too. Would you like me to suggest something? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7000/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7000 To: khanchi97, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7000: grep: enable all-files by default (BC)
JordiGH added a comment. The docstring needs an update too. INLINE COMMENTS > commands.py:2742 > > By default, grep prints the most recent revision number for each > file in which it finds a match. To get it to print every revision No longer by default! Or perhaps at all. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7000/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7000 To: khanchi97, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Interest in integrating hg-git into Mercurial
On Thu, 2019-08-01 at 10:01 -0700, Gregory Szorc wrote: > Is there any interest in integrating hg-git (or hg-git > functionality) into the Mercurial distribution as an officially > supported extension? I know at least one person who was interested in using hg but was thwarted by hg-git and never again tried using it. The blog posts died off depressingly quickly: http://kamalmarhubi.com/blog/ I've also encountered other pain points, not so much with installation/distribution but performance and failure states. Given that nearly all of my hg usage nowadays is via hg-git, I am very much in favour of making it more official. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6613: commit: improve the files field of changelog for merges (RFC)
JordiGH added inline comments. INLINE COMMENTS > valentin.gatienbaron wrote in localrepo.py:2658 > It'd be trivial to change the code to check both parents, but I find what you > say surprising. Aren't there plenty of places in hg that do checks similar to > this one: > > https://www.mercurial-scm.org/repo/hg-committed/file/3bc400ccbf99/mercurial/context.py#l443 > https://www.mercurial-scm.org/repo/hg-committed/file/3bc400ccbf99/mercurial/context.py#l2414 > https://www.mercurial-scm.org/repo/hg-committed/file/3bc400ccbf99/mercurial/localrepo.py#l2407 Hm, yes, you're right. I suppose it's a coincidence that a lot of things still work if p1 is null but p2 isn't. It's certainly not something that hg verify nor hg log complains about. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6613/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6613 To: valentin.gatienbaron, #hg-reviewers, mharbison72 Cc: JordiGH, yuja, mharbison72, martinvonz, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6613: commit: improve the files field of changelog for merges (RFC)
JordiGH added inline comments. INLINE COMMENTS > localrepo.py:2658 > del m[f] > +if p2.rev() != nullrev: > +@util.cachefunc Not all merges can be detected by checking for p2 being non-null; p1 being null but p2 being non-null is perfectly acceptable everywhere else, although normally hg won't produce commits like this in most circumstances. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6613/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6613 To: valentin.gatienbaron, #hg-reviewers, mharbison72 Cc: JordiGH, yuja, mharbison72, martinvonz, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] histedit: make actions toggleables
On Sun, 2019-05-12 at 20:17 -0700, Feng Yu wrote: > To clarify, the change I propose is in the ncurses based _chistedit UI, which > does display the graph. > It does not change the behaviour of TUI version of _histedit. "TUI" and "curses" mean the same thing, generally. Maybe we should call the other histedit interface editor-based? > I will look into adding a config option for this and file a new > patch. Wait, no, not more configs. That seems like unnecessary complication. Let's come to a consensus first. I'm not sure which way makes most sense. Both ways seem to make sense to me. Do you have examples of users who were confused by the lack of toggleability? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] histedit: Show file names in multiple line format
On Thu, 2019-05-02 at 16:51 -0700, Martin von Zweigbergk wrote: > I've queued these mostly bases on Jordi's review. Thanks to both of you! Wait wait, I had stylistic complaints, but I couldn't get to them! Ah, well, I'll submit follow-ups. These patches are definite improvements. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Changing the wdir() {rev} and {node} output
On Wed, 2019-04-17 at 08:29 +0900, Yuya Nishihara wrote: > On Tue, 16 Apr 2019 10:14:53 -0400, Jordi Gutiérrez Hermoso wrote: > > While I think it might be okay to keep the iternal values, > > > > https://www.mercurial-scm.org/repo/hg/file/967c098eed33/mercurial/node.py#l39 > > > > I think it's far too confusing to expose them in the user interface. > > > > A particular inconsistency I see is that we already have a way to show > > wdir(), for example. In a way, `hg id -T` is kind of an alias for `hg > > log -r 'wdir()' -T ... ` in a way that is not obvious. But trying to > > use '{node}' or '{rev}' in `hg id` results in exposing the internal > > revision and node magic numbers, which is very confusing behaviour, > > since the default behaviour of `hg id` is to show `{p1.rev}+` instead > > if there are changes in the wdir. > > > > Another instance in which this happens is `hg annotate -r 'wdir()'`, > > which also shows plusses to indicate that the changes are only in the > > working directory. > > > > I think we should keep this behaviour throughout, for consistency. > > Since `wdir()` is still marked as experimental, we can change its > > current behaviour. I propose consistency with `hg id` as follows: > > First, I'm okay to change the output of "hg whatever -r 'wdir()'" if that > makes things more consistent. However, {rev}/{node} keywords should still > return wdirrev/wdirhex since they are valid identifiers whereas "+" > isn't. But this is the problem that we currently have. It's difficult to produce the default template of `hg id` unless you dig deeper into template syntax. Maybe we should just make the `+` part of the syntax for parsing revnums... but that conflicts with revset syntax, oh bother. Could we add a unary postfix `+` operator to revsets? > > * If the working directory is clean, the following are equivalent: > > > > hg log -r 'wdir()' -T '{rev}:{node}' > > hg log -r . -T '{rev}:{node}' > > Do you mean `hg log -r 'wdir()'` should fall back to '.' if wdir is clean? > I believe it'll be way complicated. Maybe yes? Conceptually, showing the log for the wdir doesn't seem to be that useful of an operation. The only reason I can see for doing that is to get the current time and the current user, but that would probably be better done with dedicated template keywords. > If clean "wdir()" == ".", "hg status --change 'wdir()'" would have to > show the changes in "." as well, which makes no sense. Hm, okay, I see the complication here. So maybe let's not do this except for display purpose of the {rev} and {node} template keywords. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: use context manager to set verbose ui
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1555434741 14400 # Tue Apr 16 13:12:21 2019 -0400 # Node ID f64bbdc70aaa1ca8c504c2d909f6012927a27cb8 # Parent a362b0b95e42c8f7d46d7e3a0eb4cc531fa5f2d6 chistedit: use context manager to set verbose ui I'm still not exactly sure why this is necessary -- perhaps setting it unconditionally would leak this setting in chg invocations. Regardless, this would have looked very out of place as compared to how this setting is done everywhere else, so at least for the sake of style, let's be consistent with the rest of the codebase. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1230,12 +1230,13 @@ def addln(win, y, x, line, color=None): def patchcontents(state): repo = state['repo'] rule = state['rules'][state['pos']] -repo.ui.verbose = True displayer = logcmdutil.changesetdisplayer(repo.ui, repo, { "patch": True, "template": "status" }, buffered=True) -displayer.show(rule.ctx) -displayer.close() +overrides = {('ui', 'verbose'): True} +with repo.ui.configoverride(overrides, source='histedit'): +displayer.show(rule.ctx) +displayer.close() return displayer.hunk[rule.ctx.rev()].splitlines() def _chisteditmain(repo, rules, stdscr): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Changing the wdir() {rev} and {node} output
While I think it might be okay to keep the iternal values, https://www.mercurial-scm.org/repo/hg/file/967c098eed33/mercurial/node.py#l39 I think it's far too confusing to expose them in the user interface. A particular inconsistency I see is that we already have a way to show wdir(), for example. In a way, `hg id -T` is kind of an alias for `hg log -r 'wdir()' -T ... ` in a way that is not obvious. But trying to use '{node}' or '{rev}' in `hg id` results in exposing the internal revision and node magic numbers, which is very confusing behaviour, since the default behaviour of `hg id` is to show `{p1.rev}+` instead if there are changes in the wdir. Another instance in which this happens is `hg annotate -r 'wdir()'`, which also shows plusses to indicate that the changes are only in the working directory. I think we should keep this behaviour throughout, for consistency. Since `wdir()` is still marked as experimental, we can change its current behaviour. I propose consistency with `hg id` as follows: * If the working directory is clean, the following are equivalent: hg log -r 'wdir()' -T '{rev}:{node}' hg log -r . -T '{rev}:{node}' * Otherwise, if there are changes in the working directory, the following are equivalent: hg log -r 'wdir()' -T '{rev}:{node}' hg log -r '.' -T'{rev}+:{node}+' In other words, never show in the interface the internal values of wdir() obtained from node.py I think this would be consistent with the existing usage of `hg id` and `hg log`, the main consumers of `wdir()`. Thoughts? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 3] revset: implement copies and renames for checkstatus
On Sun, 2019-04-07 at 09:55 +0900, Yuya Nishihara wrote: > On Fri, 05 Apr 2019 14:42:38 -0400, Jordi Gutiérrez Hermoso wrote: > > @@ -624,7 +627,18 @@ def checkstatus(repo, subset, pat, field > > break > > else: > > return False > > -files = repo.status(c.p1().node(), c.node())[field] > > +p1 = c.p1() > > +status = repo.status(p1.node(), c.node()) > > +if field == 3: > > +copymap = copiesmod.pathcopies(p1, c, m) > > +removed = status[2] > > +files = [dest for (dest, src) in copymap.items() if src not in > > removed] > > +elif field == 4: > > +copymap = copiesmod.pathcopies(p1, c, m) > > +removed = status[2] > > +files = [dest for (dest, src) in copymap.items() if src in > > removed] > > +else: > > +files = status[field] > > Maybe we can turn the field argument into a lambda function. It doesn't make > sense to introduce pseudo indices for copies and renames. I don't understand what you mean. Are you saing that the caller should pass a function that should say how to get the appropriate data out of the status object or copymap objects? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: properly show verbose diffs
On Sat, 2019-04-06 at 09:46 +0900, Yuya Nishihara wrote: > On Thu, 04 Apr 2019 10:47:49 -0400, Jordi Gutiérrez Hermoso wrote: > > diff --git a/hgext/histedit.py b/hgext/histedit.py > > --- a/hgext/histedit.py > > +++ b/hgext/histedit.py > > @@ -1230,8 +1230,9 @@ def addln(win, y, x, line, color=None): > > def patchcontents(state): > > repo = state['repo'] > > rule = state['rules'][state['pos']] > > +repo.ui.verbose = True > > Perhaps, this has to be ui.configoverride() so the original value can be > restored. I think we might just even set this "globally" for curses histedit. I'm not sure where else the ui.verbose value matters here except for displaying diffs. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] revset: two new revsets, copies and renames
On Sun, 2019-04-07 at 09:48 +0900, Yuya Nishihara wrote: > So they are quite similar to -r 'file("set:copied()")', and we do include > renames in copies in general. Hm, but we don't have a renamed() fileset, do we? How do you find renames? > I think these predicates are useful, but it's confusing to handle copies > and renames separately only in revset. I agree, consistency is important, but I don't know how to implement a fileset or revset for finding renames. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V2] chistedit: add basic colours to diff view
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554350103 14400 # Wed Apr 03 23:55:03 2019 -0400 # Node ID 93b81d9461e703176801fc425d9e9f75275abc02 # Parent ede500c898adaab1d78f5e048fe84774c9f01fea chistedit: add basic colours to diff view This isn't complete, and it would be nice to show the exact same colours that `hg diff` would show. That goal is too lofty, so this just shows some basic colours, on the premise that a little is better than nothing. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -963,6 +963,7 @@ ACTION_LABELS = { } COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 +COLOR_DIFF_ADD_LINE, COLOR_DIFF_DEL_LINE, COLOR_DIFF_OFFSET = 6, 7, 8 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1249,6 +1250,9 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) +curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) +curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) +curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) # don't display the cursor try: @@ -1345,16 +1349,27 @@ pgup/K: move patch up, pgdn/J: move patc addln(rulesscr, y, 2, rule) rulesscr.noutrefresh() -def renderstring(win, state, output): +def renderstring(win, state, output, diffcolors=False): maxy, maxx = win.getmaxyx() length = min(maxy - 1, len(output)) for y in range(0, length): -win.addstr(y, 0, output[y]) +line = output[y] +if diffcolors: +if line and line[0] == '+': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE)) +elif line and line[0] == '-': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE)) +elif line.startswith('@@ '): +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_OFFSET)) +else: +win.addstr(y, 0, line) +else: +win.addstr(y, 0, line) win.noutrefresh() def renderpatch(win, state): start = state['modes'][MODE_PATCH]['line_offset'] -renderstring(win, state, patchcontents(state)[start:]) +renderstring(win, state, patchcontents(state)[start:], diffcolors=True) def layout(mode): maxy, maxx = stdscr.getmaxyx() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 V2] chistedit: use default curses colours
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554490485 14400 # Fri Apr 05 14:54:45 2019 -0400 # Node ID ede500c898adaab1d78f5e048fe84774c9f01fea # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 chistedit: use default curses colours Terminals will define default colours (for example, white text on black background), but curses doesn't obey those default colours unless told to do so. Calling `curses.use_default_colors` makes curses obey the default terminal colours. One of the most obvious effects is that this allows transparency on terminals that support it. This also brings chistedit closer in appearance to crecord, which also uses default colours. The call may error out if the terminal doesn't support colors, but as far as I can tell, everything still works. If we need a more careful handling of lack of colours, blame me for not doing it now. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1238,6 +1238,11 @@ def patchcontents(state): return displayer.hunk[rule.ctx.rev()].splitlines() def _chisteditmain(repo, rules, stdscr): +try: +curses.use_default_colors() +except curses.error: +pass + # initialize color pattern curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE) curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] revset: short docstring for checkstatus
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489052 14400 # Fri Apr 05 14:30:52 2019 -0400 # Node ID 9fcb915a73b83547921aaa13584c88cb99c6aee7 # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 revset: short docstring for checkstatus This is where all the action happens for the status-related revsets, and a little documentation doesn't hurt. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -598,6 +598,12 @@ def bundle(repo, subset, x): return subset & bundlerevs def checkstatus(repo, subset, pat, field): +"""Helper for status-related revsets (adds, removes, modifies, +renames, copies). The field parameter says which kind is desired: +0: modified +1: added +2: removed +""" hasset = matchmod.patkind(pat) == 'set' mcache = [None] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] revset: implement copies and renames for checkstatus
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489104 14400 # Fri Apr 05 14:31:44 2019 -0400 # Node ID 4baa10f1f44a8e427f49fa4f4d8d29552c2a1a65 # Parent 9fcb915a73b83547921aaa13584c88cb99c6aee7 revset: implement copies and renames for checkstatus Determining when a file is a copy is tricky and isn't handled by the normal status functions, so thankfully we can offload that work to the copies module, just like the status command itself does. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -11,6 +11,7 @@ import re from .i18n import _ from . import ( +copies as copiesmod, dagop, destutil, diffutil, @@ -603,6 +604,8 @@ def checkstatus(repo, subset, pat, field 0: modified 1: added 2: removed +3: copied (not renamed, i.e. source not removed) +4: renamed (not copied, i..e source removed) """ hasset = matchmod.patkind(pat) == 'set' @@ -624,7 +627,18 @@ def checkstatus(repo, subset, pat, field break else: return False -files = repo.status(c.p1().node(), c.node())[field] +p1 = c.p1() +status = repo.status(p1.node(), c.node()) +if field == 3: +copymap = copiesmod.pathcopies(p1, c, m) +removed = status[2] +files = [dest for (dest, src) in copymap.items() if src not in removed] +elif field == 4: +copymap = copiesmod.pathcopies(p1, c, m) +removed = status[2] +files = [dest for (dest, src) in copymap.items() if src in removed] +else: +files = status[field] if fname is not None: if fname in files: return True ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] revset: two new revsets, copies and renames
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489566 14400 # Fri Apr 05 14:39:26 2019 -0400 # Node ID cf6a3da4082569df7b5dd83ab61fcbedc70839f1 # Parent 4baa10f1f44a8e427f49fa4f4d8d29552c2a1a65 revset: two new revsets, copies and renames diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -757,6 +757,21 @@ def converted(repo, subset, x): return subset.filter(lambda r: _matchvalue(r), condrepr=('', rev)) +@predicate('copies(pattern)', safe=True, weight=30) +def copies(repo, subset, x): +"""Changesets which added files matching pattern via copying. This +excludes renames, which are copies where the original file was +removed. + +The pattern without explicit kind like ``glob:`` is expected to be +relative to the current directory and match against a file or a +directory. + +""" +# i18n: "removes" is a keyword +pat = getstring(x, _("copies requires a pattern")) +return checkstatus(repo, subset, pat, 3) + @predicate('date(interval)', safe=True, weight=10) def date(repo, subset, x): """Changesets within the interval, see :hg:`help dates`. @@ -1802,6 +1817,18 @@ def public(repo, subset, x): getargs(x, 0, 0, _("public takes no arguments")) return _phase(repo, subset, phases.public) +@predicate('renames(pattern)', safe=True, weight=30) +def renames(repo, subset, x): +"""Changesets which added files matching pattern via a rename. + +The pattern without explicit kind like ``glob:`` is expected to be +relative to the current directory and match against a file or a +directory. +""" +# i18n: "removes" is a keyword +pat = getstring(x, _("renames requires a pattern")) +return checkstatus(repo, subset, pat, 4) + @predicate('remote([id [,path]])', safe=False) def remote(repo, subset, x): """Local revision that corresponds to the given identifier in a diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -3038,3 +3038,15 @@ abort if the revset doesn't expect given $ log 'expectsize(0:2, :2)' abort: revset size mismatch. expected between 0 and 2, got 3! [255] + +test copies and renames + + $ hg cp b c + $ hg ci -m copy + $ hg mv c d + $ hg ci -m rename + $ hg log -r 'copies("**")' -T '{rev}:{desc}\n' + 10:copy + $ hg log -r 'renames("**")' -T '{rev}:{desc}\n' + 11:rename + ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: properly show verbose diffs
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554388915 14400 # Thu Apr 04 10:41:55 2019 -0400 # Node ID 704f79617827ab0c19a788715b797fcfe8557cea # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c chistedit: properly show verbose diffs I'm not sure if that ever worked and it's an internal API breakage, but `"verbose": True` is not correctly parsed, as most of these options are parsed by diffopts, whereas verbose is a global option. Setting the UI to verbose instead does work and does show a verbose patch, with full commit message. It also shows all files, which unfortunately are a bit hard to read on a single line in the default verbose template. Thus, we also change the default template to use the status template, which shows one file per line as well as its modification state. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1230,8 +1230,9 @@ def addln(win, y, x, line, color=None): def patchcontents(state): repo = state['repo'] rule = state['rules'][state['pos']] +repo.ui.verbose = True displayer = logcmdutil.changesetdisplayer(repo.ui, repo, { -'patch': True, 'verbose': True +"patch": True, "template": "status" }, buffered=True) displayer.show(rule.ctx) displayer.close() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: add basic colours to diff view
On Wed, 2019-04-03 at 23:56 -0400, Jordi Gutiérrez Hermoso wrote: > # HG changeset patch > # User Jordi Gutiérrez Hermoso > # Date 1554350103 14400 > # Wed Apr 03 23:55:03 2019 -0400 > # Node ID d0a4c3ae200ffdfc247f5e2f1897196512615087 > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > chistedit: add basic colours to diff view I didn't realise this, but this patch seems to depend on the patch I sent before this to use default colours. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: add basic colours to diff view
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554350103 14400 # Wed Apr 03 23:55:03 2019 -0400 # Node ID d0a4c3ae200ffdfc247f5e2f1897196512615087 # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c chistedit: add basic colours to diff view This isn't complete, and it would be nice to show the exact same colours that `hg diff` would show. That goal is too lofty, so this just shows some basic colours, on the premise that a little is better than nothing. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -964,6 +964,7 @@ ACTION_LABELS = { } COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 +COLOR_DIFF_ADD_LINE, COLOR_DIFF_DEL_LINE, COLOR_DIFF_OFFSET = 6, 7, 8 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1244,6 +1245,9 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) +curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) +curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) +curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) # don't display the cursor try: @@ -1340,16 +1344,27 @@ pgup/K: move patch up, pgdn/J: move patc addln(rulesscr, y, 2, rule) rulesscr.noutrefresh() -def renderstring(win, state, output): +def renderstring(win, state, output, patchcolors=False): maxy, maxx = win.getmaxyx() length = min(maxy - 1, len(output)) for y in range(0, length): -win.addstr(y, 0, output[y]) +line = output[y] +if patchcolors: +if line and line[0] == '+': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE)) +elif line and line[0] == '-': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE)) +elif line.startswith('@@ '): +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_OFFSET)) +else: +win.addstr(y, 0, line) +else: +win.addstr(y, 0, line) win.noutrefresh() def renderpatch(win, state): start = state['modes'][MODE_PATCH]['line_offset'] -renderstring(win, state, patchcontents(state)[start:]) +renderstring(win, state, patchcontents(state)[start:], patchcolors=True) def layout(mode): maxy, maxx = stdscr.getmaxyx() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: use default curses colours
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554347266 14400 # Wed Apr 03 23:07:46 2019 -0400 # Node ID 263cec9c08fc1b517847fe53f27b47978be127f4 # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c chistedit: use default curses colours Terminals will define default colours (for example, white text on black background), but curses doesn't obey those default colours unless told to do so. Calling `curses.use_default_colors` makes curses obey the default terminal colours. One of the most obvious effects is that this allows transparency on terminals that support it. This also brings chistedit closer in appearance to crecord, which also uses default colours. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1238,6 +1238,8 @@ def patchcontents(state): return displayer.hunk[rule.ctx.rev()].splitlines() def _chisteditmain(repo, rules, stdscr): +curses.use_default_colors() + # initialize color pattern curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE) curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
JordiGH added inline comments. INLINE COMMENTS > crecord.py:1471 > + g : go to the first hunk line > + G : go to the last hunk line >f : fold / unfold item, hiding/revealing its children We should find a better way to phrase this, since it's not about hunk. Maybe just "first line" and "last line". > crecord.py:1766 > +elif keypressed in ["G"]: > +self.handlelastlineevent() > elif keypressed in ["?"]: It would be nice to map these to Home and End (which by the way, also map on `less`). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6178 To: arun, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: change in-progress message
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553615610 14400 # Tue Mar 26 11:53:30 2019 -0400 # Node ID 5184a81a2a3b85327e15806158101acd5a685d44 # Parent 00c1ee0f746a5f427e81e6d18e681f6a70a2639d chistedit: change in-progress message Saying "running histedit" is an artifact of when chistedit was a separate thing from histedit. I found the message a bit confusing, since wasn't I running histedit from the beginning, just from the curses interface? The whole thing is now histedit, both the curses interface and the underlying procedure to apply a plan, so let's use a message that doesn't make a distinction. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1497,7 +1497,7 @@ def _chistedit(ui, repo, *freeargs, **op ui.write(_("histedit aborted\n")) return 0 if type(rc) is list: -ui.status(_("running histedit\n")) +ui.status(_("performing changes\n")) rules = makecommands(rc) filename = repo.vfs.join('chistedit') with open(filename, 'w+') as fp: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] shelve: add --keep to list of allowables
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553472793 14400 # Sun Mar 24 20:13:13 2019 -0400 # Node ID 4b1cb76ab29461a0a4c5ff12bb364ea2bb5b1b89 # Parent 50d5e64ec561a8227ad32fe86c1811963e7664cd shelve: add --keep to list of allowables diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -1120,6 +1120,7 @@ def shelvecmd(ui, repo, *pats, **opts): # ('date', {'create'}), # ignored for passing '--date "0 0"' in tests ('delete', {'delete'}), ('edit', {'create'}), +('keep', {'create'}), ('list', {'list'}), ('message', {'create'}), ('name', {'create'}), diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -933,6 +933,15 @@ Test shelve --keep $ hg unshelve unshelving change 'default' + $ hg shelve --keep --list + abort: options '--list' and '--keep' may not be used together + [255] + $ hg shelve --keep --patch + abort: options '--patch' and '--keep' may not be used together + [255] + $ hg shelve --keep --delete + abort: options '--delete' and '--keep' may not be used together + [255] $ hg shelve --keep shelved as default $ hg diff ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] phabricator: better error message when phabread fails to get a differential
# HG changeset patch # User Laurent Peuch # Date 1553469818 14400 # Sun Mar 24 19:23:38 2019 -0400 # Node ID a39d18493bf66aa29f7d0dc1c5a4164b84507e1b # Parent ba064f95175e6cb1467401a3a536d8c32229d4b1 phabricator: better error message when phabread fails to get a differential diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -783,8 +783,9 @@ def querydrev(repo, spec): prefetched[drev[b'phid']] = drev prefetched[int(drev[b'id'])] = drev if key not in prefetched: -raise error.Abort(_(b'cannot get Differential Revision %r') - % params) +raise error.Abort(_(b'cannot get Differential Revision %s using the params %r.' + % (key, params)), + hint=_("check that the Differential Revision exists and that you have access to it")) return prefetched[key] def getstack(topdrevids): diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t --- a/tests/test-phabricator.t +++ b/tests/test-phabricator.t @@ -28,6 +28,9 @@ this test. $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \ > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long. + $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4481 | head + abort: cannot get Differential Revision 4481 using the params {'ids': [4481]}. + (check that the Differential Revision exists and that you have access to it) Basic phabread: $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3 V2] shelve: refactor _shelvecreatedcommit's match object into calling site
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553274206 14400 # Fri Mar 22 13:03:26 2019 -0400 # Node ID e61152452e42c8bd357618f389afca8492e05651 # Parent 773e8b313d28d85002c459ea69d3671e7a0bc05e shelve: refactor _shelvecreatedcommit's match object into calling site We might need to use this match object again to move the dirstate in case the user requested to `--keep` the changes. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -420,14 +420,11 @@ def _nothingtoshelvemessaging(ui, repo, else: ui.status(_("nothing changed\n")) -def _shelvecreatedcommit(repo, node, name): +def _shelvecreatedcommit(repo, node, name, match): info = {'node': nodemod.hex(node)} shelvedfile(repo, name, 'shelve').writeinfo(info) bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) -# Create a matcher so that prefetch doesn't attempt to fetch the entire -# repository pointlessly. -match = scmutil.matchfiles(repo, repo[node].files()) with shelvedfile(repo, name, patchextension).opener('wb') as fp: cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True), match=match) @@ -501,7 +498,10 @@ def _docreatecmd(ui, repo, pats, opts): _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 -_shelvecreatedcommit(repo, node, name) +# Create a matcher so that prefetch doesn't attempt to fetch +# the entire repository pointlessly +match = scmutil.matchfiles(repo, repo[node].files()) +_shelvecreatedcommit(repo, node, name, match) if ui.formatted(): desc = stringutil.ellipsis(desc, ui.termwidth()) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3 V2] shelve: new keep option
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553268263 14400 # Fri Mar 22 11:24:23 2019 -0400 # Node ID 773e8b313d28d85002c459ea69d3671e7a0bc05e # Parent b1bc6e5f5249d0633db73be3c6853273485f3919 shelve: new keep option Does nothing yet. The docstring describes what it will soon be doing. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -1055,6 +1055,8 @@ def _dounshelve(ui, repo, *shelved, **op _('delete the named shelved change(s)')), ('e', 'edit', False, _('invoke editor on commit messages')), + ('k', 'keep', False, + _('shelve, but keep changes in the working directory')), ('l', 'list', None, _('list current shelves')), ('m', 'message', '', diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -76,6 +76,7 @@ shelve has a help message --date DATE shelve with the specified commit date -d --delete delete the named shelved change(s) -e --editinvoke editor on commit messages + -k --keepshelve, but keep changes in the working directory -l --listlist current shelves -m --message TEXTuse text as shelve message -n --name NAME use the given name for the shelved commit ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3 V2] shelve: do not update when keeping changes, just move the dirstate
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553268407 14400 # Fri Mar 22 11:26:47 2019 -0400 # Node ID 370831f0c08f4f635874d6abb0505825024f6b36 # Parent e61152452e42c8bd357618f389afca8492e05651 shelve: do not update when keeping changes, just move the dirstate This is to leave the working directory unchanged. We reuse the match object as an optimisation. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -499,14 +499,19 @@ def _docreatecmd(ui, repo, pats, opts): return 1 # Create a matcher so that prefetch doesn't attempt to fetch -# the entire repository pointlessly +# the entire repository pointlessly, and as an optimisation +# for movedirstate, if needed. match = scmutil.matchfiles(repo, repo[node].files()) _shelvecreatedcommit(repo, node, name, match) if ui.formatted(): desc = stringutil.ellipsis(desc, ui.termwidth()) ui.status(_('shelved as %s\n') % name) -hg.update(repo, parent.node()) +if opts['keep']: +with repo.dirstate.parentchange(): +scmutil.movedirstate(repo, parent, match) +else: +hg.update(repo, parent.node()) if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): repo.dirstate.setbranch(origbranch) diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -928,6 +928,20 @@ with general delta Stream params: {Compression: BZ} changegroup -- {nbchanges: 1, version: 02} (mandatory: True) 330882a04d2ce8487636b1fb292e5beea77fa1e3 + +Test shelve --keep + + $ hg unshelve + unshelving change 'default' + $ hg shelve --keep + shelved as default + $ hg diff + diff --git a/jungle b/jungle + new file mode 100644 + --- /dev/null + +++ b/jungle + @@ -0,0 +1,1 @@ + +babar $ cd .. Test visibility of in-memory changes inside transaction to external hook ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] samplehgrcs: update the list of suggested extensions
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553272205 14400 # Fri Mar 22 12:30:05 2019 -0400 # Node ID 69a86f363473147d9befa7aedde1867075cda0b1 # Parent a4799c377f869cd6b0e7f5233d7bfed4c647cccb samplehgrcs: update the list of suggested extensions Back in the day, this was color and pager, both of which are now default. Churn isn't that popular, but the other four below (obviously?) are. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -100,7 +100,10 @@ username = # uncomment the lines below to enable some popular extensions # (see 'hg help extensions' for more info) # -# churn = +# histedit = +# rebase = +# shelve = +# uncommit = """, 'cloned': ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] samplehgrcs: clarify which lines should be uncommented
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553272139 14400 # Fri Mar 22 12:28:59 2019 -0400 # Node ID a4799c377f869cd6b0e7f5233d7bfed4c647cccb # Parent b1bc6e5f5249d0633db73be3c6853273485f3919 samplehgrcs: clarify which lines should be uncommented The original wording has confused at least one person. Hopefully it's clearer this way. https://stackoverflow.com/questions/55288177/adding-hg-strip-to-hgrc-config-file diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -97,7 +97,7 @@ username = # paginate = never [extensions] -# uncomment these lines to enable some popular extensions +# uncomment the lines below to enable some popular extensions # (see 'hg help extensions' for more info) # # churn = @@ -149,7 +149,7 @@ b"""# example system-wide hg config (see # paginate = never [extensions] -# uncomment these lines to enable some popular extensions +# uncomment the lines below to enable some popular extensions # (see 'hg help extensions' for more info) # # blackbox = ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] shelve: new keep option
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553268263 14400 # Fri Mar 22 11:24:23 2019 -0400 # Node ID 773e8b313d28d85002c459ea69d3671e7a0bc05e # Parent b1bc6e5f5249d0633db73be3c6853273485f3919 shelve: new keep option Does nothing yet. The docstring describes what it will soon be doing. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -1055,6 +1055,8 @@ def _dounshelve(ui, repo, *shelved, **op _('delete the named shelved change(s)')), ('e', 'edit', False, _('invoke editor on commit messages')), + ('k', 'keep', False, + _('shelve, but keep changes in the working directory')), ('l', 'list', None, _('list current shelves')), ('m', 'message', '', diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -76,6 +76,7 @@ shelve has a help message --date DATE shelve with the specified commit date -d --delete delete the named shelved change(s) -e --editinvoke editor on commit messages + -k --keepshelve, but keep changes in the working directory -l --listlist current shelves -m --message TEXTuse text as shelve message -n --name NAME use the given name for the shelved commit ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] shelve: do not update when keeping changes, just set the right parent
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553268335 14400 # Fri Mar 22 11:25:35 2019 -0400 # Node ID 6bff7f54a5f20e72e63edbceb2a34d86fb4c86f4 # Parent 773e8b313d28d85002c459ea69d3671e7a0bc05e shelve: do not update when keeping changes, just set the right parent This is not enough to enable `shelve --keep` to work, but it's a necessary first step. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -506,7 +506,10 @@ def _docreatecmd(ui, repo, pats, opts): if ui.formatted(): desc = stringutil.ellipsis(desc, ui.termwidth()) ui.status(_('shelved as %s\n') % name) -hg.update(repo, parent.node()) +if opts['keep']: +repo.setparents(parent.node(), nodemod.nullid) +else: +hg.update(repo, parent.node()) if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): repo.dirstate.setbranch(origbranch) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] shelve: do not restore dirstate when keeping wdir changes
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1553268407 14400 # Fri Mar 22 11:26:47 2019 -0400 # Node ID c0f2ceec4a2d06bb4950916db3bb91300cb091da # Parent 6bff7f54a5f20e72e63edbceb2a34d86fb4c86f4 shelve: do not restore dirstate when keeping wdir changes This completes the implementation of `shelve --keep`. Creating a backup of the dirstate is necessary so that closing the transaction won't also destroy the working directory changes, however, restoring that backup does touch the wdir. Thus, we have to pass down the `keep` parameter down to a few functions to get the right functionality. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -323,13 +323,14 @@ def _restoreactivebookmark(repo, mark): if mark: bookmarks.activate(repo, mark) -def _aborttransaction(repo, tr): +def _aborttransaction(repo, tr, keep=False): '''Abort current transaction for shelve/unshelve, but keep dirstate ''' dirstatebackupname = 'dirstate.shelve' repo.dirstate.savebackup(tr, dirstatebackupname) tr.abort() -repo.dirstate.restorebackup(None, dirstatebackupname) +if not keep: +repo.dirstate.restorebackup(None, dirstatebackupname) def getshelvename(repo, parent, opts): """Decide on the name this shelve is going to have""" @@ -439,11 +440,11 @@ def _includeunknownfiles(repo, pats, opt extra['shelve_unknown'] = '\0'.join(s.unknown) repo[None].add(s.unknown) -def _finishshelve(repo, tr): -if phases.supportinternal(repo): +def _finishshelve(repo, tr, keep=False): +if phases.supportinternal(repo) and not keep: tr.close() else: -_aborttransaction(repo, tr) +_aborttransaction(repo, tr, keep=keep) def createcmd(ui, repo, pats, opts): """subcommand that creates a new shelve""" @@ -513,7 +514,7 @@ def _docreatecmd(ui, repo, pats, opts): if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): repo.dirstate.setbranch(origbranch) -_finishshelve(repo, tr) +_finishshelve(repo, tr, keep=opts['keep']) finally: _restoreactivebookmark(repo, activebookmark) lockmod.release(tr, lock) diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -928,6 +928,20 @@ with general delta Stream params: {Compression: BZ} changegroup -- {nbchanges: 1, version: 02} (mandatory: True) 330882a04d2ce8487636b1fb292e5beea77fa1e3 + +Test shelve --keep + + $ hg unshelve + unshelving change 'default' + $ hg shelve --keep + shelved as default + $ hg diff + diff --git a/jungle b/jungle + new file mode 100644 + --- /dev/null + +++ b/jungle + @@ -0,0 +1,1 @@ + +babar $ cd .. Test visibility of in-memory changes inside transaction to external hook ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: ensure a locale is set
On Wed, 2019-02-20 at 11:22 +0900, Yuya Nishihara wrote: > Perhaps, we shouldn't do setlocale() until curses is actually used. Hm, that's a good point. Move it to _chisteditmain? That's the entry point, I think. Or maybe we should make our own wrapper curses module so it can be demandimported and use that from both chistedit and crecord? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3 V2] color: change color of grep.rev label
On Wed, 2019-02-20 at 11:49 +0900, Yuya Nishihara wrote: > I've marked this as "(BC)" since this is IMHO a significant change. > Blue on black is unreadable on my machine. It's kind of hard to predict what will be readable. Linux terminal emulators usually let you define "blue" to be whatever you want. I wasn't sure if colour changes were BC, but I did put them in separate commits so they could easily be separately dropped. I'm okay with not changing the default colours and just adding more stuff to my config. The only part I really wanted was extra labels. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: ensure a locale is set
On Tue, 2019-02-19 at 10:29 -0500, Augie Fackler wrote: > On Fri, Feb 15, 2019 at 02:59:37PM -0500, Jordi Gutiérrez Hermoso wrote: > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso > > # Date 1550260567 18000 > > # Fri Feb 15 14:56:07 2019 -0500 > > # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb > > # Parent a22321f2b1ee18ea09a70fee9e524d2f0298 > > chistedit: ensure a locale is set > > u, if you say so > > queued If it's any reassurance, crecord does this too, and you haven't seen weirndess when picking hunks, have you? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] negrev: return empty for wdir() and nullrev
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550551420 18000 # Mon Feb 18 23:43:40 2019 -0500 # Node ID 379d5bef7d3601d43c5d7d4c4c39d7014bc71208 # Parent 37b33c34bf4f890857b5e8728febbc82a99368a5 negrev: return empty for wdir() and nullrev I considered just returning the same output that {rev} returns here, but {rev} also returns essentially gibberish: either an INT_MAX-kind of variable for wdir() or -1 for null. Since these are numbers that are intended to be used for calculations, and since the numbers for wdir() and -1 are not really very helpful for calculation (and worse, when used as a revision number -1 is equal to unhidden tip), I figured the most reasonable thing to do here is to just return nothing for negrev. This could potentially break scripts that are expecting to parse a nonempty integer out of a {negrev}, but that seems like a very remote concern at this juncture. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -559,8 +559,11 @@ def shownegrev(context, mapping): """Integer. The repository-local changeset negative revision number, which counts in the opposite direction.""" ctx = context.resource(mapping, 'ctx') +rev = ctx.rev() +if rev is None or rev < 0: # wdir() or nullrev? +return None repo = context.resource(mapping, 'repo') -return scmutil.intrev(ctx) - len(repo) +return rev - len(repo) @templatekeyword('node', requires={'ctx'}) def shownode(context, mapping): diff --git a/tests/test-template-keywords.t b/tests/test-template-keywords.t --- a/tests/test-template-keywords.t +++ b/tests/test-template-keywords.t @@ -76,6 +76,12 @@ experimental: $ hg log -r 'wdir()' -T '{manifest}\n' 2147483647: +However, for negrev, we refuse to output anything (as well as for null) + + $ hg log -r 'wdir() + null' -T 'bla{negrev}nk\n' + blank + blank + Changectx-derived keywords are disabled within {manifest} as {node} changes: $ hg log -r0 -T 'outer:{p1node} {manifest % "inner:{p1node}"}\n' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] test-sqlitestore: run sqlite3 with no init file
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550533461 18000 # Mon Feb 18 18:44:21 2019 -0500 # Node ID 3cac2f5ea9314a7d45079e629e0570bebcb3b6bf # Parent 37b33c34bf4f890857b5e8728febbc82a99368a5 test-sqlitestore: run sqlite3 with no init file These tests were failing for me because I have a ~/.sqliterc that alters the default output. Tests should ignore any init file. diff --git a/tests/test-sqlitestore.t b/tests/test-sqlitestore.t --- a/tests/test-sqlitestore.t +++ b/tests/test-sqlitestore.t @@ -71,17 +71,17 @@ Can make a local commit That results in a row being inserted into various tables - $ sqlite3 .hg/store/db.sqlite << EOF + $ sqlite3 .hg/store/db.sqlite -init /dev/null << EOF > SELECT * FROM filepath; > EOF 1|foo - $ sqlite3 .hg/store/db.sqlite << EOF + $ sqlite3 .hg/store/db.sqlite -init /dev/null << EOF > SELECT * FROM fileindex; > EOF 1|1|0|-1|-1|0|0|1||6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe (esc) - $ sqlite3 .hg/store/db.sqlite << EOF + $ sqlite3 .hg/store/db.sqlite -init /dev/null << EOF > SELECT * FROM delta; > EOF 1|1| \xd2\xaf\x8d\xd2"\x01\xdd\x8dH\xe5\xdc\xfc\xae\xd2\x81\xff\x94"\xc7|0 (esc) @@ -93,7 +93,7 @@ Tracking multiple files works $ hg commit -A -m 'add bar' adding bar - $ sqlite3 .hg/store/db.sqlite << EOF + $ sqlite3 .hg/store/db.sqlite -init /dev/null << EOF > SELECT * FROM filedata ORDER BY id ASC; > EOF 1|1|foo|0|6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe|-1|-1|0|0|1| (esc) @@ -104,7 +104,7 @@ Multiple revisions of a file works $ echo a >> foo $ hg commit -m 'modify foo' - $ sqlite3 .hg/store/db.sqlite << EOF + $ sqlite3 .hg/store/db.sqlite -init /dev/null << EOF > SELECT * FROM filedata ORDER BY id ASC; > EOF 1|1|foo|0|6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe|-1|-1|0|0|1| (esc) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3 V2] color: change color of grep.rev label
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550263757 18000 # Fri Feb 15 15:49:17 2019 -0500 # Node ID 4b06afa25bb124da32fcaa56d2b81405b4163b61 # Parent 1ef5e748ebdeec679227f78179bd36bb9b3a1667 color: change color of grep.rev label GNU grep uses green for line numbers as we do, but I sometimes get a bit confused when I do `hg grep --diff -n` and get both line numbers and revisions and don't know which one is which. A different colour can help. diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -77,7 +77,7 @@ except ImportError: _defaultstyles = { 'grep.match': 'red bold', 'grep.linenumber': 'green', -'grep.rev': 'green', +'grep.rev': 'blue', 'grep.sep': 'cyan', 'grep.filename': 'magenta', 'grep.user': 'magenta', diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -50,9 +50,9 @@ simple with color $ hg --config extensions.color= grep --config color.mode=ansi \ > --color=always port port -r tip:0 - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) simple templated @@ -305,9 +305,9 @@ Test wdir [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange] $ hg grep --diff orange --color=yes - \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) - \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) - \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) $ hg grep --diff orange color:3:+:orange ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3 V2] grep: give different labels to + and - symbols
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550262244 18000 # Fri Feb 15 15:24:04 2019 -0500 # Node ID 14bb51f7e85c68b31a96ea6447f7439ac2d87e18 # Parent 37b33c34bf4f890857b5e8728febbc82a99368a5 grep: give different labels to + and - symbols I find it more useful to give different colours to plus and minus, but it's difficult to do so if the default output uses the same label for both. The following augments the names of columns with some extra labels, akin to the diff.inserted and diff.deleted labels for the diff command. This is done by adding an extra label field to the columns tuples. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2885,21 +2885,25 @@ def grep(ui, repo, pattern, *pats, **opt fm.plain(uipathfn(fn), label='grep.filename') cols = [ -('rev', '%d', rev, not plaingrep), -('linenumber', '%d', l.linenum, opts.get('line_number')), +('rev', '%d', rev, not plaingrep, ''), +('linenumber', '%d', l.linenum, opts.get('line_number'), ''), ] if diff: -cols.append(('change', '%s', change, True)) +cols.append( +('change', '%s', change, True, + 'grep.inserted ' if change == '+' else 'grep.deleted ') +) cols.extend([ -('user', '%s', formatuser(ctx.user()), opts.get('user')), +('user', '%s', formatuser(ctx.user()), opts.get('user'), ''), ('date', '%s', fm.formatdate(ctx.date(), datefmt), - opts.get('date')), + opts.get('date'), ''), ]) -for name, fmt, data, cond in cols: +for name, fmt, data, cond, extra_label in cols: if cond: fm.plain(sep, label='grep.sep') field = fieldnamemap.get(name, name) -fm.condwrite(cond, field, fmt, data, label='grep.%s' % name) +label = extra_label + ('grep.%s' % name) +fm.condwrite(cond, field, fmt, data, label=label) if not opts.get('files_with_matches'): fm.plain(sep, label='grep.sep') if not opts.get('text') and binary(): diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -299,6 +299,10 @@ Test wdir color:3:+:orange color:2:-:orange color:1:+:orange + $ hg grep --diff orange --color=debug + [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange] + [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange] + [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange] $ hg grep --diff orange color:3:+:orange ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3 V2] color: give colours to the grep.inserted and grep.deleted labels
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550263402 18000 # Fri Feb 15 15:43:22 2019 -0500 # Node ID 1ef5e748ebdeec679227f78179bd36bb9b3a1667 # Parent 14bb51f7e85c68b31a96ea6447f7439ac2d87e18 color: give colours to the grep.inserted and grep.deleted labels I find the "bold" makes it stand out a bit more when the green is next to the line number. Note that these labels are applied before the grep.change label, which is now disabled. To get the old colour, users can restore [color] grep.change = green dim to their hgrc. diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -78,11 +78,12 @@ except ImportError: 'grep.match': 'red bold', 'grep.linenumber': 'green', 'grep.rev': 'green', -'grep.change': 'green', 'grep.sep': 'cyan', 'grep.filename': 'magenta', 'grep.user': 'magenta', 'grep.date': 'magenta', +'grep.inserted': 'green bold', +'grep.deleted': 'red bold', 'bookmarks.active': 'green', 'branches.active': 'none', 'branches.closed': 'black bold', diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -304,6 +304,11 @@ Test wdir [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange] [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange] + $ hg grep --diff orange --color=yes + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc) + $ hg grep --diff orange color:3:+:orange color:2:-:orange ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Mercurial docs improvements?
On Mon, 2019-02-18 at 17:15 -0500, Ludovic Chabant wrote: > So as such, I don't think it's a good fit for a global, > repo-independent reference documentation. There's an important dogfooding component here. If we think that the hgweb docs are useless, then we should completely get rid of them and just point people instead to the new docs you're building. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Mercurial docs improvements?
On Mon, 2019-02-18 at 12:48 -0500, Ludovic Chabant wrote: > > 1. Make doc/Makefile also generate one html and man page per command and >extension. > > - This would let us see the doc for, say, `hg status` over at > https://www.mercurial-scm.org/doc/hg-status.1.html As we discussed in IRC, that page already exists, but it's hard to find: https://www.mercurial-scm.org/repo/hg/help/status > 2. Improve integration of generated docs inside the website > > - Change the html template used to generate the html docs so that it has > the standard website navigation around the content. We can make the hgweb installation at mercurial-scm.org use whatever template we want. It makes sense to me to give it a template that matches the non-hgweb part of mercurial-scm.org, including static links back to the non-hgweb site. I think making a custom template might be easier than writing parsers and converters into manpage formats (I've never really liked manpage formats to begin with though, so maybe my opinion here doesn't count.) I think as a matter of labour to be done, it would be easiest to leverage hgweb and just write a custom mercurial-scm.org template for it than anything else. Speaking of default templates, maybe we should make something other than paper the default. I don't like that it doesn't show full commit messages and it overuses zebras when showing source code. The zebras were something that mpm particularly insisted upon for a11y, but I don't think this is a common a11y practice. (This is possibly a topic for another time, though, or maybe it's related, not sure.) > - Generate some doc index page with links to all the other generated > pages (categorized links to each command page, general links to > hgignore/hgrc, extensions, etc.) hgweb already does this too, as you mentioned yourself. https://www.mercurial-scm.org/repo/hg/help > 3. Improve the website itself Good ideas here. Just looks like a lot of work. > 4. Make reference docs versioned This would be helpful. Lots of other projects do this. Postgres and Django and everything at Read The Docs comes to mind. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] templatekw: add a {negrev} keyword
On Mon, 2019-02-18 at 22:29 +0900, Yuya Nishihara wrote: > The word "negative revision" isn't correct, Why do you think so? The full phrase is "negative revision number", isn't it? > > --- a/mercurial/templatekw.py > > +++ b/mercurial/templatekw.py > > @@ -777,6 +777,14 @@ def showrev(context, mapping): > > ctx = context.resource(mapping, 'ctx') > > return scmutil.intrev(ctx) > > > > +@templatekeyword('negrev', requires={'repo', 'ctx'}) > > Moved this so the functions are roughly sorted lexicographically. Oh, okay. I thought it made sense to have rev and negrev next to each other, but I didn't noticed that there was already a different order. > There are two weird cases: > > -r 'wdir()' => not negative > -r null => unsupported negative integer (out of range) > > Maybe return None for these? Oh, these are also broken for the normal {rev} template keyword. I'll send a separate patch for those two. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] grep: give different labels to + and - symbols
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550262244 18000 # Fri Feb 15 15:24:04 2019 -0500 # Node ID b5464436e4acdd1893ee86e5aa03f1d69ce4c4c5 # Parent a22321f2b1ee18ea09a70fee9e524d2f0298 grep: give different labels to + and - symbols I find it more useful to give different colours to plus and minus, but it's difficult to do so if the default output uses the same label for both. The following augments the names of columns with some extra labels, akin to the diff.inserted and diff.deleted labels for the diff command. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2889,7 +2889,10 @@ def grep(ui, repo, pattern, *pats, **opt ('linenumber', '%d', l.linenum, opts.get('line_number')), ] if diff: -cols.append(('change', '%s', change, True)) +cols.extend([ +('inserted change' if change == '+' else 'deleted change', + '%s', change, True) +]) cols.extend([ ('user', '%s', formatuser(ctx.user()), opts.get('user')), ('date', '%s', fm.formatdate(ctx.date(), datefmt), @@ -2899,7 +2902,8 @@ def grep(ui, repo, pattern, *pats, **opt if cond: fm.plain(sep, label='grep.sep') field = fieldnamemap.get(name, name) -fm.condwrite(cond, field, fmt, data, label='grep.%s' % name) +label = " ".join('grep.%s' % n for n in name.split()) +fm.condwrite(cond, field, fmt, data, label=label) if not opts.get('files_with_matches'): fm.plain(sep, label='grep.sep') if not opts.get('text') and binary(): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] color: give colours to the grep.inserted and grep.deleted labels
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550263402 18000 # Fri Feb 15 15:43:22 2019 -0500 # Node ID 9e2f595cf719f2dd863485067517f4f6c05dee73 # Parent b5464436e4acdd1893ee86e5aa03f1d69ce4c4c5 color: give colours to the grep.inserted and grep.deleted labels I find the "bold" makes it stand out a bit more when the green is next to the line number. Note that these labels are applied before the grep.change label, which is now disabled. To get the old colour, users can restore [color] grep.change = green dim to their hgrc. diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -78,11 +78,12 @@ except ImportError: 'grep.match': 'red bold', 'grep.linenumber': 'green', 'grep.rev': 'green', -'grep.change': 'green', 'grep.sep': 'cyan', 'grep.filename': 'magenta', 'grep.user': 'magenta', 'grep.date': 'magenta', +'grep.inserted': 'green bold', +'grep.deleted': 'red bold', 'bookmarks.active': 'green', 'branches.active': 'none', 'branches.closed': 'black bold', ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] color: change color of grep.rev label
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550263757 18000 # Fri Feb 15 15:49:17 2019 -0500 # Node ID 07f0f1082c85076b6e0d0cb215fb34893170c11c # Parent 9e2f595cf719f2dd863485067517f4f6c05dee73 color: change color of grep.rev label GNU grep uses green for line numbers as we do, but I sometimes get a bit confused when I do `hg grep --diff -n` and get both line numbers and revisions and don't know which one is which. A different colour can help. diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -77,7 +77,7 @@ except ImportError: _defaultstyles = { 'grep.match': 'red bold', 'grep.linenumber': 'green', -'grep.rev': 'green', +'grep.rev': 'blue', 'grep.sep': 'cyan', 'grep.filename': 'magenta', 'grep.user': 'magenta', ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] templatekw: add a {negrev} keyword
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550259811 18000 # Fri Feb 15 14:43:31 2019 -0500 # Node ID 2aa9472715119f26f2e688dd9130f717113ec518 # Parent a22321f2b1ee18ea09a70fee9e524d2f0298 templatekw: add a {negrev} keyword Revision numbers are getting much maligned for two reasons: they are too long in large repos and users get confused by their local-only nature. It just occurred to me that negative revision numbers avoid both of those problems. Since negative revision numbers change whenever the repo changes, it's much more obvious that they are a local-only convenience. Additionally, for the recent commits that we usually care about the most, negative revision numbers are always near zero. This commit adds a negrev templatekw to more easily expose negative revision numbers. It's not easy to reliably produce this output with existing keywords due to hidden commits while at the same time ensuring good performance. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -777,6 +777,14 @@ def showrev(context, mapping): ctx = context.resource(mapping, 'ctx') return scmutil.intrev(ctx) +@templatekeyword('negrev', requires={'repo', 'ctx'}) +def shownegrev(context, mapping): +"""Integer. The repository-local changeset negative revision number, +which counts in the opposite direction.""" +ctx = context.resource(mapping, 'ctx') +repo = context.resource(mapping, 'repo') +return scmutil.intrev(ctx) - len(repo) + def showrevslist(context, mapping, name, revs): """helper to generate a list of revisions in which a mapped template will be evaluated""" 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 @@ -2429,6 +2429,23 @@ Check other fatelog implementations date:Thu Jan 01 00:00:00 1970 + summary: ROOT +Check that {negrev} shows usable negative revisions despite hidden commits + + $ hg log -G -T "{negrev}\n" + @ -3 + | + o -4 + + + $ hg log -G -T "{negrev}\n" --hidden + x -1 + | + | x -2 + |/ + | @ -3 + |/ + o -4 + Test templates with splitted and pruned commit == @@ -2639,3 +2656,10 @@ metadata should be converted back to loc |/ Obsfate: rewritten using amend as 2:718c0d00cee1 by test (at 1970-01-01 00:00 +); o ea207398892e + $ hg log -G -T "{negrev}\n" + @ -1 + | + o -2 + | + o -5 + ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: ensure a locale is set
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550260567 18000 # Fri Feb 15 14:56:07 2019 -0500 # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb # Parent a22321f2b1ee18ea09a70fee9e524d2f0298 chistedit: ensure a locale is set My paternal surname was showing incorrectly without this fix. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -948,6 +948,12 @@ def findoutgoing(ui, repo, remote=None, # Curses Support try: import curses + +# Curses requires setting the locale or it will default to the C +# locale. This sets the locale to the user's default system +# locale. +import locale +locale.setlocale(locale.LC_ALL, u'') except ImportError: curses = None ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] crecord: remove obsolete version check
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550158907 18000 # Thu Feb 14 10:41:47 2019 -0500 # Node ID 9c5c236afcc631d0dfc6a3e1424e353f6c6c85bf # Parent 5d383d9636d0b81b416398913b32b8c715e98db5 crecord: remove obsolete version check An internal function shouldn't be checking compatibility with Mercurial versions. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1546,14 +1546,7 @@ are you sure you want to review/edit and new changeset will be created (the normal commit behavior). """ -try: -ver = float(util.version()[:3]) -except ValueError: -ver = 1 -if ver < 2.19: -msg = _("The amend option is unavailable with hg versions < 2.2\n\n" -"Press any key to continue.") -elif opts.get('amend') is None: +if opts.get('amend') is None: opts['amend'] = True msg = _("Amend option is turned on -- committing the currently " "selected changes will not create a new changeset, but " ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] fix: change the default fix pattern (issue6077)
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550096863 18000 # Wed Feb 13 17:27:43 2019 -0500 # Node ID d8ba3b6466b220a5e04d07a5eccd3c1d45a2f501 # Parent 5d383d9636d0b81b416398913b32b8c715e98db5 fix: change the default fix pattern (issue6077) The matchutils functions don't know what to do with an empty pattern. When a fixer doesn't have a pattern at all, a default of None will make match functions unhappy and stack trace. Change this default instead to a pattern that matches everything. diff --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -38,7 +38,8 @@ substituted into the command:: The :pattern suboption determines which files will be passed through each configured tool. See :hg:`help patterns` for possible values. If there are file -arguments to :hg:`fix`, the intersection of these patterns is used. +arguments to :hg:`fix`, the intersection of these patterns is used. If no patterns +are specified, the default is to apply the tool to all files. There is also a configurable limit for the maximum size of file that will be processed by :hg:`fix`:: @@ -122,7 +123,7 @@ FIXER_ATTRS = { 'command': None, 'linerange': None, 'fileset': None, -'pattern': None, +'pattern': '.', 'priority': 0, } diff --git a/tests/test-fix.t b/tests/test-fix.t --- a/tests/test-fix.t +++ b/tests/test-fix.t @@ -288,17 +288,28 @@ we ignore a file that doesn't match any $ cd .. +A config file missing a :pattern suboption to match issue6077 + + $ REMOVE_WS=$TESTTMP/remove-trailing-whitespace.hgrc + $ cat >> $REMOVE_WS < [extensions] + > fix = + > [fix] + > trailing-whitespace:command = sed + > trailing-whitespace:linerange = -e '{first},{last}s/\s\+$//' + > EOF + Fixing the working directory should still work if there are no revisions. $ hg init norevisions $ cd norevisions - $ printf "something\n" > something.whole + $ printf "something \n" > something.whole $ hg add adding something.whole - $ hg fix --working-dir + $ HGRCPATH=$REMOVE_WS hg fix --working-dir $ cat something.whole - SOMETHING + something $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] fix: change the default fix pattern (issue6077)
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550096863 18000 # Wed Feb 13 17:27:43 2019 -0500 # Node ID c56534966c1641a50994a02c746e5b17cb00aa0e # Parent 5d383d9636d0b81b416398913b32b8c715e98db5 fix: change the default fix pattern (issue6077) The matchutils functions don't know what to do with an empty pattern. When a fixer doesn't have a pattern at all, a default of None will make match functions unhappy and stack trace. Change this default instead to a pattern that matches everything. diff --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -122,7 +122,7 @@ FIXER_ATTRS = { 'command': None, 'linerange': None, 'fileset': None, -'pattern': None, +'pattern': '.', 'priority': 0, } diff --git a/tests/test-fix.t b/tests/test-fix.t --- a/tests/test-fix.t +++ b/tests/test-fix.t @@ -288,17 +288,28 @@ we ignore a file that doesn't match any $ cd .. +A config file missing a :pattern suboption to match issue6077 + + $ REMOVE_WS=$TESTTMP/remove-trailing-whitespace.hgrc + $ cat >> $REMOVE_WS < [extensions] + > fix = + > [fix] + > trailing-whitespace:command = sed + > trailing-whitespace:linerange = -e '{first},{last}s/\s\+$//' + > EOF + Fixing the working directory should still work if there are no revisions. $ hg init norevisions $ cd norevisions - $ printf "something\n" > something.whole + $ printf "something \n" > something.whole $ hg add adding something.whole - $ hg fix --working-dir + $ HGRCPATH=$REMOVE_WS hg fix --working-dir $ cat something.whole - SOMETHING + something $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] chistedit: use magenta for current line as in crecord (issue6071)
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550095104 18000 # Wed Feb 13 16:58:24 2019 -0500 # Node ID e31eb021571e1a6a63aab8090819184576236c58 # Parent 5d383d9636d0b81b416398913b32b8c715e98db5 chistedit: use magenta for current line as in crecord (issue6071) It was inconsistent in the UI to have different way to show the current line. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -957,7 +957,7 @@ ACTION_LABELS = { 'roll': '^roll', } -COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN = 1, 2, 3, 4 +COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1237,6 +1237,7 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) +curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) # don't display the cursor try: @@ -1327,7 +1328,7 @@ pgup/K: move patch up, pgdn/J: move patc if y + start == selected: addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_SELECTED)) elif y + start == pos: -addln(rulesscr, y, 2, rule, curses.A_BOLD) +addln(rulesscr, y, 2, rule, curses.color_pair(COLOR_CURRENT) | curses.A_BOLD) else: addln(rulesscr, y, 2, rule) rulesscr.noutrefresh() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] histedit: remove "chistedit" mention from interface
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550091764 18000 # Wed Feb 13 16:02:44 2019 -0500 # Node ID 94ccf890584ee3bae9e543fade578e0f05281347 # Parent 5d383d9636d0b81b416398913b32b8c715e98db5 histedit: remove "chistedit" mention from interface "chisted" is internal jargon. The end user should not need to be aware that it's different from histedit. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1486,7 +1486,7 @@ def _chistedit(ui, repo, *freeargs, **op curses.echo() curses.endwin() if rc is False: -ui.write(_("chistedit aborted\n")) +ui.write(_("histedit aborted\n")) return 0 if type(rc) is list: ui.status(_("running histedit\n")) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5949: debugpathcopies: fix typo in synpsis
JordiGH added a comment. So, I haven't been here in a while. Do we still do V2s for this kind of thing? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5949 To: martinvonz, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5949: debugpathcopies: fix typo in synpsis
JordiGH added a comment. > fix typo in synpsis > in synpsis > synpsis https://en.wikipedia.org/wiki/Muphry%27s_law REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5949 To: martinvonz, #hg-reviewers Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] walkchangerevs: obey allfiles parameter when taking the slow path
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1550009431 18000 # Tue Feb 12 17:10:31 2019 -0500 # Node ID 06f76b4009c4802a48abc184984d0eebc7d7d91e # Parent 61415361e90684a8c7a031413e9182f51937c2e7 walkchangerevs: obey allfiles parameter when taking the slow path When walkchangerevs sees that there's a pattern, it hits the slow path. The slow path in turn reverts to the old dumb grep behaviour of only looking at files changed at each revision. Therefore, a command such as hg grep -l --all-files '.*' 'glob:**' would show you all the nonempty files touched by the current revision. This modifies that behaviour to look at the manifest at each revision instead of the changed files in case that --all-files was requested. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1961,7 +1961,10 @@ def walkchangerevs(repo, match, opts, pr else: self.revs.discard(value) ctx = change(value) -matches = [f for f in ctx.files() if match(f)] +if allfiles: +matches = list(ctx.manifest().walk(match)) +else: +matches = [f for f in ctx.files() if match(f)] if matches: fncache[value] = matches self.set.add(value) diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -517,5 +517,8 @@ test -rMULTIREV with --all-files $ hg grep -r "0:2" "unmod" --all-files um um:0:unmod um:1:unmod + $ hg grep -r "0:2" "unmod" --all-files "glob:**/um" # Check that patterns also work + um:0:unmod + um:1:unmod $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] changelog: introduce a 'tiprev' method
On Wed, 2018-01-17 at 19:33 +0100, Boris Feld wrote: > # HG changeset patch > # User Boris Feld> # Date 1493857401 -7200 > # Thu May 04 02:23:21 2017 +0200 > # Node ID e3bb410037a49980a8316e4e5a49ab23ea978047 > # Parent 0e369eca888fc80ee980fe8200c59dc7b0024dae > # EXP-Topic tiprev > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ > -r e3bb410037a4 > changelog: introduce a 'tiprev' method > > Accessing tiprev is a common need through the code base. It is > usually done using "len(changelog) -1". That form is tedious and > error-prone. For example, it will give wrong results on filtered > changelog (if the unfiltered tip is filtered). Funny, I had this very need yesterday, and I needed it cached, so I did this instead: http://mercurial.markmail.org/search/list:com.selenic.mercurial-devel#q uery:list%3Acom.selenic.mercurial- devel+page:1+mid:6mqe6sjrsmuixcbe+state:results ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] templatekw: add a {negrev} keyword
On Thu, 2018-01-18 at 21:05 +0900, Yuya Nishihara wrote: > On Wed, 17 Jan 2018 22:14:30 -0500, Jordi Gutiérrez Hermoso wrote: > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso <jord...@octave.org> > > # Date 1516243120 18000 > > # Wed Jan 17 21:38:40 2018 -0500 > > # Node ID cbf1d676a938e78d40cd3504dd916f787bcb47ee > > # Parent 701f8a9defdc09bb63f2596e2fc426f2e78da313 > > templatekw: add a {negrev} keyword > > > > Revision numbers are getting much maligned for two reasons: they > > are > > too long in large repos and users get confused by their local-only > > nature. It just occurred to me that negative revision numbers avoid > > both of those problems. Since negative revision numbers change > > whenever the repo changes, it's much more obvious that they are a > > local-only convenience. Additionally, for the recent commits that > > we > > usually care about the most, negative revision numbers are always > > near > > zero. > > > > This commit adds a negrev templatekw to more easily expose negative > > revision numbers. It's not easy to reliably produce this output > > with > > existing keywords due to hidden commits or without a significant > > slowdown due to computing a complicated template expression. > > Isn't it "{rev - revset("tip")|stringify - 1}" ? Well, the stringify > looks strange, but not terrible. That's incorrect if tip is hidden. And much noticeably slower. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] templatekw: add utility function numrevs
On Thu, 2018-01-18 at 21:03 +0900, Yuya Nishihara wrote: > On Wed, 17 Jan 2018 22:14:29 -0500, Jordi Gutiérrez Hermoso wrote: > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso <jord...@octave.org> > > # Date 1516242948 18000 > > # Wed Jan 17 21:35:48 2018 -0500 > > # Node ID 701f8a9defdc09bb63f2596e2fc426f2e78da313 > > # Parent 0e369eca888fc80ee980fe8200c59dc7b0024dae > > templatekw: add utility function numrevs > > > > len(repo) calls incur noticeable overhead if called for each > > revision > > a template keyword is evaluated. > > Do you have some number? It's just a proxy to revlog.__len__(), so I > think it > is super fast. The Python function calls leading up to it are not that fast. Without this caching, it takes 7.2 seconds on average on my machine to to do `hg log -T '{negrev}\n' > /dev/null`. With the caching, it takes 6.4 seconds on average. Not a huge difference, but a difference. I wanted to match the speed of `hg log -T '{rev}\n' > /dev/null`, and this caching helped me match it. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] templatekw: add utility function numrevs
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1516242948 18000 # Wed Jan 17 21:35:48 2018 -0500 # Node ID 701f8a9defdc09bb63f2596e2fc426f2e78da313 # Parent 0e369eca888fc80ee980fe8200c59dc7b0024dae templatekw: add utility function numrevs len(repo) calls incur noticeable overhead if called for each revision a template keyword is evaluated. We obviously can't cache __len__ functions in general because many commands modify the repo size. For template keywords, however, the repo is read-only so we can benefit from a cache. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -852,6 +852,10 @@ def showrev(repo, ctx, templ, **args): """Integer. The repository-local changeset revision number.""" return scmutil.intrev(ctx) +@util.cachefunc +def numrevs(repo): +return len(repo) + def showrevslist(name, revs, **args): """helper to generate a list of revisions in which a mapped template will be evaluated""" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] templatekw: add a {negrev} keyword
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1516243120 18000 # Wed Jan 17 21:38:40 2018 -0500 # Node ID cbf1d676a938e78d40cd3504dd916f787bcb47ee # Parent 701f8a9defdc09bb63f2596e2fc426f2e78da313 templatekw: add a {negrev} keyword Revision numbers are getting much maligned for two reasons: they are too long in large repos and users get confused by their local-only nature. It just occurred to me that negative revision numbers avoid both of those problems. Since negative revision numbers change whenever the repo changes, it's much more obvious that they are a local-only convenience. Additionally, for the recent commits that we usually care about the most, negative revision numbers are always near zero. This commit adds a negrev templatekw to more easily expose negative revision numbers. It's not easy to reliably produce this output with existing keywords due to hidden commits or without a significant slowdown due to computing a complicated template expression. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -856,6 +856,12 @@ def showrev(repo, ctx, templ, **args): def numrevs(repo): return len(repo) +@templatekeyword('negrev') +def showrev(repo, ctx, templ, **args): +"""Integer. The repository-local changeset negative revision number, +which counts in the opposite direction.""" +return scmutil.intrev(ctx) - numrevs(repo) + def showrevslist(name, revs, **args): """helper to generate a list of revisions in which a mapped template will be evaluated""" 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 @@ -2409,6 +2409,23 @@ Check other fatelog implementations date:Thu Jan 01 00:00:00 1970 + summary: ROOT +Check that {negrev} shows usable negative revisions despite hidden commits + + $ hg log -G -T "{negrev}\n" + @ -3 + | + o -4 + + + $ hg log -G -T "{negrev}\n" --hidden + x -1 + | + | x -2 + |/ + | @ -3 + |/ + o -4 + Test templates with splitted and pruned commit == @@ -2559,3 +2576,10 @@ Check other fatelog implementations date:Thu Jan 01 00:00:00 1970 + summary: ROOT + $ hg log -G -T "{negrev}\n" + @ -1 + | + o -2 + | + o -4 + ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] test-convert-svn-move: sort svn checkout output
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1516245130 18000 # Wed Jan 17 22:12:10 2018 -0500 # Node ID 358f30e953d94c13d0dbf4c149130ab69f2c76bf # Parent 3a379eceab7886ae9a8f661c648c2759c69a9013 test-convert-svn-move: sort svn checkout output It turns out that there's no guarantee in which order svn will traverse a directory while performing a checkout. Sorting the output will make these tests stable. diff --git a/tests/test-convert-svn-source.t b/tests/test-convert-svn-source.t --- a/tests/test-convert-svn-source.t +++ b/tests/test-convert-svn-source.t @@ -268,7 +268,7 @@ try converting when we have an svn subre $ cd withmerge $ echo "subrepo = [svn]$SVNREPOURL" >.hgsub $ hg add .hgsub - $ svn checkout "$SVNREPOURL" subrepo + $ svn checkout "$SVNREPOURL" subrepo | sort Asubrepo/proj B Asubrepo/proj B/mytrunk Asubrepo/proj B/mytrunk/letter .txt @@ -305,7 +305,8 @@ try converting when we have an svn subre 1 Adding file2 0 merged $ cd withmerge-converted - $ hg up + $ hg up | sort + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved Asubrepo/proj B Asubrepo/proj B/mytrunk Asubrepo/proj B/mytrunk/letter .txt @@ -317,7 +318,6 @@ try converting when we have an svn subre Asubrepo/proj B/tags/v0.2/letter .txt Asubrepo/proj B/tags/v0.2/letter2.txt Checked out revision 9. - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ ls file1.txt file2.txt ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Ideas and mentors for GSoC 2018.
On Wed, 2018-01-17 at 01:01 +0530, Pulkit Goyal wrote: > Also, if you have sometime available during the summers and > interested to mentor a student in the program, it will be great. > Please let me know. I think GrepPlan might be feasible for a GSoC student. If you agree, I can probably mentor for it. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] svnsubrepo: check if subrepo is missing when checking dirty state (issue5657)
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1516110014 18000 # Tue Jan 16 08:40:14 2018 -0500 # Node ID 3a379eceab7886ae9a8f661c648c2759c69a9013 # Parent cebbb137db75c45e891a65a8dbc50631ed8cb83c svnsubrepo: check if subrepo is missing when checking dirty state (issue5657) During an hg convert command, subrepos are not checked out. However, a manifestmerge may occur during an hg convert if there is a merge commit, which in particular will check the dirty state of subrepos. Before this change, the lack of a checked out subrepo would error out. This check for svn subrepos is modelled after 2fdea636f254 for git subrepos. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1336,6 +1336,8 @@ class svnsubrepo(abstractsubrepo): @annotatesubrepoerror def dirty(self, ignoreupdate=False, missing=False): +if self._svnmissing(): +return self._state[1] != '' wcchanged = self._wcchanged() changed = wcchanged[0] or (missing and wcchanged[2]) if not changed: diff --git a/tests/test-convert-svn-source.t b/tests/test-convert-svn-source.t --- a/tests/test-convert-svn-source.t +++ b/tests/test-convert-svn-source.t @@ -253,3 +253,72 @@ depot that can be seen from the test env abort: svn-empty: missing or unsupported repository [255] $ mv format svn-empty/format + +enable svn subrepos + + $ cat >> $HGRCPATH < [subrepos] + > svn:allowed = true + > EOF + +try converting when we have an svn subrepo and a merge in hg superrepo (issue5657) + + $ cd "$TESTTMP" + $ hg init withmerge + $ cd withmerge + $ echo "subrepo = [svn]$SVNREPOURL" >.hgsub + $ hg add .hgsub + $ svn checkout "$SVNREPOURL" subrepo + Asubrepo/proj B + Asubrepo/proj B/mytrunk + Asubrepo/proj B/mytrunk/letter .txt + Asubrepo/proj B/mytrunk/letter2.txt + Asubrepo/proj B/tags + Asubrepo/proj B/tags/v0.1 + Asubrepo/proj B/tags/v0.1/letter .txt + Asubrepo/proj B/tags/v0.2 + Asubrepo/proj B/tags/v0.2/letter .txt + Asubrepo/proj B/tags/v0.2/letter2.txt + Checked out revision 9. + $ hg ci -m "Adding svn subrepo" + $ touch file1.txt + $ hg add file1.txt + $ hg ci -m "Adding file1" + $ hg up 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ touch file2.txt + $ hg add file2.txt + $ hg ci -m "Adding file2" + created new head + $ hg merge 1 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m "merged" + $ cd .. + $ hg --config extensions.convert= convert withmerge withmerge-converted + initializing destination withmerge-converted repository + scanning source... + sorting... + converting... + 3 Adding svn subrepo + 2 Adding file1 + 1 Adding file2 + 0 merged + $ cd withmerge-converted + $ hg up + Asubrepo/proj B + Asubrepo/proj B/mytrunk + Asubrepo/proj B/mytrunk/letter .txt + Asubrepo/proj B/mytrunk/letter2.txt + Asubrepo/proj B/tags + Asubrepo/proj B/tags/v0.1 + Asubrepo/proj B/tags/v0.1/letter .txt + Asubrepo/proj B/tags/v0.2 + Asubrepo/proj B/tags/v0.2/letter .txt + Asubrepo/proj B/tags/v0.2/letter2.txt + Checked out revision 9. + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ ls + file1.txt + file2.txt + subrepo ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] svnsubrepo: decorate dirty method with annotatesubrepoerror
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1515949528 18000 # Sun Jan 14 12:05:28 2018 -0500 # Node ID fde3cd2487e1f4d5867bf8c6e79139b6fe475779 # Parent 58fda95a0202fc6327d1f5d9df26f7ff16538d57 svnsubrepo: decorate dirty method with annotatesubrepoerror This function invokes svn commands which can error out in any number of ways, so it's helpful to know in which subrepo this error happens. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1331,6 +1331,7 @@ class svnsubrepo(abstractsubrepo): return True, True, bool(missing) return bool(changes), False, bool(missing) +@annotatesubrepoerror def dirty(self, ignoreupdate=False, missing=False): wcchanged = self._wcchanged() changed = wcchanged[0] or (missing and wcchanged[2]) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] templates: reword 'back to filelog' link anchor text
# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1511206254 18000 # Mon Nov 20 14:30:54 2017 -0500 # Node ID 9f2ad7bc901216d6340952f463ab06568fc82dfb # Parent 75013952d8d9608f73cd45f68405fbd6ec112bf2 templates: reword 'back to filelog' link anchor text This anchor text is problematic in two ways: first, the "back to" part assumes that you got to the page showing it via the filelog. This is not necessarily true, as there are other ways to get to that view besides the filelog view, such as for example following the history of lines from a file. Second, it uses "filelog" jargon, which refers to how each file has its own revlog. This is internal jargon that has no business being exposed to the end user. I just reworded this template to improve understanding. diff --git a/mercurial/templates/gitweb/filelog.tmpl b/mercurial/templates/gitweb/filelog.tmpl --- a/mercurial/templates/gitweb/filelog.tmpl +++ b/mercurial/templates/gitweb/filelog.tmpl @@ -36,7 +36,7 @@ revisions | {file|urlescape}{if(linerange, -' (following lines {linerange}{if(descend, ', descending')} back to filelog)')} +' (following lines {linerange}{if(descend, ', descending')} all revisions for this file)')} diff --git a/mercurial/templates/paper/filelog.tmpl b/mercurial/templates/paper/filelog.tmpl --- a/mercurial/templates/paper/filelog.tmpl +++ b/mercurial/templates/paper/filelog.tmpl @@ -48,7 +48,7 @@ log {file|escape} @ {rev}:{node|short} {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag} {if(linerange, -' (following lines {linerange}{if(descend, ', descending')} back to filelog)')} +' (following lines {linerange}{if(descend, ', descending')} all revisions for this file)')} {searchform} ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH evolve-ext] fold: disallow multiple revisions without --exact
On Fri, 2016-11-04 at 16:58 -0700, Martin von Zweigbergk via Mercurial-devel wrote: > # HG changeset patch > # User Martin von Zweigbergk> # Date 1478303512 25200 > # Fri Nov 04 16:51:52 2016 -0700 > # Node ID bb80851fe9a6e14263f0076074108556377141f9 > # Parent cb2bac3253fbd52894ffcb4719a148fe6a3da38b > fold: disallow multiple revisions without --exact > > It's very easy to think that "hg fold 4::6" will fold exactly those > revisions. In reality, it will fold those *and* any revisions between > them and the working copy. It seems very likely that users who pass > more than one revision wants to fold exactly those revisions, so let's > abort and hint that they may be looking for --exact. There was some kind of explicit reason for why originally Pierre-Yves convinced me that the current behaviour was correct. Something about how `hg fold 'draft()'` would be a common thing. I can't remember the justification anymore, something about how it's impossible to predict in advance if a revset is a single or multiple commits. I think I agree with everyone that --exact should probably just become the default again as it once was. No more `hg fold .^`, you must now do `hg fold '. + .^'` like before. Everyone seems to really want --exact and gets surprised by the magic of trying to include "." in the folded set. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel