D5477: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5477#81186, @yuja wrote: > I tried to queue this, but the patch doesn't include any metadata (e.g. author > and date.) Please check your configuration. > > https://www.mercurial-scm.org/wiki/Phabricator @yuja I'm really sorry about that. I was updating the diff within the phabricator UI itself without committing the changes. Everything is fixed in https://phab.mercurial-scm.org/D5486. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 To: navaneeth.suresh, #hg-reviewers Cc: lothiraldan, pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5486: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5486 AFFECTED FILES mercurial/commands.py tests/test-branches.t tests/test-completion.t CHANGE DETAILS diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -238,7 +238,7 @@ bisect: reset, good, bad, skip, extend, command, noupdate bookmarks: force, rev, delete, rename, inactive, list, template branch: force, clean, rev - branches: active, closed, template + branches: active, closed, rev, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -157,6 +157,18 @@ summary: Adding b branch + going to test branch listing by rev + $ hg branches -r0 + default0:19709c5a4e75 (inactive) + $ hg branches -qr0 + default +--- now more than one rev + $ hg branches -r2:5 + b 4:aee39cd168d0 + a 5:d8cbc61dbaa6 (inactive) + $ hg branches -qr2:5 + b + a going to test branch closing $ hg branches diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1129,6 +1129,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1158,13 +1159,22 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +selectedbranches = None +if revs: +revs = scmutil.revrange(repo, revs) +getbi = repo.revbranchcache().branchinfo +selectedbranches = {getbi(r)[0] for r in revs} + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc allheads = set(repo.heads()) branches = [] for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if selectedbranches is not None and tag not in selectedbranches: +continue isactive = False if not isclosed: openheads = set(repo.branchmap().iteropen(heads)) @@ -6153,4 +6163,4 @@ if overrides: ui.warn(_("extension '%s' overrides commands: %s\n") % (name, " ".join(overrides))) -table.update(cmdtable) +table.update(cmdtable) \ No newline at end of file To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5486: branches: add -r option to show branch name(s) of a given rev (issue5948)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4506f801e492: branches: add -r option to show branch name(s) of a given rev (issue5948) (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5486?vs=12989=12991#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5486?vs=12989=12991 REVISION DETAIL https://phab.mercurial-scm.org/D5486 AFFECTED FILES mercurial/commands.py tests/test-branches.t tests/test-completion.t CHANGE DETAILS diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -238,7 +238,7 @@ bisect: reset, good, bad, skip, extend, command, noupdate bookmarks: force, rev, delete, rename, inactive, list, template branch: force, clean, rev - branches: active, closed, template + branches: active, closed, rev, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -157,6 +157,18 @@ summary: Adding b branch + going to test branch listing by rev + $ hg branches -r0 + default0:19709c5a4e75 (inactive) + $ hg branches -qr0 + default +--- now more than one rev + $ hg branches -r2:5 + b 4:aee39cd168d0 + a 5:d8cbc61dbaa6 (inactive) + $ hg branches -qr2:5 + b + a going to test branch closing $ hg branches diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1132,6 +1132,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1161,13 +1162,22 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +selectedbranches = None +if revs: +revs = scmutil.revrange(repo, revs) +getbi = repo.revbranchcache().branchinfo +selectedbranches = {getbi(r)[0] for r in revs} + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc allheads = set(repo.heads()) branches = [] for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if selectedbranches is not None and tag not in selectedbranches: +continue isactive = False if not isclosed: openheads = set(repo.branchmap().iteropen(heads)) To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh updated this revision to Diff 12995. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5485?vs=12983=12995 REVISION DETAIL https://phab.mercurial-scm.org/D5485 AFFECTED FILES mercurial/logcmdutil.py CHANGE DETAILS diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -55,8 +55,8 @@ return limit def diffordiffstat(ui, repo, diffopts, node1, node2, match, - changes=None, stat=False, fp=None, prefix='', - root='', listsubrepos=False, hunksfilterfn=None): + changes=None, stat=False, graphwidth=0, fp=None, + prefix='', root='', listsubrepos=False, hunksfilterfn=None): '''show diff or diffstat.''' if root: relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) @@ -76,7 +76,7 @@ diffopts = diffopts.copy(context=0, noprefix=False) width = 80 if not ui.plain(): -width = ui.termwidth() +width = ui.termwidth() - graphwidth chunks = repo[node2].diff(repo[node1], match, changes, opts=diffopts, prefix=prefix, relroot=relroot, @@ -130,12 +130,13 @@ def _makehunksfilter(self, ctx): return None -def showdiff(self, ui, ctx, diffopts, stat=False): +def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False): repo = ctx.repo() node = ctx.node() prev = ctx.p1().node() diffordiffstat(ui, repo, diffopts, prev, node, match=self._makefilematcher(ctx), stat=stat, + graphwidth=graphwidth, hunksfilterfn=self._makehunksfilter(ctx)) def changesetlabels(ctx): @@ -193,6 +194,9 @@ def _show(self, ctx, copies, props): '''show a single changeset or file revision''' changenode = ctx.node() +graphwidth = props.get('graphwidth') +if not graphwidth: +graphwidth = 0 if self.ui.quiet: self.ui.write("%s\n" % scmutil.formatchangeid(ctx), @@ -285,7 +289,7 @@ label='log.summary') self.ui.write("\n") -self._showpatch(ctx) +self._showpatch(ctx, graphwidth) def _showobsfate(self, ctx): # TODO: do not depend on templater @@ -304,13 +308,15 @@ '''empty method used by extension as a hook point ''' -def _showpatch(self, ctx): +def _showpatch(self, ctx, graphwidth=0): if self._includestat: -self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True) +self._differ.showdiff(self.ui, ctx, self._diffopts, + graphwidth, stat=True) if self._includestat and self._includediff: self.ui.write("\n") if self._includediff: -self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False) +self._differ.showdiff(self.ui, ctx, self._diffopts, + graphwidth, stat=False) if self._includestat or self._includediff: self.ui.write("\n") To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh added a comment. > IIUC, the problem is that the `width` parameter is incorrect because of > graph lines. Thanks for the insight Yuya! I guess my current revision addresses what you meant by abusing `graphwidth` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5485 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5490#81294, @pulkit wrote: > I am not sure whether this change is correct or not, but please add more description to your commit message explaining what this patch is doing, what the issue is about and how it fixes that. Done @pulkit REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh added a comment. Thanks for queuing Yuya! > Reordered arguments to fix mq failure. Next time, please run all tests. Sure will do. Sorry about that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5485 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6a63ba61e71f: log: fix line wrap on diffstat with -G/--graph (issue5800) (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5485?vs=12996=12997#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5485?vs=12996=12997 REVISION DETAIL https://phab.mercurial-scm.org/D5485 AFFECTED FILES mercurial/logcmdutil.py tests/test-log.t CHANGE DETAILS diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2637,3 +2637,123 @@ summary: A1B1C1 $ cd .. + +--- going to test line wrap fix on using both --stat and -G (issue5800) + $ hg init issue5800 + $ cd issue5800 + $ touch a + $ hg ci -Am 'add a' + adding a + now we are going to add 300 lines to a + $ for i in `$TESTDIR/seq.py 1 300`; do echo $i >> a; done + $ hg ci -m 'modify a' + $ hg log + changeset: 1:a98683e6a834 + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + changeset: 0:ac82d8b1f7c4 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: add a + + now visualise the changes we made without template + $ hg log -l1 -r a98683e6a834 --stat -G + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + with template + $ hg log -l1 -r a98683e6a834 --stat -G -T bisect + @ changeset: 1:a98683e6a834 + | bisect: + ~ tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T changelog + 1970-01-01 test + + @* a: + |modify a + ~[a98683e6a834] [tip] + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T compact + @ 1[tip] a98683e6a834 1970-01-01 00:00 + test + |modify a + ~ + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T default + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T phases + @ changeset: 1:a98683e6a834 + | tag: tip + ~ phase: draft + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T show + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T status + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + files: + M a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T xml + + + @ + | tip + ~ test + 1970-01-01T00:00:00+00:00 + modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + + + $ cd .. diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -55,8 +55,8 @@ return limit def diffordiffstat(ui, repo, diffopts, node1, node2, match, - changes=None, stat=False, fp=None, prefix='', - root='', listsubrepos=False, hunksfilterfn=None): + changes=None, stat=False, fp=None, graphwidth=0, + prefix='', root='', listsubrepos=False, hunksfilterfn=None): '''show diff or diffstat.'''
D5494: histedit: add user input to warning message on editing tagged commits
navaneeth.suresh created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5494 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -184,7 +184,6 @@ from __future__ import absolute_import import os -import time from mercurial.i18n import _ from mercurial import ( @@ -1127,9 +1126,10 @@ if not hastags: hastags = len(tags) if hastags: -ui.warn(_('warning: tags associated with the given changeset ' -'will be lost after histedit \n')) -time.sleep(1) +if ui.promptchoice(_('warning: tags associated with the given' +' changeset will be lost after histedit. \n' +'do you want to continue (yN)? $$ $$ '), default=1): +raise error.Abort(_('histedit cancelled\n')) # rebuild state if goal == goalcontinue: state.read() To: navaneeth.suresh, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5489: histedit: add warning message on editing tagged commits (issue4017)
navaneeth.suresh added a comment. @mharbison72 @yuja Thank you for the suggestions. I've created a follow-up patch making the suggested changes. Please see https://phab.mercurial-scm.org/D5494. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5489 To: navaneeth.suresh, durin42, #hg-reviewers Cc: yuja, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5628: diffstat: make --git work properly on renames (issue6025)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY `$ hg diff --stat --git` shows only the new filename on renames. I added the old filename also to the output to make it identical with the output of `$ git diff --stat`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5628 AFFECTED FILES mercurial/patch.py tests/test-diffstat.t CHANGE DETAILS diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t --- a/tests/test-diffstat.t +++ b/tests/test-diffstat.t @@ -236,3 +236,22 @@ $ hg diff --root . --stat file | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) + +When a file is renamed, --git shouldn't loss the info about old file + $ hg init issue6025 + $ cd issue6025 + $ echo > a + $ hg ci -Am 'add a' + adding a + $ hg mv a b + $ hg diff --git + diff --git a/a b/b + rename from a + rename to b + $ hg diff --stat + a | 1 - + b | 1 + + 2 files changed, 1 insertions(+), 1 deletions(-) + $ hg diff --stat --git + a => b | 0 + 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2808,6 +2808,10 @@ elif (line.startswith('GIT binary patch') or line.startswith('Binary file')): isbinary = True +elif line.startswith('rename from'): +filename = line.split()[-1] +elif line.startswith('rename to'): +filename += ' => %s' % line.split()[-1] addresult() return results To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5475: branch:Added option to show branch name of a given rev (Issue5948)
navaneeth.suresh added a comment. Thanks for the info @yuja. I'm thinking to move --rev/-r to branches command and replacing --show/-s that I've made to --rev/-r in the branch command itself. How's that sound to you guys, @pulkit @yuja ? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5475 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh updated this revision to Diff 12980. navaneeth.suresh retitled this revision from "branches: Added -r option to show branch name(s) of a given rev (Issue5948)" to "branches: add -r option to show branch name(s) of a given rev (issue5948)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5477?vs=12978=12980 REVISION DETAIL https://phab.mercurial-scm.org/D5477 AFFECTED FILES mercurial/commands.py tests/test-branches.t tests/test-completion.t CHANGE DETAILS diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -238,7 +238,7 @@ bisect: reset, good, bad, skip, extend, command, noupdate bookmarks: force, rev, delete, rename, inactive, list, template branch: force, clean, rev - branches: active, closed, template + branches: active, closed, rev, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -157,6 +157,18 @@ summary: Adding b branch + going to test branch listing by rev + $ hg branches -r0 + default0:19709c5a4e75 (inactive) + $ hg branches -qr0 + default +--- now more than one rev + $ hg branches -r2:5 + b 4:aee39cd168d0 + a 5:d8cbc61dbaa6 (inactive) + $ hg branches -qr2:5 + b + a going to test branch closing $ hg branches diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1129,6 +1129,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1158,6 +1159,13 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +selectedbranches = None +if revs: +revs = scmutil.revrange(repo, revs) +getbi = repo.revbranchcache().branchinfo +selectedbranches = {getbi(r)[0] for r in revs} + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc @@ -1165,6 +1173,8 @@ allheads = set(repo.heads()) branches = [] for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if selectedbranches and tag not in selectedbranches: +continue isactive = False if not isclosed: openheads = set(repo.branchmap().iteropen(heads)) To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5477#81155, @yuja wrote: > Looks mostly good. > > Can you update the commit message to conform to our style? > https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist Updated. > You'll see some lint errors if you run `test-check-*`. And you'll probably > need to update `test-completion.t`. I've updated `test-completion.t`. But, I didn't see any lint errors on running `test-check-*`. > > >> opts = pycompat.byteskwargs(opts) >> >> +revs = opts.get('rev') >> +if revs: >> +revs = scmutil.revrange(repo, revs) >> +getbi = repo.revbranchcache().branchinfo >> +selectedbranches = {getbi(r)[0] for r in revs} >> + >> >> ui.pager('branches') >> fm = ui.formatter('branches', opts) >> hexfunc = fm.hexfunc >> >> @@ -1165,6 +1172,8 @@ >> >> allheads = set(repo.heads()) >> branches = [] >> for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): >> >> +if revs and tag not in selectedbranches: >> +continue > > I prefer initializing `selectedbranches` to `None`, and check if it `is None` > here. It makes sure that `selectedbranches` never be an undefined name, and > avoid weird behavior when `revs` resolved to an empty set. I didn't think of this. Thanks for pointing that out. It's fixed in this patch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5475: branch:Added option to show branch name of a given rev (Issue5948)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5475 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1054,6 +1054,7 @@ _('set branch name even if it shadows an existing branch')), ('C', 'clean', None, _('reset branch name to parent branch name')), ('r', 'rev', [], _('change branches of the given revs (EXPERIMENTAL)')), + ('s', 'show', None, _('show branch name of the given rev')) ], _('[-fC] [NAME]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION) @@ -1097,6 +1098,11 @@ ui.write("%s\n" % repo.dirstate.branch()) return +elif opts.get('show') and label: +ctx = scmutil.revsingle(repo, label) +ui.write("%s\n" % ctx.branch()) +return + with repo.wlock(): if opts.get('clean'): label = repo[None].p1().branch() To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5485 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2829,7 +2829,7 @@ # If diffstat runs out of room it doesn't print anything, # which isn't very useful, so always print at least one + or - # if there were at least some changes. -return max(i * graphwidth // maxtotal, int(bool(i))) +return max(i * graphwidth // max(diffstatsum(stats)), int(bool(i))) for filename, adds, removes, isbinary in stats: if isbinary: To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh updated this revision to Diff 12988. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5477?vs=12980=12988 REVISION DETAIL https://phab.mercurial-scm.org/D5477 AFFECTED FILES mercurial/commands.py tests/test-branches.t tests/test-completion.t CHANGE DETAILS diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -238,7 +238,7 @@ bisect: reset, good, bad, skip, extend, command, noupdate bookmarks: force, rev, delete, rename, inactive, list, template branch: force, clean, rev - branches: active, closed, template + branches: active, closed, rev, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -157,6 +157,18 @@ summary: Adding b branch + going to test branch listing by rev + $ hg branches -r0 + default0:19709c5a4e75 (inactive) + $ hg branches -qr0 + default +--- now more than one rev + $ hg branches -r2:5 + b 4:aee39cd168d0 + a 5:d8cbc61dbaa6 (inactive) + $ hg branches -qr2:5 + b + a going to test branch closing $ hg branches diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1129,6 +1129,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1158,6 +1159,13 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +selectedbranches = None +if revs: +revs = scmutil.revrange(repo, revs) +getbi = repo.revbranchcache().branchinfo +selectedbranches = {getbi(r)[0] for r in revs} + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc @@ -1165,6 +1173,8 @@ allheads = set(repo.heads()) branches = [] for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if selectedbranches is not None and tag not in selectedbranches: +continue isactive = False if not isclosed: openheads = set(repo.branchmap().iteropen(heads)) To: navaneeth.suresh, #hg-reviewers Cc: lothiraldan, pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: Added -r option to show branch name(s) of a given rev (Issue5948)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1129,6 +1129,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev(s)')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1158,6 +1159,10 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +if revs: +revs = scmutil.revrange(repo, revs) + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc @@ -1192,8 +1197,11 @@ label = 'branches.current' fm.startitem() +rev = ctx.rev() +if opts.get('rev') and rev not in revs: +continue + fm.write('branch', '%s', tag, label=label) -rev = ctx.rev() padsize = max(31 - len("%d" % rev) - encoding.colwidth(tag), 0) fmt = ' ' * padsize + ' %d:%s' fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()), To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5475: branch:Added option to show branch name of a given rev (Issue5948)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5475#81071, @yuja wrote: > > Thanks for the info @yuja. I'm thinking to move --rev/-r to branches command and replacing --show/-s that I've made to --rev/-r in the branch command itself. > > I'm not sure if I get it, but my idea is to add `hg branches -r/--rev` > that selects branches to be listed by revisions. So, `hg branch -srREV` in > your original patch will be equivalent to `hg branches -qrREV` (-q to > suppress detailed output.) I've made the suggested changes in https://phab.mercurial-scm.org/D5477 @yuja. Please see. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5475 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: Added -r option to show branch name(s) of a given rev (Issue5948)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5477#81095, @yuja wrote: > > fm.startitem() > > > > +rev = ctx.rev() > > +if opts.get('rev') and rev not in revs: > > +continue > > ctx points to the tipmost branch head. so `rev not in revs` doesn't mean any > of the `revs` do not belong to the branch. Is there any possibility of workaround within this iteration itself @yuja? I can do outside the current loop by creating a branches list and map it by iterating over scmutil.revrange() as suggested by you. But, that won't fetch all details. Just changeset and corresponding branch. We need to keep the same output format, right? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: Added -r option to show branch name(s) of a given rev (Issue5948)
navaneeth.suresh updated this revision to Diff 12978. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5477?vs=12969=12978 REVISION DETAIL https://phab.mercurial-scm.org/D5477 AFFECTED FILES mercurial/commands.py tests/test-branches.t CHANGE DETAILS diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -157,6 +157,18 @@ summary: Adding b branch + going to test branch listing by rev + $ hg branches -r0 + default0:19709c5a4e75 (inactive) + $ hg branches -qr0 + default +--- now more than one rev + $ hg branches -r2:5 + b 4:aee39cd168d0 + a 5:d8cbc61dbaa6 (inactive) + $ hg branches -qr2:5 + b + a going to test branch closing $ hg branches diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1129,6 +1129,7 @@ [('a', 'active', False, _('show only branches that have unmerged heads (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branches')), + ('r', 'rev', [], _('show branch name(s) of the given rev')) ] + formatteropts, _('[-c]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION, @@ -1158,6 +1159,12 @@ """ opts = pycompat.byteskwargs(opts) +revs = opts.get('rev') +if revs: +revs = scmutil.revrange(repo, revs) +getbi = repo.revbranchcache().branchinfo +selectedbranches = {getbi(r)[0] for r in revs} + ui.pager('branches') fm = ui.formatter('branches', opts) hexfunc = fm.hexfunc @@ -1165,6 +1172,8 @@ allheads = set(repo.heads()) branches = [] for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if revs and tag not in selectedbranches: +continue isactive = False if not isclosed: openheads = set(repo.branchmap().iteropen(heads)) To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5477: branches: Added -r option to show branch name(s) of a given rev (Issue5948)
navaneeth.suresh added a comment. @yuja Thank you so much for the information. I've updated the revision. Please review when you're free. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5552: tests: add test for warning on histedit with tagged commits
navaneeth.suresh created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is a follow-up patch to https://phab.mercurial-scm.org/D5494. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5552 AFFECTED FILES tests/test-histedit-edit.t CHANGE DETAILS diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -481,3 +481,21 @@ # f, fold = use commit, but combine it with the one above # r, roll = like fold, but discard this commit's description and date # +warn the user on editing tagged commits + $ hg init issue4017 + $ cd issue4017 + $ echo > a + $ hg ci -Am 'add a' + adding a + $ hg tag a + $ hg tags + tip1:bd7ee4f3939b + a 0:a8a82d372bb3 + $ echo '[extensions]' >> $HGRCPATH + $ echo 'histedit =' >> $HGRCPATH + $ hg histedit + warning: tags associated with the given changeset will be lost after histedit. + do you want to continue (yN)? n + abort: histedit cancelled + + [255] To: navaneeth.suresh, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5494: histedit: add user input to warning message on editing tagged commits
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5494#81855, @pulkit wrote: > Sorry for bumping on this now, can you add tests for this as follow-up? My bad. Doing that right away! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5494 To: navaneeth.suresh, durin42, #hg-reviewers Cc: pulkit, yuja, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a comment. > Could you add a test? > > (Bonus points if you add a test that shows the wrong behavior and then fix it in this change.) Sure. Will do. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5503: vfs: add support for repo names with `$` when using with env vars (issue5739)
navaneeth.suresh updated this revision to Diff 13046. navaneeth.suresh retitled this revision from "vfs: add support for repo names with `$` sign while using with env vars (issue5739)" to "vfs: add support for repo names with `$` when using with env vars (issue5739)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5503?vs=13025=13046 REVISION DETAIL https://phab.mercurial-scm.org/D5503 AFFECTED FILES mercurial/vfs.py tests/test-issue5739.t CHANGE DETAILS diff --git a/tests/test-issue5739.t b/tests/test-issue5739.t new file mode 100644 --- /dev/null +++ b/tests/test-issue5739.t @@ -0,0 +1,8 @@ +-- going to create a repo with dollar sign which even +works even when there exists an environment variable + + $ mkdir '$foo' + $ cd '$foo' + $ hg init + $ foo=bar hg root + $TESTTMP/$foo diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -311,6 +311,10 @@ ''' def __init__(self, base, audit=True, cacheaudited=False, expandpath=False, realpath=False): +if '$' in base and os.path.isdir(base): +# when there exists a repo '$foo' and an env var foo=bar, stop +# expanding path. refer issue5739. +expandpath = False if expandpath: base = util.expandpath(base) if realpath: To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5503: vfs: add support for repo names with `$` when using with env vars (issue5739)
navaneeth.suresh added a comment. > This is logically incorrect. The problem is that we're doing variable > expansion at too lower layer. `vfs(expand(user_specified_path))` makes > some sense, but `vfs(expand(getcwd()))` is clearly wrong. And the vfs class > can't know where the `base` comes from. If I add a condition for expanding env var if present in `hgrc`, can this work as a fix? If the only solution for this is shifting path expansion from `vfs` class, where do you think it can be? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5503 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5503: vfs: add support for repo names with `$` sign while using with env vars (issue5739)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY `$ foo=bar hg root` fails to recognise the repo `$foo`. I stopped expanding env vars from vfs when there exists a repo with the same name as the env var. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5503 AFFECTED FILES mercurial/vfs.py tests/test-issue5739.t CHANGE DETAILS diff --git a/tests/test-issue5739.t b/tests/test-issue5739.t new file mode 100644 --- /dev/null +++ b/tests/test-issue5739.t @@ -0,0 +1,8 @@ +-- going to create a repo with dollar sign which even +works even when there exists an environment variable + + $ mkdir '$foo' + $ cd '$foo' + $ hg init + $ foo=bar hg root + $TESTTMP/$foo diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -311,6 +311,10 @@ ''' def __init__(self, base, audit=True, cacheaudited=False, expandpath=False, realpath=False): +if '$' in base and os.path.isdir(base): +# when there exists a repo '$foo' and an env var foo=bar, stop +# expanding path. refer issue5739. +expandpath = False if expandpath: base = util.expandpath(base) if realpath: To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -282,7 +282,7 @@ status = repo.status(match=match) if not force: repo.checkcommitpatterns(wctx, vdirs, match, status, fail) -diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) +diffopts = patch.difffeatureopts(ui, opts=opts) diffopts.nodates = True diffopts.git = True diffopts.showfunc = True To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5489: histedit: add warning message on editing tagged commits (issue4017)
navaneeth.suresh added inline comments. INLINE COMMENTS > mharbison72 wrote in histedit.py:1707 > Out of curiosity, why the sleep? Otherwise, the user won't be able to see the warning as the editor opens for histedit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5489 To: navaneeth.suresh, durin42, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5489: histedit: add warning message on editing tagged commits (issue4017)
navaneeth.suresh added a comment. Thanks for queuing! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5489 To: navaneeth.suresh, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh added a comment. @yuja Requested changes have been made in the current revision. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5485 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5485: log: fixes line wrap on diffstat (issue5800)
navaneeth.suresh updated this revision to Diff 12996. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5485?vs=12995=12996 REVISION DETAIL https://phab.mercurial-scm.org/D5485 AFFECTED FILES mercurial/logcmdutil.py tests/test-log.t CHANGE DETAILS diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2637,3 +2637,121 @@ summary: A1B1C1 $ cd .. + +--- going to test line wrap fix on using both --stat and -G (issue5800) + $ hg init issue5800 + $ cd issue5800 + $ touch a + $ hg ci -Am 'add a' + adding a + now we are going to add 300 lines to a + $ for i in $(seq 1 300); do echo $i >> a; done + $ hg ci -m 'modify a' + $ hg log + changeset: 1:a98683e6a834 + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + changeset: 0:ac82d8b1f7c4 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: add a + + now visualise the changes we made without template + $ hg log -l1 -r a98683e6a834 --stat -G + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + with template + $ hg log -l1 -r a98683e6a834 --stat -G -T bisect + @ changeset: 1:a98683e6a834 + | bisect: + ~ tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T changelog + 1970-01-01 test + + @* a: + |modify a + ~[a98683e6a834] [tip] + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T compact + @ 1[tip] a98683e6a834 1970-01-01 00:00 + test + |modify a + ~ + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T default + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T phases + @ changeset: 1:a98683e6a834 + | tag: tip + ~ phase: draft + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T show + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T status + @ changeset: 1:a98683e6a834 + | tag: tip + ~ user:test + date:Thu Jan 01 00:00:00 1970 + + summary: modify a + files: + M a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + $ hg log -l1 -r a98683e6a834 --stat -G -T xml + + + @ + | tip + ~ test + 1970-01-01T00:00:00+00:00 + modify a + + a | 300 +++ + 1 files changed, 300 insertions(+), 0 deletions(-) + + diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -55,8 +55,8 @@ return limit def diffordiffstat(ui, repo, diffopts, node1, node2, match, - changes=None, stat=False, fp=None, prefix='', - root='', listsubrepos=False, hunksfilterfn=None): + changes=None, stat=False, graphwidth=0, fp=None, + prefix='', root='', listsubrepos=False, hunksfilterfn=None): '''show diff or diffstat.''' if root: relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) @@ -76,7 +76,7 @@ diffopts = diffopts.copy(context=0, noprefix=False) width = 80 if not ui.plain(): -width = ui.termwidth() +width =
D5477: branches: add -r option to show branch name(s) of a given rev (issue5948)
navaneeth.suresh added a comment. @yuja Can this be closed? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5477 To: navaneeth.suresh, #hg-reviewers Cc: lothiraldan, pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5489: histedit: add warning message on editing tagged commits (issue4017)
navaneeth.suresh created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5489 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -184,6 +184,7 @@ from __future__ import absolute_import import os +import time from mercurial.i18n import _ from mercurial import ( @@ -1117,6 +1118,18 @@ _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs) +hastags = False +if revs: +revs = scmutil.revrange(repo, revs) +ctxs = [repo[rev] for rev in revs] +for ctx in ctxs: +tags = [tag for tag in ctx.tags() if tag != 'tip'] +if not hastags: +hastags = len(tags) +if hastags: +ui.warn(_('warning: tags associated with the given changeset ' +'will be lost after histedit \n')) +time.sleep(1) # rebuild state if goal == goalcontinue: state.read() To: navaneeth.suresh, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh updated this revision to Diff 13166. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5490?vs=13003=13166 REVISION DETAIL https://phab.mercurial-scm.org/D5490 AFFECTED FILES mercurial/cmdutil.py tests/test-commit-interactive.t CHANGE DETAILS diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t +++ b/tests/test-commit-interactive.t @@ -1807,3 +1807,30 @@ n 0 -1 unset subdir/f1 $ hg status -A subdir/f1 M subdir/f1 + +making --interactive not ignore whitespaces with the following hgrc: +[diff] +ignorews=True + $ hg init issue6042 + $ cd issue6042 + $ echo '[diff]' >> $HGRCPATH + $ echo 'ignorews=True' >> $HGRCPATH + $ echo a > a + $ hg ci -Am 'add a' + adding a + $ echo 'a ' > a + $ hg diff + $ hg commit -i -m 'add ws to a' < y + > y + > n + > EOF + diff --git a/a b/a + 1 hunks, 1 lines changed + examine changes to 'a'? [Ynesfdaq?] y + + @@ -1,1 +1,1 @@ + -a + +a + record this change to 'a'? [Ynesfdaq?] y + diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -282,7 +282,7 @@ status = repo.status(match=match) if not force: repo.checkcommitpatterns(wctx, vdirs, match, status, fail) -diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) +diffopts = patch.difffeatureopts(ui, opts=opts) diffopts.nodates = True diffopts.git = True diffopts.showfunc = True To: navaneeth.suresh, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a comment. @durin42 I've added test for the current revision. Unfortunately, I'm unable to write a test for the wrong behaviour. I'll try writing it again. Any hints from your side? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh updated this revision to Diff 13177. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5490?vs=13166=13177 REVISION DETAIL https://phab.mercurial-scm.org/D5490 AFFECTED FILES hgext/record.py mercurial/cmdutil.py tests/test-commit-interactive.t CHANGE DETAILS diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t +++ b/tests/test-commit-interactive.t @@ -1807,3 +1807,40 @@ n 0 -1 unset subdir/f1 $ hg status -A subdir/f1 M subdir/f1 + +making --interactive not ignore whitespaces with the following hgrc: +[diff] +ignorews=True + $ hg init issue6042 + $ cd issue6042 + $ cat >> $HGRCPATH << EOF + > [diff] + > ignorews = True + > [extensions] + > record = + > EOF + $ echo a > a + $ hg ci -Am 'add a' + adding a + $ echo 'a ' > a + $ hg diff + $ hg commit -i -m 'add ws to a' < y + > y + > n + > EOF + diff --git a/a b/a + 1 hunks, 1 lines changed + examine changes to 'a'? [Ynesfdaq?] y + + @@ -1,1 +1,1 @@ + -a + +a + record this change to 'a'? [Ynesfdaq?] y + + +let's check whether record extension works fine or not after the fix + $ echo 'a ' > a + $ hg record --ignore-all-space + no changes to record + [1] diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -237,6 +237,7 @@ def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts): opts = pycompat.byteskwargs(opts) +ignorews = opts.get('ignorews', False) if not ui.interactive(): if cmdsuggest: msg = _('running non-interactively, use %s instead') % cmdsuggest @@ -282,7 +283,7 @@ status = repo.status(match=match) if not force: repo.checkcommitpatterns(wctx, vdirs, match, status, fail) -diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) +diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=ignorews) diffopts.nodates = True diffopts.git = True diffopts.showfunc = True diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -72,7 +72,7 @@ opts[r"interactive"] = True overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): -return commands.commit(ui, repo, *pats, **opts) +return commands.commit(ui, repo, *pats, ignorews=True, **opts) def qrefresh(origfn, ui, repo, *pats, **opts): if not opts[r'interactive']: @@ -89,7 +89,7 @@ # backup all changed files cmdutil.dorecord(ui, repo, committomq, None, True, -cmdutil.recordfilter, *pats, **opts) +cmdutil.recordfilter, *pats, ignorews=True, **opts) # This command registration is replaced during uisetup(). @command('qrecord', @@ -120,7 +120,7 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, - cmdutil.recordfilter, *pats, **opts) + cmdutil.recordfilter, *pats, ignorews=True, **opts) def qnew(origfn, ui, repo, patch, *args, **opts): if opts[r'interactive']: To: navaneeth.suresh, #hg-reviewers Cc: yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a comment. > Sorry for late, but doesn't it break `hg record --ignore-all-space`, etc.? Yes. Exactly! Thanks for pointing that out. > It was intentionally added by https://phab.mercurial-scm.org/rHG3f1dccea9510c122cf9ab0e7a5a19ceed3600a7f (with no tests.) Do you want me to add tests for that? If yes, please mention the things I need to take care of on writing those tests. I've updated the revision and things are working fine. There is still `whitespace=True` existing on calling `patch.difffeatureopts()` in `fastannotate`, `diffutil.diffallopts()`, `webutil.difffeatureopts()` and ``cmdutil._performrevert()`. Is there anything to be done on that? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5552: tests: add test for warning on histedit with tagged commits
This revision was automatically updated to reflect the committed changes. Closed by commit rHG172296c6db91: tests: add test for warning on histedit with tagged commits (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5552?vs=13134=13188#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5552?vs=13134=13188 REVISION DETAIL https://phab.mercurial-scm.org/D5552 AFFECTED FILES tests/test-histedit-edit.t CHANGE DETAILS diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -481,3 +481,24 @@ # f, fold = use commit, but combine it with the one above # r, roll = like fold, but discard this commit's description and date # + + $ cd .. + +warn the user on editing tagged commits + + $ hg init issue4017 + $ cd issue4017 + $ echo > a + $ hg ci -Am 'add a' + adding a + $ hg tag a + $ hg tags + tip1:bd7ee4f3939b + a 0:a8a82d372bb3 + $ hg histedit + warning: tags associated with the given changeset will be lost after histedit. + do you want to continue (yN)? n + abort: histedit cancelled + + [255] + $ cd .. To: navaneeth.suresh, durin42, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a comment. > `_performrevert()` would be in the same boat, but it was explicitly flagged on > at https://phab.mercurial-scm.org/rHGf37a69ec3f4717fdb4f00699ca06c225f106696c. This implies that the `diff.ignorews` option would be used > in practice to exclude whitespace changes while interactive commit/revert. > So disabling any whitespace options would break someone's workflow. I'm confused after this comment. How do you want me to move forward? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5494: histedit: add user input to warning message on editing tagged commits
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7b7e081f8954: histedit: add user input to warning message on editing tagged commits (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5494?vs=13016=13104#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5494?vs=13016=13104 REVISION DETAIL https://phab.mercurial-scm.org/D5494 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -194,7 +194,6 @@ import functools import os import struct -import time from mercurial.i18n import _ from mercurial import ( @@ -1702,9 +1701,10 @@ if not hastags: hastags = len(tags) if hastags: -ui.warn(_('warning: tags associated with the given changeset ' -'will be lost after histedit \n')) -time.sleep(1) +if ui.promptchoice(_('warning: tags associated with the given' +' changeset will be lost after histedit. \n' +'do you want to continue (yN)? $$ $$ '), default=1): +raise error.Abort(_('histedit cancelled\n')) # rebuild state if goal == goalcontinue: state.read() To: navaneeth.suresh, durin42, #hg-reviewers Cc: yuja, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5489: histedit: add warning message on editing tagged commits (issue4017)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG86f0ed7ac688: histedit: add warning message on editing tagged commits (issue4017) (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5489?vs=12999=13000#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5489?vs=12999=13000 REVISION DETAIL https://phab.mercurial-scm.org/D5489 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -194,6 +194,7 @@ import functools import os import struct +import time from mercurial.i18n import _ from mercurial import ( @@ -1692,6 +1693,18 @@ _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs) +hastags = False +if revs: +revs = scmutil.revrange(repo, revs) +ctxs = [repo[rev] for rev in revs] +for ctx in ctxs: +tags = [tag for tag in ctx.tags() if tag != 'tip'] +if not hastags: +hastags = len(tags) +if hastags: +ui.warn(_('warning: tags associated with the given changeset ' +'will be lost after histedit \n')) +time.sleep(1) # rebuild state if goal == goalcontinue: state.read() To: navaneeth.suresh, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5628: diffstat: make --git work properly on renames (issue6025)
navaneeth.suresh added a comment. > One nit: better to not use `.split()` since a filename may include whitespace. Nice catch! I will send a follow-up on this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5628 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5709: diffstat: support filenames with whitespaces on renames
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is a follow-up patch to https://phab.mercurial-scm.org/D5628. `line.split()` cannot get filenames with whitespaces as mentioned by @yuja. This patch replaces `split()` method with `slice`. Corresponding tests were also added. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5709 AFFECTED FILES mercurial/patch.py tests/test-diffstat.t CHANGE DETAILS diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t --- a/tests/test-diffstat.t +++ b/tests/test-diffstat.t @@ -255,3 +255,19 @@ $ hg diff --stat --git a => b | 0 1 files changed, 0 insertions(+), 0 deletions(-) +-- filename may contain whitespaces + $ echo > c + $ hg ci -Am 'add c' + adding c + $ hg mv c 'new c' + $ hg diff --git + diff --git a/c b/new c + rename from c + rename to new c + $ hg diff --stat + c | 1 - + new c | 1 + + 2 files changed, 1 insertions(+), 1 deletions(-) + $ hg diff --stat --git + c => new c | 0 + 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2809,9 +2809,9 @@ line.startswith('Binary file')): isbinary = True elif line.startswith('rename from'): -filename = line.split()[-1] +filename = line[12:] elif line.startswith('rename to'): -filename += ' => %s' % line.split()[-1] +filename += ' => %s' % line[10:] addresult() return results To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5628: diffstat: make --git work properly on renames (issue6025)
navaneeth.suresh added a comment. Thanks for queuing this! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5628 To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5709: diffstat: support filenames with whitespaces on renames
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4a33a6bf2b52: diffstat: support filenames with whitespaces on renames (authored by navaneeth.suresh, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5709?vs=13494=13499 REVISION DETAIL https://phab.mercurial-scm.org/D5709 AFFECTED FILES mercurial/patch.py tests/test-diffstat.t CHANGE DETAILS diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t --- a/tests/test-diffstat.t +++ b/tests/test-diffstat.t @@ -255,3 +255,19 @@ $ hg diff --stat --git a => b | 0 1 files changed, 0 insertions(+), 0 deletions(-) +-- filename may contain whitespaces + $ echo > c + $ hg ci -Am 'add c' + adding c + $ hg mv c 'new c' + $ hg diff --git + diff --git a/c b/new c + rename from c + rename to new c + $ hg diff --stat + c | 1 - + new c | 1 + + 2 files changed, 1 insertions(+), 1 deletions(-) + $ hg diff --stat --git + c => new c | 0 + 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2806,9 +2806,9 @@ line.startswith('Binary file')): isbinary = True elif line.startswith('rename from'): -filename = line.split()[-1] +filename = line[12:] elif line.startswith('rename to'): -filename += ' => %s' % line.split()[-1] +filename += ' => %s' % line[10:] addresult() return results To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
navaneeth.suresh updated this revision to Diff 14616. navaneeth.suresh edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6169?vs=14592=14616 REVISION DETAIL https://phab.mercurial-scm.org/D6169 AFFECTED FILES hgext/shelve.py tests/test-shelve.t CHANGE DETAILS diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1087,3 +1087,46 @@ test (4|13):33f7f61e6c5e (re) $ cd .. + +Abort unshelve while merging (issue5123) +- + $ hg init issue5123 + $ cd issue5123 + $ echo > a + $ hg ci -Am a + adding a + $ hg co null + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo > b + $ hg ci -Am b + adding b + created new head + $ echo > c + $ hg add c + $ hg shelve + shelved as default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg co 1 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) +-- successful merge with two parents + $ hg log -G + @ changeset: 1:406bf70c274f + tag: tip + parent: -1: + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: b + + @ changeset: 0:ada8c9eb8252 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: a + +-- trying to pull in the shelve bits +-- unshelve should abort otherwise, it'll eat my second parent. + $ hg unshelve + abort: cannot unshelve while merging + [255] diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -988,6 +988,12 @@ return unshelvecontinue(ui, repo, state, opts) elif len(shelved) > 1: raise error.Abort(_('can only unshelve one change at a time')) + +# abort unshelve while merging (issue5123) +parents = repo[None].parents() +if len(parents) > 1: +raise error.Abort(_('cannot unshelve while merging')) + elif not shelved: shelved = listshelves(repo) if not shelved: To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG03f6480bfdda: unshelve: disable unshelve during merge (issue5123) (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6169?vs=14616=14635#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6169?vs=14616=14635 REVISION DETAIL https://phab.mercurial-scm.org/D6169 AFFECTED FILES hgext/shelve.py tests/test-shelve.t CHANGE DETAILS diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -,3 +,49 @@ test (4|13):33f7f61e6c5e (re) $ cd .. + +Abort unshelve while merging (issue5123) + + + $ hg init issue5123 + $ cd issue5123 + $ echo > a + $ hg ci -Am a + adding a + $ hg co null + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo > b + $ hg ci -Am b + adding b + created new head + $ echo > c + $ hg add c + $ hg shelve + shelved as default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg co 1 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) +-- successful merge with two parents + $ hg log -G + @ changeset: 1:406bf70c274f + tag: tip + parent: -1: + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: b + + @ changeset: 0:ada8c9eb8252 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: a + +-- trying to pull in the shelve bits +-- unshelve should abort otherwise, it'll eat my second parent. + $ hg unshelve + abort: cannot unshelve while merging + [255] + + $ cd .. diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -978,6 +978,12 @@ return unshelvecontinue(ui, repo, state, opts) elif len(shelved) > 1: raise error.Abort(_('can only unshelve one change at a time')) + +# abort unshelve while merging (issue5123) +parents = repo[None].parents() +if len(parents) > 1: +raise error.Abort(_('cannot unshelve while merging')) + elif not shelved: shelved = listshelves(repo) if not shelved: To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
navaneeth.suresh added a comment. Thanks for queuing Yuya. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6169 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
navaneeth.suresh added a comment. > Is it difficult to fix unshelve to not lose merge parents? > > https://bz.mercurial-scm.org/show_bug.cgi?id=5123#c2 I'll try to come up with a fix. But, `hg shelve` is aborting during a merge. Can `unshelve` be aborted too? I don't have a strong opinion on this. I am just asking. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6169 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh added a comment. > It doesn't make sense to check the existence of 'shelvedstate' in a static > table. > > Can't we somehow get around the mq in a similar way to shelve.getcommitfunc()? > I don't think it's good idea to rely on state files saved on disk. I felt that the only workaround to stop aborting unshelve on a modified mq patch should be adding a check on `mq.abortifwdirpatched()`. Will try to investigate in `shelve.getcommitfunc()` for sure. Thanks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6027 To: navaneeth.suresh, martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As stated in the issue5123, unshelve can destroy the second parent of the context when tried to unshelve with an uncommitted merge. This patch makes unshelve to abort when called with an uncommitted merge. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6169 AFFECTED FILES hgext/shelve.py tests/test-shelve.t CHANGE DETAILS diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1087,3 +1087,46 @@ test (4|13):33f7f61e6c5e (re) $ cd .. + +Abort unshelve while merging (issue5123) +- + $ hg init issue5123 + $ cd issue5123 + $ echo > a + $ hg ci -Am a + adding a + $ hg co null + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo > b + $ hg ci -Am b + adding b + created new head + $ echo > c + $ hg add c + $ hg shelve + shelved as default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg co 1 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) +-- successful merge with two parents + $ hg log -G + @ changeset: 1:406bf70c274f + tag: tip + parent: -1: + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: b + + @ changeset: 0:ada8c9eb8252 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: a + +-- trying to pull in the shelve bits +-- unshelve should abort otherwise, it'll eat my second parent. + $ hg unshelve + abort: cannot unshelve while merging + [255] diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -988,6 +988,12 @@ return unshelvecontinue(ui, repo, state, opts) elif len(shelved) > 1: raise error.Abort(_('can only unshelve one change at a time')) + +# abort unshelve while merging (issue5123) +parents = repo[None].parents() +if len(parents) > 1: +raise error.Abort(_('cannot unshelve while merging')) + elif not shelved: shelved = listshelves(repo) if not shelved: To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)
navaneeth.suresh added a comment. Gentle ping for review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6056 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh added a comment. Gentle ping for review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6027 To: navaneeth.suresh, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6169: unshelve: disable unshelve during merge (issue5123)
navaneeth.suresh added a comment. I saw some patches[0][1][2] trying to fix this issue. It seems like it's difficult to preserve the second parent. [0]: http://mercurial.808500.n3.nabble.com/PATCH-shelve-adds-restoring-original-parents-after-unshelve-issue5123-tc4035657.html#none [1]: http://mercurial.808500.n3.nabble.com/PATCH-V2-shelve-restore-parents-after-unshelve-issue5123-tc4036093.html#a4037370 [2]: http://mercurial.808500.n3.nabble.com/PATCH-V3-shelve-restore-parents-after-unshelve-issue5123-tt4036858.html#a4037408 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6169 To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh created this revision. Herald added a reviewer: martinvonz. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY unshelve wasn't working on a modified mq patch. I added checks for not aborting on a modified mq patch in both rebase and mq. Checking `repo.vfs.exists('unshelverebasestate')` works in rebase, not in mq. I used `cmdutil.unfinishedstates` to find `shelvedstate` in mq. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6027 AFFECTED FILES hgext/mq.py hgext/rebase.py tests/test-mq.t CHANGE DETAILS diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -1619,3 +1619,24 @@ $ cd .. + +unshelve shoudn't be refusing on modified mq patch + + $ hg init issue4318 + $ cd issue4318 + $ echo '[extensions]' >> $HGRCPATH + $ echo 'mq =' >> $HGRCPATH + $ echo 'shelve =' >> $HGRCPATH + $ echo a>a + $ hg add a + $ hg qnew -ma a.patch + $ echo a2>>a + $ hg shelve + shelved as default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo b>b + $ hg add b + $ hg qref + $ hg unshelve + unshelving change 'default' + rebasing shelved changes diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1703,7 +1703,8 @@ # a partially completed rebase is blocked by mq. if 'qtip' in repo.tags(): mqapplied = set(repo[s.node].rev() for s in repo.mq.applied) -if set(destmap.values()) & mqapplied: +if set(destmap.values()) & mqapplied and \ +not repo.vfs.exists('unshelverebasestate'): raise error.Abort(_('cannot rebase onto an applied mq patch')) # Get "cycle" error early by exhausting the generator. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -3518,7 +3518,10 @@ delattr(self.unfiltered(), r'mq') def abortifwdirpatched(self, errmsg, force=False): -if self.mq.applied and self.mq.checkapplied and not force: +shelveinprogress = any('shelvedstate' in state +for state in cmdutil.unfinishedstates) +if self.mq.applied and self.mq.checkapplied and not force and \ +not shelveinprogress: parents = self.dirstate.parents() patches = [s.node for s in self.mq.applied] if parents[0] in patches or parents[1] in patches: To: navaneeth.suresh, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh updated this revision to Diff 14280. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14131=14280 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,8 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -168,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -191,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -222,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -275,22 +278,22 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -301,9 +304,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit leaving an empty changeset @@ -368,6 +371,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -398,3 +402,48 @@ |/ o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 + $ cd .. + +experimental.uncommitondirtywdir should also work on a dirty PATH + + $ hg init issue5977 + $ cd issue5977 + $ echo 'super critical info!' > a + $ hg ci -Am 'add a' + adding a + $ echo 'foo' > b + $ hg add b + $ hg status + A b + $ hg unc a + $ hg unc b + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] + $ cat a + super critical info! +
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh marked an inline comment as done. navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in uncommit.py:162 > how about `if not pats or isdirtypath`? That's sweet. I've tried that earlier and failed to work because I thought bailifchanged couldn't handle dirty PATH. My bad! Current revision has your suggestion implemented. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh updated this revision to Diff 14281. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14280=14281 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,8 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -168,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -191,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -222,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -275,22 +278,22 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -301,9 +304,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit leaving an empty changeset @@ -368,6 +371,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -398,3 +402,48 @@ |/ o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 + $ cd .. + +experimental.uncommitondirtywdir should also work on a dirty PATH + + $ hg init issue5977 + $ cd issue5977 + $ echo 'super critical info!' > a + $ hg ci -Am 'add a' + adding a + $ echo 'foo' > b + $ hg add b + $ hg status + A b + $ hg unc a + $ hg unc b + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] + $ cat a + super critical info! +
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh added inline comments. INLINE COMMENTS > martinvonz wrote in test-uncommit.t:421 > Ideally that patch would come first (so we don't have to remember to roll > back this patch if that other patch doesn't come before we cut the next > release). I'm up for anything. I can send a follow-up suggesting the new flag. Pushing this will fix an existing bug and the follow-up will be on replacing the experimental config option `uncommitondirtydir` with the flag `--allow-dirty-working-copy` on working with PATH. But, I once tried that and failed to work. Do flags support hyphen in names? This may sound trivial. But, I need to know this. I'll wait for a confirmation message from you before working on this further. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh marked 5 inline comments as done. navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5940#88065, @martinvonz wrote: > I don't understand the commit message. `experimental.uncommitondirtydir` already works with PATH, doesn't it? I think you mean something like "uncommit: allow dirty working copy with PATH". Did I understand that right? If PATH is given, `experimental.uncommitondirtydir` is ignored. This is the current scenario. I thought the current commit message would go well. But, yours sound sweet to me. Do you want me to replace that? INLINE COMMENTS > martinvonz wrote in test-uncommit.t:421 > I still don't think it's a good idea to recommend an experimental config > option I was going with Yuya's and Pulkit's suggestions. Fixing an existing bug without modifying the current UI sounds reasonable to me. I too agree that recommending an experimental config option quite often is not a good idea. But, we don't want to remove that config option either as you (and Google) are already using that. I'll wait for @pulkit and you. If you are having a strong opinion on this, then I won't do that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in test-uncommit.t:421 > @navaneeth.suresh can you send the patch adding the flag also. You can also > send that patch based on this patch. Yes flags do support hypens in names. > The hypens are converted to underscores. So you would need to do > `opts['allow_dirty_working_copy']`. Sure. Doing that right away! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: allow dirty working copy with PATH (issue5977)
navaneeth.suresh updated this revision to Diff 14342. navaneeth.suresh retitled this revision from "uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)" to "uncommit: allow dirty working copy with PATH (issue5977)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14281=14342 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,8 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -168,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -191,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -222,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -275,22 +278,22 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -301,9 +304,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit leaving an empty changeset @@ -368,6 +371,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -398,3 +402,48 @@ |/ o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 + $ cd .. + +experimental.uncommitondirtywdir should also work on a dirty PATH + + $ hg init issue5977 + $ cd issue5977 + $ echo 'super critical info!' > a + $ hg ci -Am 'add a' + adding a + $ echo 'foo' > b + $ hg add
D6069: uncommit: add flag --allow-dirty-working-copy
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This adds a flag `--allow-dirty-working-copy` as an alias for the experimental config option `experimental.uncommitondirtydir`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6069 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -34,9 +34,10 @@ options ([+] can be repeated): - --keepallow an empty commit after uncommiting - -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns + --keep allow an empty commit after uncommiting + --allow-dirty-working-copy allow uncommit with outstanding changes + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns (some details hidden, use --verbose to show complete help) @@ -156,11 +157,11 @@ M files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit files abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat files abcde @@ -172,7 +173,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -371,7 +372,7 @@ $ hg uncommit abort: outstanding uncommitted merge - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -418,7 +419,7 @@ $ hg unc a $ hg unc b abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat a super critical info! @@ -432,7 +433,7 @@ $ hg ci -Am 'add b' $ echo 'foo bar' > b - $ hg unc --config experimental.uncommitondirtywdir=True b + $ hg unc --allow-dirty-working-copy b $ hg log changeset: 3:30fa958635b2 tag: tip diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -137,6 +137,8 @@ @command('uncommit', [('', 'keep', False, _('allow an empty commit after uncommiting')), + ('', 'allow-dirty-working-copy', False, +_('allow uncommit with outstanding changes')) ] + commands.walkopts, _('[OPTION]... [FILE]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) @@ -157,10 +159,11 @@ m, a, r, d = repo.status()[:4] isdirtypath = any(set(m + a + r + d) & set(pats)) +allowdirtywcopy = opts['allow_dirty_working_copy'] if not repo.ui.configbool('experimental', 'uncommitondirtywdir') and \ -(not pats or isdirtypath): +(not pats or isdirtypath and not allowdirtywcopy): cmdutil.bailifchanged(repo, hint=_('requires ' -'experimental.uncommitondirtywdir to uncommit')) +'--allow-dirty-working-copy to uncommit')) old = repo['.'] rewriteutil.precheck(repo, [old.rev()], 'uncommit') if len(old.parents()) > 1: To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6069: uncommit: add flag --allow-dirty-working-copy
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in uncommit.py:162 > how about making this as: > > `allowdirty = opts['allow_dirty_working_copy'] or > repo.ui.configbool('experimental', 'uncommitondirtywdir')` > > This will make the if condition more simpler to understand. Done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6069 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6069: uncommit: add flag --allow-dirty-working-copy
navaneeth.suresh updated this revision to Diff 14344. navaneeth.suresh marked an inline comment as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6069?vs=14343=14344 REVISION DETAIL https://phab.mercurial-scm.org/D6069 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -34,9 +34,10 @@ options ([+] can be repeated): - --keepallow an empty commit after uncommiting - -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns + --keep allow an empty commit after uncommiting + --allow-dirty-working-copy allow uncommit with outstanding changes + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns (some details hidden, use --verbose to show complete help) @@ -156,11 +157,11 @@ M files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit files abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat files abcde @@ -172,7 +173,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -371,7 +372,7 @@ $ hg uncommit abort: outstanding uncommitted merge - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -418,7 +419,7 @@ $ hg unc a $ hg unc b abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat a super critical info! @@ -432,7 +433,7 @@ $ hg ci -Am 'add b' $ echo 'foo bar' > b - $ hg unc --config experimental.uncommitondirtywdir=True b + $ hg unc --allow-dirty-working-copy b $ hg log changeset: 3:30fa958635b2 tag: tip diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -137,6 +137,8 @@ @command('uncommit', [('', 'keep', False, _('allow an empty commit after uncommiting')), + ('', 'allow-dirty-working-copy', False, +_('allow uncommit with outstanding changes')) ] + commands.walkopts, _('[OPTION]... [FILE]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) @@ -157,10 +159,11 @@ m, a, r, d = repo.status()[:4] isdirtypath = any(set(m + a + r + d) & set(pats)) -if not repo.ui.configbool('experimental', 'uncommitondirtywdir') and \ -(not pats or isdirtypath): +allowdirtywcopy = (opts['allow_dirty_working_copy'] or +repo.ui.configbool('experimental', 'uncommitondirtywdir')) +if not allowdirtywcopy and (not pats or isdirtypath): cmdutil.bailifchanged(repo, hint=_('requires ' -'experimental.uncommitondirtywdir to uncommit')) +'--allow-dirty-working-copy to uncommit')) old = repo['.'] rewriteutil.precheck(repo, [old.rev()], 'uncommit') if len(old.parents()) > 1: To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5997: mq: disable qrecord during histedit (issue5981)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY qrecord during histedit may lead to deadlock-like situations. qpop will throw an error on called during histedit even after qrecord-ing those changes. This patch makes qrecord to abort on histedit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5997 AFFECTED FILES hgext/record.py tests/test-qrecord.t CHANGE DETAILS diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -422,3 +422,42 @@ $ hg diff --nodates $ cd .. + +qrecord should throw an error when histedit in process + + $ hg init issue5981 + $ cd issue5981 + $ cat >> $HGRCPATH < [extensions] + > histedit= + > mq= + > EOF + $ echo > a + $ hg ci -Am 'foo bar' + adding a + $ hg log + changeset: 0:ea55e2ae468f + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: foo bar + + $ hg histedit tip --commands - 2>&1 < edit ea55e2ae468f foo bar + > EOF + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + adding a + Editing (ea55e2ae468f), you may commit or record as needed now. + (hg histedit --continue to resume) + [1] + $ echo 'foo bar' > a + $ hg qrecord -d '0 0' -m aaa a.patch < y + > y + > n + > y + > y + > n + > EOF + abort: histedit in progress, can't qrecord + [255] diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -119,6 +119,8 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): +if repo.vfs.exists('histedit-state'): +raise error.Abort(_("histedit in progress, can't qrecord")) cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, cmdutil.recordfilter, *pats, **opts) To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: don't allow dirty working copy with PATH (issue5977)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbf22e370ae9a: uncommit: dont allow dirty working copy with PATH (issue5977) (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5940?vs=14371=14374#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14371=14374 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,9 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files - note: keeping empty commit + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -169,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -192,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -223,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -276,23 +278,23 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret note: keeping empty commit $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -303,9 +305,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset @@ -393,6 +395,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -463,3 +466,49 @@ a A c a + $ cd .. + +experimental.uncommitondirtywdir should also work on a dirty PATH + + $ hg init issue5977 +
D6069: uncommit: add flag --allow-dirty-working-copy
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaa284d9a33ca: uncommit: add flag --allow-dirty-working-copy (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6069?vs=14372=14375#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6069?vs=14372=14375 REVISION DETAIL https://phab.mercurial-scm.org/D6069 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -34,9 +34,10 @@ options ([+] can be repeated): - --keepallow an empty commit after uncommiting - -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns + --keep allow an empty commit after uncommiting + --allow-dirty-working-copy allow uncommit with outstanding changes + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns (some details hidden, use --verbose to show complete help) @@ -156,11 +157,11 @@ M files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit files abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat files abcde @@ -172,7 +173,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -395,7 +396,7 @@ $ hg uncommit abort: outstanding uncommitted merge - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -483,7 +484,7 @@ note: keeping empty commit $ hg unc b abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat a super critical info! @@ -497,7 +498,7 @@ $ hg ci -Am 'add b' $ echo 'foo bar' > b - $ hg unc --config experimental.uncommitondirtywdir=True b + $ hg unc --allow-dirty-working-copy b $ hg log changeset: 3:30fa958635b2 tag: tip diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -140,6 +140,8 @@ @command('uncommit', [('', 'keep', None, _('allow an empty commit after uncommiting')), + ('', 'allow-dirty-working-copy', False, +_('allow uncommit with outstanding changes')) ] + commands.walkopts, _('[OPTION]... [FILE]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) @@ -160,10 +162,11 @@ m, a, r, d = repo.status()[:4] isdirtypath = any(set(m + a + r + d) & set(pats)) -if (not repo.ui.configbool('experimental', 'uncommitondirtywdir') and -(not pats or isdirtypath)): +allowdirtywcopy = (opts['allow_dirty_working_copy'] or +repo.ui.configbool('experimental', 'uncommitondirtywdir')) +if not allowdirtywcopy and (not pats or isdirtypath): cmdutil.bailifchanged(repo, hint=_('requires ' -'experimental.uncommitondirtywdir to uncommit')) +'--allow-dirty-working-copy to uncommit')) old = repo['.'] rewriteutil.precheck(repo, [old.rev()], 'uncommit') if len(old.parents()) > 1: To: navaneeth.suresh, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6069: uncommit: add flag --allow-dirty-working-copy
navaneeth.suresh updated this revision to Diff 14372. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6069?vs=14344=14372 REVISION DETAIL https://phab.mercurial-scm.org/D6069 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -34,9 +34,10 @@ options ([+] can be repeated): - --keepallow an empty commit after uncommiting - -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns + --keep allow an empty commit after uncommiting + --allow-dirty-working-copy allow uncommit with outstanding changes + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns (some details hidden, use --verbose to show complete help) @@ -156,11 +157,11 @@ M files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit files abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat files abcde @@ -172,7 +173,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -395,7 +396,7 @@ $ hg uncommit abort: outstanding uncommitted merge - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -482,7 +483,7 @@ $ hg unc a $ hg unc b abort: uncommitted changes - (requires experimental.uncommitondirtywdir to uncommit) + (requires --allow-dirty-working-copy to uncommit) [255] $ cat a super critical info! @@ -496,7 +497,7 @@ $ hg ci -Am 'add b' $ echo 'foo bar' > b - $ hg unc --config experimental.uncommitondirtywdir=True b + $ hg unc --allow-dirty-working-copy b $ hg log changeset: 3:30fa958635b2 tag: tip diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -140,6 +140,8 @@ @command('uncommit', [('', 'keep', None, _('allow an empty commit after uncommiting')), + ('', 'allow-dirty-working-copy', False, +_('allow uncommit with outstanding changes')) ] + commands.walkopts, _('[OPTION]... [FILE]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) @@ -160,10 +162,11 @@ m, a, r, d = repo.status()[:4] isdirtypath = any(set(m + a + r + d) & set(pats)) -if not repo.ui.configbool('experimental', 'uncommitondirtywdir') and \ -(not pats or isdirtypath): +allowdirtywcopy = (opts['allow_dirty_working_copy'] or +repo.ui.configbool('experimental', 'uncommitondirtywdir')) +if not allowdirtywcopy and (not pats or isdirtypath): cmdutil.bailifchanged(repo, hint=_('requires ' -'experimental.uncommitondirtywdir to uncommit')) +'--allow-dirty-working-copy to uncommit')) old = repo['.'] rewriteutil.precheck(repo, [old.rev()], 'uncommit') if len(old.parents()) > 1: To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: allow dirty working copy with PATH (issue5977)
navaneeth.suresh updated this revision to Diff 14371. navaneeth.suresh edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14342=14371 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -156,9 +156,12 @@ M files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit files - note: keeping empty commit + abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) + [255] $ cat files abcde foo @@ -169,6 +172,7 @@ $ echo "bar" >> files $ hg uncommit abort: uncommitted changes + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True $ hg commit -m "files abcde + foo" @@ -192,16 +196,16 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit 3 new orphan changesets $ hg status M files A file-abc $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'new abc' created new head @@ -223,38 +227,36 @@ +ab $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg uncommit file-ab 1 new orphan changesets $ hg status A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:48e5bd7cd583 $ hg commit -m 'update ab' $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab + @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | - o 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab + o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | - | * 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc + | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | | - | | * 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | | | - | | | x 9:8a6b58c173ca6a2e3745d8bd86698718d664bc6c files abcde + foo - | | |/ - | | | x 8:39ad452c7f684a55d161c574340c5766c4569278 update files for abcde + | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | | |/ | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | | |/ @@ -276,23 +278,23 @@ $ hg uncommit $ hg phase -r . - 12: draft + 11: draft $ hg commit -m 'update ab again' Phase is preserved $ hg uncommit --keep --config phases.new-commit=secret note: keeping empty commit $ hg phase -r . - 15: draft + 14: draft $ hg commit --amend -m 'update ab again' Uncommit with public parent $ hg phase -p "::.^" $ hg uncommit $ hg phase -r . - 12: public + 11: public Partial uncommit with public parent @@ -303,9 +305,9 @@ $ hg status A xyz $ hg phase -r . - 18: draft + 17: draft $ hg phase -r ".^" - 12: public + 11: public Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset @@ -393,6 +395,7 @@ $ hg uncommit abort: outstanding uncommitted merge + (requires experimental.uncommitondirtywdir to uncommit) [255] $ hg uncommit --config experimental.uncommitondirtywdir=True @@ -463,3 +466,48 @@ a A c a + $ cd .. + +experimental.uncommitondirtywdir should also work on a dirty PATH + + $ hg init issue5977 + $ cd issue5977 + $ echo 'super critical info!' > a + $ hg ci -Am 'add a' + adding a + $ echo 'foo' > b + $ hg add b + $ hg status + A b + $ hg unc a + $ hg unc b + abort: uncommitted
D5940: uncommit: don't allow dirty working copy with PATH (issue5977)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5940#88529, @martinvonz wrote: > Can you fix the first line of the commit message to say "don't allow dirty working copy with PATH" (the "don't" was missing). It was allowed before this patch, it is not allowed with this patch (unless the config is set, of course). Fixed. I just copy-pasted the one you suggested before. Hope the current one will work. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh added a comment. Ping for review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6027 To: navaneeth.suresh, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5997: mq: disable qrecord during histedit (issue5981)
navaneeth.suresh updated this revision to Diff 14233. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5997?vs=14176=14233 REVISION DETAIL https://phab.mercurial-scm.org/D5997 AFFECTED FILES hgext/record.py tests/test-qrecord.t CHANGE DETAILS diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -422,3 +422,43 @@ $ hg diff --nodates $ cd .. + +qrecord should throw an error when histedit in process + + $ hg init issue5981 + $ cd issue5981 + $ cat >> $HGRCPATH < [extensions] + > histedit= + > mq= + > EOF + $ echo > a + $ hg ci -Am 'foo bar' + adding a + $ hg log + changeset: 0:ea55e2ae468f + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: foo bar + + $ hg histedit tip --commands - 2>&1 < edit ea55e2ae468f foo bar + > EOF + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + adding a + Editing (ea55e2ae468f), you may commit or record as needed now. + (hg histedit --continue to resume) + [1] + $ echo 'foo bar' > a + $ hg qrecord -d '0 0' -m aaa a.patch < y + > y + > n + > y + > y + > n + > EOF + abort: histedit in progress + (use 'hg histedit --continue' or 'hg histedit --abort') + [255] diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -119,6 +119,7 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): +cmdutil.checkunfinished(repo) cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, cmdutil.recordfilter, *pats, **opts) To: navaneeth.suresh, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when ADD/RENAME/COPY files on --interactive (issue5727)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY issue5727 was reported specifically for mq on using qrefresh. On investigating further, I realized that it was a check in `patch.py` that resulting in the abort. I may be wrong. On interactive mode, `gp.mode` was not `None`. I added a check in `_applydiff()` not to abort when `gp.mode` is `None` or `ui.interactive` is `True`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6056 AFFECTED FILES mercurial/patch.py tests/test-mq-qrefresh.t CHANGE DETAILS diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t --- a/tests/test-mq-qrefresh.t +++ b/tests/test-mq-qrefresh.t @@ -550,3 +550,22 @@ 2: secret $ cd .. + +Interactive qrefresh should not abort if files have been added + + $ hg init issue5727 + $ cd issue5727 + $ echo '[extensions]' >> $HGRCPATH + $ echo 'record =' >> $HGRCPATH + $ hg qnew -m "BugId: 0 add foo.h" foo.diff + $ touch foo.h + $ hg add foo.h + $ hg qrefresh -i --config ui.interactive=true < y + > y + > n + > EOF + diff --git a/foo.h b/foo.h + new file mode 100644 + examine changes to 'foo.h'? [Ynesfdaq?] y + diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2065,7 +2065,7 @@ # Added files without content have no hunk and # must be created data = '' -if data or mode: +if data or (mode and not ui.interactive()): if (gp.op in ('ADD', 'RENAME', 'COPY') and backend.exists(gp.path)): raise PatchError(_("cannot create %s: destination " To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: make experimental.uncommitondirtydir to work on PATH (issue5977)
navaneeth.suresh added a comment. Ping for review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: martinvonz, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5997: mq: disable qrecord during histedit (issue5981)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4d21ebc4cb47: mq: disable qrecord during histedit (issue5981) (authored by navaneeth.suresh, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5997?vs=14233=14235 REVISION DETAIL https://phab.mercurial-scm.org/D5997 AFFECTED FILES hgext/record.py tests/test-qrecord.t CHANGE DETAILS diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -422,3 +422,43 @@ $ hg diff --nodates $ cd .. + +qrecord should throw an error when histedit in process + + $ hg init issue5981 + $ cd issue5981 + $ cat >> $HGRCPATH < [extensions] + > histedit= + > mq= + > EOF + $ echo > a + $ hg ci -Am 'foo bar' + adding a + $ hg log + changeset: 0:ea55e2ae468f + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: foo bar + + $ hg histedit tip --commands - 2>&1 < edit ea55e2ae468f foo bar + > EOF + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + adding a + Editing (ea55e2ae468f), you may commit or record as needed now. + (hg histedit --continue to resume) + [1] + $ echo 'foo bar' > a + $ hg qrecord -d '0 0' -m aaa a.patch < y + > y + > n + > y + > y + > n + > EOF + abort: histedit in progress + (use 'hg histedit --continue' or 'hg histedit --abort') + [255] diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -119,6 +119,7 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): +cmdutil.checkunfinished(repo) cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, cmdutil.recordfilter, *pats, **opts) To: navaneeth.suresh, #hg-reviewers, pulkit Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5997: mq: disable qrecord during histedit (issue5981)
navaneeth.suresh added a comment. Thanks for queuing @pulkit. @yuja thanks for the review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5997 To: navaneeth.suresh, #hg-reviewers, pulkit Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in test-mq-qrefresh.t:570 > does this prompt ended here? it didn't show changes in 'foo.h'? i think that's usual here as the file `foo.h` is empty. i have the following case running successfully with this patch: $ echo foo > foo.h $ hg add foo.h $ hg qrefresh -i --config ui.interactive=true < y > y > n > EOF diff --git a/foo.h b/foo.h new file mode 100644 examine changes to 'foo.h'? [Ynesfdaq?] y @@ -0,0 +1,1 @@ +foo record this change to 'foo.h'? [Ynesfdaq?] y REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6056 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)
navaneeth.suresh updated this revision to Diff 14492. navaneeth.suresh retitled this revision from "patch: stop aborting when ADD/RENAME/COPY files on --interactive (issue5727)" to "patch: stop aborting when add/rename/copy files on --interactive (issue5727)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6056?vs=14319=14492 REVISION DETAIL https://phab.mercurial-scm.org/D6056 AFFECTED FILES mercurial/patch.py tests/test-mq-qrefresh.t CHANGE DETAILS diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t --- a/tests/test-mq-qrefresh.t +++ b/tests/test-mq-qrefresh.t @@ -550,3 +550,22 @@ 2: secret $ cd .. + +Interactive qrefresh should not abort if files have been added + + $ hg init issue5727 + $ cd issue5727 + $ echo '[extensions]' >> $HGRCPATH + $ echo 'record =' >> $HGRCPATH + $ hg qnew -m "BugId: 0 add foo.h" foo.diff + $ touch foo.h + $ hg add foo.h + $ hg qrefresh -i --config ui.interactive=true < y + > y + > n + > EOF + diff --git a/foo.h b/foo.h + new file mode 100644 + examine changes to 'foo.h'? [Ynesfdaq?] y + diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2065,7 +2065,7 @@ # Added files without content have no hunk and # must be created data = '' -if data or mode: +if data or (mode and not ui.interactive()): if (gp.op in ('ADD', 'RENAME', 'COPY') and backend.exists(gp.path)): raise PatchError(_("cannot create %s: destination " To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in test-mq-qrefresh.t:570 > I don't see the output which asks for `record this change to foo.h` here in > the test. IIUC, the current scenario is running into `abort: cannot create foo.h: destination already exists` if an empty file has been added. This means that the test case in my previous comment works fine without running into an error. I tested with hg (version 4.9+3-b70b7c585ee9) by adding a file with contents by running one command after another in my command line and got the same output. The interactive UI prompted me with only two queries. For an empty file, it should be only one as there are no changes to record. This might be the case for `qrefresh`. I'm not sure about this though. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6056 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6027: mq: make unshelve to apply on modified mq patch (issue4318)
navaneeth.suresh updated this revision to Diff 14400. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6027?vs=14245=14400 REVISION DETAIL https://phab.mercurial-scm.org/D6027 AFFECTED FILES hgext/mq.py hgext/rebase.py tests/test-mq.t CHANGE DETAILS diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -1619,3 +1619,24 @@ $ cd .. + +unshelve shouldn't be refusing on modified mq patch + + $ hg init issue4318 + $ cd issue4318 + $ echo '[extensions]' >> $HGRCPATH + $ echo 'mq =' >> $HGRCPATH + $ echo 'shelve =' >> $HGRCPATH + $ echo a>a + $ hg add a + $ hg qnew -ma a.patch + $ echo a2>>a + $ hg shelve + shelved as default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo b>b + $ hg add b + $ hg qref + $ hg unshelve + unshelving change 'default' + rebasing shelved changes diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1703,7 +1703,8 @@ # a partially completed rebase is blocked by mq. if 'qtip' in repo.tags(): mqapplied = set(repo[s.node].rev() for s in repo.mq.applied) -if set(destmap.values()) & mqapplied: +if (set(destmap.values()) & mqapplied and +not repo.vfs.exists('unshelverebasestate')): raise error.Abort(_('cannot rebase onto an applied mq patch')) # Get "cycle" error early by exhausting the generator. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -3518,7 +3518,10 @@ delattr(self.unfiltered(), r'mq') def abortifwdirpatched(self, errmsg, force=False): -if self.mq.applied and self.mq.checkapplied and not force: +shelveinprogress = any('shelvedstate' in state +for state in cmdutil.unfinishedstates) +if (self.mq.applied and self.mq.checkapplied and not force and +not shelveinprogress): parents = self.dirstate.parents() patches = [s.node for s in self.mq.applied] if parents[0] in patches or parents[1] in patches: To: navaneeth.suresh, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6069: uncommit: add flag --allow-dirty-working-copy
navaneeth.suresh added inline comments. INLINE COMMENTS > mharbison72 wrote in test-uncommit.t:164 > Did we lose test coverage here? The output before the prior patch noted it > was keeping an empty commit, so maybe the suggested flag needs to be used > after this abort? I'm not quite sure about this. I'll wait for @pulkit. Also, the fix won't be that easy if needed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6069 To: navaneeth.suresh, #hg-reviewers, pulkit Cc: mharbison72, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh updated this revision to Diff 13899. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13851=13899 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2950,3 +2950,45 @@ * set: 0 + +abort if the revset doesn't expect given size + $ log 'expectsize()' + hg: parse error: invalid set of arguments + [255] + $ log 'expectsize(0:2, a)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ log 'expectsize(0:2, 3)' + 0 + 1 + 2 + + $ log 'expectsize(2:0, 3)' + 2 + 1 + 0 + $ log 'expectsize(0:1, 1)' + abort: revset size mismatch. expected 1, got 2! + [255] + $ log 'expectsize(0:4, -1)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, 2:4)' + 0 + 1 + 2 + $ log 'expectsize(0:1, 3:5)' + abort: revset size mismatch. expected between 3 and 5, got 2! + [255] + $ log 'expectsize(0:1, -1:2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:1, 1:-2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, a:4)' + hg: parse error: size range bounds must be integers + [255] + $ log 'expectsize(0:2, 2:b)' + hg: parse error: size range bounds must be integers + [255] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -815,6 +815,45 @@ contentdivergent = obsmod.getrevs(repo, 'contentdivergent') return subset & contentdivergent +@predicate('expectsize(set[, size])', safe=True, takeorder=True) +def expectrevsetsize(repo, subset, x, order): +"""Abort if the revset doesn't expect given size""" +args = getargsdict(x, 'expect', 'set size') +size = args.get('size') +if size is not None: +minsize, maxsize = getintrange(size, + _('expectsize requires a size range' + ' or a positive integer'), + _('size range bounds must be integers')) +if minsize < 0 or maxsize < 0: +raise error.ParseError(_('negative size')) +if minsize != maxsize: +size = (minsize, maxsize) +else: +size = minsize +if size is None or 'set' not in args: +raise error.ParseError(_('invalid set of arguments')) +rev = getset(repo, fullreposet(repo), args['set'], order=order) +if isinstance(size, tuple): +if len(rev) < minsize or len(rev) > maxsize: +raise error.RepoLookupError( +_('revset size mismatch.' +' expected between %d and %d, got %d') % (minsize, + maxsize, + len(rev))) +if isinstance(size, int): +if len(rev) != size: +raise error.RepoLookupError( +_('revset size mismatch.' +' expected %d, got %d') % (size, len(rev))) +# filter rev by subset. since we'll probably want to get an ordered +# result from expectsize(), we'll have to conditionalize the +# filtering direction +if order == followorder: +return subset & rev +else: +return rev & subset + @predicate('extdata(source)', safe=False, weight=100) def extdata(repo, subset, x): """Changesets in the specified extdata source. (EXPERIMENTAL)""" To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh abandoned this revision. navaneeth.suresh added a comment. https://phab.mercurial-scm.org/rHG66399f2e92aac38855caab69a4c0acafead90c91 solves this issue, many thanks @spectral. Closing this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: spectral, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh added a comment. @yuja I've updated the revision with the suggested changes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5490: commit: remove ignore whitespace option on --interactive (issue6042)
navaneeth.suresh added a subscriber: spectral. navaneeth.suresh added a comment. @spectral @yuja Can I close this? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5490 To: navaneeth.suresh, #hg-reviewers Cc: spectral, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh updated this revision to Diff 13851. navaneeth.suresh edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13736=13851 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2950,3 +2950,103 @@ * set: 0 + +abort if the revset doesn't expect given size + $ hg log -r 'expectsize()' + hg: parse error: invalid set of arguments + [255] + $ hg log -r 'expectsize(0:2, a)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ hg log -r 'expectsize(0:2, 3)' + changeset: 0:2785f51eece5 + branch: a + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + changeset: 1:d75937da8da0 + branch: b + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 1 + + changeset: 2:5ed5505e9f1c + branch: a-b-c- + user:Bob + date:Thu Jan 01 00:00:00 1970 + + summary: 2 + + + $ hg log -r 'expectsize(2:0, 3)' + changeset: 2:5ed5505e9f1c + branch: a-b-c- + user:Bob + date:Thu Jan 01 00:00:00 1970 + + summary: 2 + + changeset: 1:d75937da8da0 + branch: b + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 1 + + changeset: 0:2785f51eece5 + branch: a + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + $ hg log -r 'expectsize(0:1, 1)' + abort: revset size mismatch. expected 1, got 2! + [255] + $ hg log -r 'expectsize(0:4, -1)' + hg: parse error: negative size + [255] + $ hg log -r 'expectsize(0:2, 2:4)' + changeset: 0:2785f51eece5 + branch: a + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + changeset: 1:d75937da8da0 + branch: b + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 1 + + changeset: 2:5ed5505e9f1c + branch: a-b-c- + user:Bob + date:Thu Jan 01 00:00:00 1970 + + summary: 2 + + $ hg log -r 'expectsize(0:1, 3:5)' + abort: revset size mismatch. expected between 3 and 5, got 2! + [255] + $ hg log -r 'expectsize(0:1, -1:2)' + hg: parse error: negative size + [255] + $ hg log -r 'expectsize(0:1, 1:-2)' + hg: parse error: negative size + [255] + $ hg log -r 'expectsize(0:2, a:4)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ hg log -r 'expectsize(0:2, 2:b)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ hg log -r 'one()' + hg: parse error: invalid set of arguments + [255] + $ hg log -r 'one(2)' + changeset: 2:5ed5505e9f1c + branch: a-b-c- + user:Bob + date:Thu Jan 01 00:00:00 1970 + + summary: 2 + + $ hg log -r 'one(0:2)' + abort: revset size mismatch. expected 1, got 3! + [255] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -815,6 +815,55 @@ contentdivergent = obsmod.getrevs(repo, 'contentdivergent') return subset & contentdivergent +@predicate('expectsize(set[, size])', safe=True, takeorder=True) +def expectrevsetsize(repo, subset, x, order, n=None): +"""Abort if the revset doesn't expect given size""" +args = getargsdict(x, 'expect', 'set size') +size = args.get('size', n) +if size is not None: +try: +# size is given as integer range on expectsize(, ) +lr = getrange(size, _('expectsize requires a size range ' + 'or a positive integer')) +minsize, maxsize = [getinteger(a, +_('size range bounds must be integers')) +for a in lr] +size = (minsize, maxsize) +except error.ParseError: +# size is given as integer on expectsize(, ) +size = getinteger(size, + _('expectsize requires a size range ' +'or a positive integer')) +except TypeError: +# size is 1 on one() +pass +if size is None or 'set' not in args: +raise error.ParseError(_('invalid set of arguments')) +rev = getset(repo, fullreposet(repo), args['set'], order=order) +if isinstance(size, tuple): +if minsize < 0 or maxsize < 0: +raise error.ParseError(_('negative size')) +if len(rev) not in range(size[0], size[1]+1): +raise error.RepoLookupError( +_('revset size mismatch.' +' expected between %d and %d, got %d') % (size[0], +
D5813: revset: add expect to check the size of a set
navaneeth.suresh added a comment. > Can you share your failed attempt? > > Maybe you can get how revset works by testing expression with > `hg debugrevspec -v`. I somehow managed to meet your requirements in the current revision @yuja. Please let me know if I missed out something there. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8185c8abce87: revset: add expectsize to check the size of a set (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5813?vs=14029=14043#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=14029=14043 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2978,3 +2978,63 @@ * set: 0 + +abort if the revset doesn't expect given size + $ log 'expectsize()' + hg: parse error: invalid set of arguments + [255] + $ log 'expectsize(0:2, a)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ log 'expectsize(0:2, 3)' + 0 + 1 + 2 + + $ log 'expectsize(2:0, 3)' + 2 + 1 + 0 + $ log 'expectsize(0:1, 1)' + abort: revset size mismatch. expected 1, got 2! + [255] + $ log 'expectsize(0:4, -1)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, 2:4)' + 0 + 1 + 2 + $ log 'expectsize(0:1, 3:5)' + abort: revset size mismatch. expected between 3 and 5, got 2! + [255] + $ log 'expectsize(0:1, -1:2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:1, 1:-2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, a:4)' + hg: parse error: size range bounds must be integers + [255] + $ log 'expectsize(0:2, 2:b)' + hg: parse error: size range bounds must be integers + [255] + $ log 'expectsize(0:2, 2:)' + 0 + 1 + 2 + $ log 'expectsize(0:2, :5)' + 0 + 1 + 2 + $ log 'expectsize(0:2, :)' + 0 + 1 + 2 + $ log 'expectsize(0:2, 4:)' + abort: revset size mismatch. expected between 4 and 11, got 3! + [255] + $ log 'expectsize(0:2, :2)' + abort: revset size mismatch. expected between 0 and 2, got 3! + [255] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -861,6 +861,37 @@ contentdivergent = obsmod.getrevs(repo, 'contentdivergent') return subset & contentdivergent +@predicate('expectsize(set[, size])', safe=True, takeorder=True) +def expectsize(repo, subset, x, order): +"""Abort if the revset doesn't expect given size""" +args = getargsdict(x, 'expectsize', 'set size') +minsize = 0 +maxsize = len(repo) + 1 +err = '' +if 'size' not in args or 'set' not in args: +raise error.ParseError(_('invalid set of arguments')) +minsize, maxsize = getintrange(args['size'], + _('expectsize requires a size range' + ' or a positive integer'), + _('size range bounds must be integers'), + minsize, maxsize) +if minsize < 0 or maxsize < 0: +raise error.ParseError(_('negative size')) +rev = getset(repo, fullreposet(repo), args['set'], order=order) +if minsize != maxsize and (len(rev) < minsize or len(rev) > maxsize): +err = _('revset size mismatch.' +' expected between %d and %d, got %d') % (minsize, maxsize, + len(rev)) +elif minsize == maxsize and len(rev) != minsize: +err = _('revset size mismatch.' +' expected %d, got %d') % (minsize, len(rev)) +if err: +raise error.RepoLookupError(err) +if order == followorder: +return subset & rev +else: +return rev & subset + @predicate('extdata(source)', safe=False, weight=100) def extdata(repo, subset, x): """Changesets in the specified extdata source. (EXPERIMENTAL)""" To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh updated this revision to Diff 14000. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13899=14000 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2950,3 +2950,45 @@ * set: 0 + +abort if the revset doesn't expect given size + $ log 'expectsize()' + hg: parse error: invalid set of arguments + [255] + $ log 'expectsize(0:2, a)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ log 'expectsize(0:2, 3)' + 0 + 1 + 2 + + $ log 'expectsize(2:0, 3)' + 2 + 1 + 0 + $ log 'expectsize(0:1, 1)' + abort: revset size mismatch. expected 1, got 2! + [255] + $ log 'expectsize(0:4, -1)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, 2:4)' + 0 + 1 + 2 + $ log 'expectsize(0:1, 3:5)' + abort: revset size mismatch. expected between 3 and 5, got 2! + [255] + $ log 'expectsize(0:1, -1:2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:1, 1:-2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, a:4)' + hg: parse error: size range bounds must be integers + [255] + $ log 'expectsize(0:2, 2:b)' + hg: parse error: size range bounds must be integers + [255] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -815,6 +815,38 @@ contentdivergent = obsmod.getrevs(repo, 'contentdivergent') return subset & contentdivergent +@predicate('expectsize(set[, size])', safe=True, takeorder=True) +def expectrevsetsize(repo, subset, x, order): +"""Abort if the revset doesn't expect given size""" +args = getargsdict(x, 'expect', 'set size') +size = args.get('size') +minsize = None +maxsize = None +err = '' +if size is not None: +minsize, maxsize = getintrange(size, + _('expectsize requires a size range' + ' or a positive integer'), + _('size range bounds must be integers')) +if minsize < 0 or maxsize < 0: +raise error.ParseError(_('negative size')) +if size is None or 'set' not in args: +raise error.ParseError(_('invalid set of arguments')) +rev = getset(repo, fullreposet(repo), args['set'], order=order) +if minsize != maxsize and (len(rev) < minsize or len(rev) > maxsize): +err = _('revset size mismatch.' +' expected between %d and %d, got %d') % (minsize, maxsize, + len(rev)) +elif minsize == maxsize and len(rev) != minsize: +err = _('revset size mismatch.' +' expected %d, got %d') % (minsize, len(rev)) +if err: +raise error.RepoLookupError(err) +if order == followorder: +return subset & rev +else: +return rev & subset + @predicate('extdata(source)', safe=False, weight=100) def extdata(repo, subset, x): """Changesets in the specified extdata source. (EXPERIMENTAL)""" To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in revset.py:866 > Can you improve this documentation as a follow-up? We should mentioned about > specifying ranges, and also if the set has the given size, that set is > returned. Doing that right away! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5953: revset: improve documentation on expectsize()
navaneeth.suresh created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is a follow-up patch to https://phab.mercurial-scm.org/D5813. It improves the documentation of `expectsize(set, size)`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5953 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -817,7 +817,12 @@ @predicate('expectsize(set[, size])', safe=True, takeorder=True) def expectrevsetsize(repo, subset, x, order): -"""Abort if the revset doesn't expect given size""" +"""Return the given revset if size matches the revset size. +Abort if the revset doesn't expect given size. +size can either be an integer range or an integer. + +For example, ``expectsize(0:1, 3:5)`` will abort as revset size is 2 and +2 is not between 3 and 4 inclusive.""" args = getargsdict(x, 'expect', 'set size') minsize = 0 maxsize = len(repo)+1 To: navaneeth.suresh, #hg-reviewers Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5953: revset: improve documentation on expectsize()
navaneeth.suresh updated this revision to Diff 14068. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5953?vs=14063=14068 REVISION DETAIL https://phab.mercurial-scm.org/D5953 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -817,7 +817,12 @@ @predicate('expectsize(set[, size])', safe=True, takeorder=True) def expectrevsetsize(repo, subset, x, order): -"""Abort if the revset doesn't expect given size""" +"""Return the given revset if size matches the revset size. +Abort if the revset doesn't expect given size. +size can either be an integer range or an integer. + +For example, ``expectsize(0:1, 3:5)`` will abort as revset size is 2 and +2 is not between 3 and 5 inclusive.""" args = getargsdict(x, 'expect', 'set size') minsize = 0 maxsize = len(repo)+1 To: navaneeth.suresh, #hg-reviewers Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5953: revset: improve documentation on expectsize()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG735da363556d: revset: improve documentation on expectsize() (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5953?vs=14068=14087#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5953?vs=14068=14087 REVISION DETAIL https://phab.mercurial-scm.org/D5953 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -863,7 +863,13 @@ @predicate('expectsize(set[, size])', safe=True, takeorder=True) def expectsize(repo, subset, x, order): -"""Abort if the revset doesn't expect given size""" +"""Return the given revset if size matches the revset size. +Abort if the revset doesn't expect given size. +size can either be an integer range or an integer. + +For example, ``expectsize(0:1, 3:5)`` will abort as revset size is 2 and +2 is not between 3 and 5 inclusive.""" + args = getargsdict(x, 'expectsize', 'set size') minsize = 0 maxsize = len(repo) + 1 To: navaneeth.suresh, #hg-reviewers, pulkit Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: add -f/--force when possibly hiding data (issue5977)
navaneeth.suresh added a comment. In https://phab.mercurial-scm.org/D5940#87026, @pulkit wrote: > Hi, it will be good if you specify that the patch is authored by someone else, mention their name and also provide the link to the original PR of this patch. @pulkit the link of WIP patch to evolve extension's uncommit is given in the bugzilla page itself. Link to the patch is https://bitbucket.org/octobus/evolve-devel/pull-requests/8/bug-5977-uncommit-dirtiness/diff which is authored by Dan Villiom Podlaski Christiansen. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5940: uncommit: add -f/--force when possibly hiding data (issue5977)
navaneeth.suresh updated this revision to Diff 14096. navaneeth.suresh edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5940?vs=14036=14096 REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py mercurial/rewriteutil.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -35,6 +35,7 @@ options ([+] can be repeated): --keepallow an empty commit after uncommiting + -f --force allow uncommit with outstanding changes -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns @@ -158,6 +159,9 @@ abort: uncommitted changes [255] $ hg uncommit files + abort: uncommitted changes + (use -f to force) + [255] $ cat files abcde foo @@ -170,14 +174,48 @@ abort: uncommitted changes [255] $ hg uncommit --config experimental.uncommitondirtywdir=True + abort: uncommitted changes + (use -f to force) + [255] $ hg commit -m "files abcde + foo" Uncommit in the middle of a stack, does not move bookmark $ hg checkout '.^^^' - 1 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (leaving bookmark foo) $ hg log -r . -p -T '{rev}:{node} {desc}' + 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcddiff -r abf2df566fc1 -r 6db330d65db4 file-abcd + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/file-abcd Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +abcd + diff -r abf2df566fc1 -r 6db330d65db4 files + --- a/files Thu Jan 01 00:00:00 1970 + + +++ b/files Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -abc + +abcd + + $ hg bookmark + foo 9:ad3773de7293 + $ hg uncommit + 3 new orphan changesets + $ hg status + M files + A file-abcd + $ hg heads -T '{rev}:{node} {desc}' + 9:ad3773de72930be60f1ebb39fe89115b81630a8a files abcde + foo (no-eol) + $ hg bookmark + foo 9:ad3773de7293 + $ hg commit -m 'new abc' + created new head + +Partial uncommit in the middle, does not move bookmark + + $ hg checkout '.^' + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg log -r . -p -T '{rev}:{node} {desc}' 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc --- /dev/nullThu Jan 01 00:00:00 1970 + +++ b/file-abc Thu Jan 01 00:00:00 1970 + @@ -191,119 +229,85 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 - $ hg uncommit - 3 new orphan changesets + foo 9:ad3773de7293 + $ hg uncommit file-ab + nothing to uncommit + [1] $ hg status - M files - A file-abc - $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) - $ hg bookmark - foo 10:48e5bd7cd583 - $ hg commit -m 'new abc' - created new head - -Partial uncommit in the middle, does not move bookmark - - $ hg checkout '.^' - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg log -r . -p -T '{rev}:{node} {desc}' - 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab - --- /dev/nullThu Jan 01 00:00:00 1970 + - +++ b/file-abThu Jan 01 00:00:00 1970 + - @@ -0,0 +1,1 @@ - +ab - diff -r 3004d2d9b508 -r 69a232e754b0 files - --- a/files Thu Jan 01 00:00:00 1970 + - +++ b/files Thu Jan 01 00:00:00 1970 + - @@ -1,1 +1,1 @@ - -a - +ab - - $ hg bookmark - foo 10:48e5bd7cd583 - $ hg uncommit file-ab - 1 new orphan changesets - $ hg status - A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 10:25798b2f714d0937797be0f9fde55aaf5472c052 new abc + 9:ad3773de72930be60f1ebb39fe89115b81630a8a files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:ad3773de7293 $ hg commit -m 'update ab' + nothing changed + [1] $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 10:25798b2f714d0937797be0f9fde55aaf5472c052 new abc + 9:ad3773de72930be60f1ebb39fe89115b81630a8a files abcde + foo $ hg log -G -T '{rev}:{node} {desc}' --hidden - @ 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab +
D5940: uncommit: add -f/--force when possibly hiding data (issue5977)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The behaviour of uncommit may confuse a new user. Although it never destroys the data, it can hide instead. I added a `-f/--force` flag when the working copy is dirty. The data can be visible on `--hidden` flag. Some cases in `test-uncommit.t` changes output. I'll be working on this further based on review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5940 AFFECTED FILES hgext/uncommit.py mercurial/rewriteutil.py tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -35,6 +35,7 @@ options ([+] can be repeated): --keepallow an empty commit after uncommiting + -f --force allow uncommit with outstanding changes -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns @@ -158,6 +159,9 @@ abort: uncommitted changes [255] $ hg uncommit files + abort: uncommitted changes + (use -f to force) + [255] $ cat files abcde foo @@ -170,14 +174,48 @@ abort: uncommitted changes [255] $ hg uncommit --config experimental.uncommitondirtywdir=True + abort: uncommitted changes + (use -f to force) + [255] $ hg commit -m "files abcde + foo" Uncommit in the middle of a stack, does not move bookmark $ hg checkout '.^^^' - 1 files updated, 0 files merged, 2 files removed, 0 files unresolved + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (leaving bookmark foo) $ hg log -r . -p -T '{rev}:{node} {desc}' + 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcddiff -r abf2df566fc1 -r 6db330d65db4 file-abcd + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/file-abcd Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +abcd + diff -r abf2df566fc1 -r 6db330d65db4 files + --- a/files Thu Jan 01 00:00:00 1970 + + +++ b/files Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -abc + +abcd + + $ hg bookmark + foo 9:ad3773de7293 + $ hg uncommit + 3 new orphan changesets + $ hg status + M files + A file-abcd + $ hg heads -T '{rev}:{node} {desc}' + 9:ad3773de72930be60f1ebb39fe89115b81630a8a files abcde + foo (no-eol) + $ hg bookmark + foo 9:ad3773de7293 + $ hg commit -m 'new abc' + created new head + +Partial uncommit in the middle, does not move bookmark + + $ hg checkout '.^' + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg log -r . -p -T '{rev}:{node} {desc}' 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc --- /dev/nullThu Jan 01 00:00:00 1970 + +++ b/file-abc Thu Jan 01 00:00:00 1970 + @@ -191,119 +229,85 @@ +abc $ hg bookmark - foo 10:48e5bd7cd583 - $ hg uncommit - 3 new orphan changesets + foo 9:ad3773de7293 + $ hg uncommit file-ab + nothing to uncommit + [1] $ hg status - M files - A file-abc - $ hg heads -T '{rev}:{node} {desc}' - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) - $ hg bookmark - foo 10:48e5bd7cd583 - $ hg commit -m 'new abc' - created new head - -Partial uncommit in the middle, does not move bookmark - - $ hg checkout '.^' - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ hg log -r . -p -T '{rev}:{node} {desc}' - 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab - --- /dev/nullThu Jan 01 00:00:00 1970 + - +++ b/file-abThu Jan 01 00:00:00 1970 + - @@ -0,0 +1,1 @@ - +ab - diff -r 3004d2d9b508 -r 69a232e754b0 files - --- a/files Thu Jan 01 00:00:00 1970 + - +++ b/files Thu Jan 01 00:00:00 1970 + - @@ -1,1 +1,1 @@ - -a - +ab - - $ hg bookmark - foo 10:48e5bd7cd583 - $ hg uncommit file-ab - 1 new orphan changesets - $ hg status - A file-ab $ hg heads -T '{rev}:{node} {desc}\n' - 12:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc - 10:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo + 10:25798b2f714d0937797be0f9fde55aaf5472c052 new abc + 9:ad3773de72930be60f1ebb39fe89115b81630a8a files abcde + foo $ hg bookmark - foo 10:48e5bd7cd583 + foo 9:ad3773de7293 $ hg commit -m 'update ab' + nothing changed + [1] $ hg status $ hg heads -T '{rev}:{node} {desc}\n' - 13:f21039c59242b085491bb58f591afc4ed1c04c09 update ab - 11:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc -
D5813: revset: add expect to check the size of a set
navaneeth.suresh added a comment. nit-pick is resolved. `getintrange()` will throw a `ParseError` on setting size to one of `min:`, `:max` or `:`. In ideal case, on calling from `expectsize()` it shouldn't fail. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel