D3671: advanceboundary: add dryrun parameter
khanchi97 added inline comments. INLINE COMMENTS > pulkit wrote in phases.py:369 > why are we maintaining this rejected list? rejected list will contain those csets which will be rejected during advancing boundary and then return this list so that we can report for rejected csets during dry_run of phase command. > pulkit wrote in phases.py:370 > can you explain what this changes list means? yeah, this list is for storing sets of changed csets, ordered from minimum phase to maximum phase. For example, changes[0] is a set of those csets whose phase will be changed from --public to --targetphase. Similarly, changes[1] for --draft csets. Do we need to add some comments to explain this thing? Or do you want any change here? > pulkit wrote in phases.py:371 > This conditional looks unnecessary unless I am mistaken. Can you explain why > we need this? I thought we would calculate `rejected` only when we are in dryrun mode. > pulkit wrote in phases.py:392 > We can prevent this else by returning the values early. yeah, I will make this change. > pulkit wrote in phases.py:496 > We should add documentation about the new dryrun argument and the new return > values. okay, I will do this in other patches too. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3671 To: khanchi97, #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
D3672: retractboundary: add dryrun parameter
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Added the logic to find those csets whose phase will be changed without dry-run while retracting boundary and return those csets. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3672 AFFECTED FILES mercurial/phases.py CHANGE DETAILS diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -392,32 +392,44 @@ self._retractboundary(repo, tr, targetphase, delroots) repo.invalidatevolatilesets() -def retractboundary(self, repo, tr, targetphase, nodes): +def retractboundary(self, repo, tr, targetphase, nodes, dryrun=None): oldroots = self.phaseroots[:targetphase + 1] if tr is None: phasetracking = None else: phasetracking = tr.changes.get('phases') repo = repo.unfiltered() -if (self._retractboundary(repo, tr, targetphase, nodes) -and phasetracking is not None): - -# find the affected revisions -new = self.phaseroots[targetphase] -old = oldroots[targetphase] -affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) +changes = [set(), set(), set()] +if dryrun: +getphase = repo._phasecache.phase +nds = [n for n in nodes + if getphase(repo, repo[n].rev()) < targetphase] +targetphroots = oldroots[-1] +affected = set(repo.revs('(%ln::) - (%ln::)', nds, targetphroots)) +for rev in affected: +revphase = getphase(repo, rev) +changes[revphase].update((rev,)) +else: +if (self._retractboundary(repo, tr, targetphase, nodes) +and phasetracking is not None): -# find the phase of the affected revision -for phase in xrange(targetphase, -1, -1): -if phase: -roots = oldroots[phase] -revs = set(repo.revs('%ln::%ld', roots, affected)) -affected -= revs -else: # public phase -revs = affected -for r in revs: -_trackphasechange(phasetracking, r, phase, targetphase) -repo.invalidatevolatilesets() +# find the affected revisions +new = self.phaseroots[targetphase] +old = oldroots[targetphase] +affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) + +# find the phase of the affected revision +for phase in xrange(targetphase, -1, -1): +if phase: +roots = oldroots[phase] +revs = set(repo.revs('%ln::%ld', roots, affected)) +affected -= revs +else: # public phase +revs = affected +for r in revs: +_trackphasechange(phasetracking, r, phase, targetphase) +repo.invalidatevolatilesets() +return changes def _retractboundary(self, repo, tr, targetphase, nodes): # Be careful to preserve shallow-copied values: do not update @@ -489,17 +501,20 @@ phcache.advanceboundary(repo, tr, targetphase, nodes) repo._phasecache.replace(phcache) -def retractboundary(repo, tr, targetphase, nodes): +def retractboundary(repo, tr, targetphase, nodes, dryrun=None): """Set nodes back to a phase changing other nodes phases if necessary. This function move boundary *backward* this means that all nodes are set in the target phase or kept in a *higher* phase. Simplify boundary to contains phase roots only.""" phcache = repo._phasecache.copy() -phcache.retractboundary(repo, tr, targetphase, nodes) -repo._phasecache.replace(phcache) +changes = phcache.retractboundary(repo, tr, targetphase, nodes, + dryrun=dryrun) +if not dryrun: +repo._phasecache.replace(phcache) +return changes def registernew(repo, tr, targetphase, nodes): """register a new revision and its phase To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3671: advanceboundary: add dryrun parameter
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Added logic to find those csets whose phase will be changed (when running without --dryrun) while advancing boundary. And make it return rejected and changed csets. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3671 AFFECTED FILES mercurial/phases.py CHANGE DETAILS diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -352,7 +352,7 @@ _trackphasechange(phasetracking, rev, None, revphase) repo.invalidatevolatilesets() -def advanceboundary(self, repo, tr, targetphase, nodes): +def advanceboundary(self, repo, tr, targetphase, nodes, dryrun=None): """Set all 'nodes' to phase 'targetphase' Nodes with a phase lower than 'targetphase' are not affected. @@ -366,6 +366,13 @@ repo = repo.unfiltered() +rejected = list() +changes = [set(), set(), set()] +if dryrun: +getphase = repo._phasecache.phase +rejected = [repo[n].rev() for n in nodes +if getphase(repo, repo[n].rev()) < targetphase] + delroots = [] # set of root deleted by this path for phase in xrange(targetphase + 1, len(allphases)): # filter nodes that are not in a compatible phase already @@ -377,20 +384,28 @@ olds = self.phaseroots[phase] affected = repo.revs('%ln::%ln', olds, nodes) -for r in affected: -_trackphasechange(phasetracking, r, self.phase(repo, r), - targetphase) +if dryrun: +faffected = filter(lambda x: getphase(repo, + repo[x].rev()) == phase, + affected) +changes[phase].update(faffected) +else: +for r in affected: +_trackphasechange(phasetracking, r, self.phase(repo, r), + targetphase) -roots = set(ctx.node() for ctx in repo.set( -'roots((%ln::) - %ld)', olds, affected)) -if olds != roots: -self._updateroots(phase, roots, tr) -# some roots may need to be declared for lower phases -delroots.extend(olds - roots) -# declare deleted root in the target phase -if targetphase != 0: -self._retractboundary(repo, tr, targetphase, delroots) -repo.invalidatevolatilesets() +roots = set(ctx.node() for ctx in repo.set( +'roots((%ln::) - %ld)', olds, affected)) +if olds != roots: +self._updateroots(phase, roots, tr) +# some roots may need to be declared for lower phases +delroots.extend(olds - roots) +if not dryrun: +# declare deleted root in the target phase +if targetphase != 0: +self._retractboundary(repo, tr, targetphase, delroots) +repo.invalidatevolatilesets() +return rejected, changes def retractboundary(self, repo, tr, targetphase, nodes): oldroots = self.phaseroots[:targetphase + 1] @@ -478,16 +493,19 @@ # (see branchmap one) self.invalidate() -def advanceboundary(repo, tr, targetphase, nodes): +def advanceboundary(repo, tr, targetphase, nodes, dryrun=None): """Add nodes to a phase changing other nodes phases if necessary. This function move boundary *forward* this means that all nodes are set in the target phase or kept in a *lower* phase. Simplify boundary to contains phase roots only.""" phcache = repo._phasecache.copy() -phcache.advanceboundary(repo, tr, targetphase, nodes) -repo._phasecache.replace(phcache) +rejected, changes = phcache.advanceboundary(repo, tr, targetphase, nodes, +dryrun=dryrun) +if not dryrun: +repo._phasecache.replace(phcache) +return rejected, changes def retractboundary(repo, tr, targetphase, nodes): """Set nodes back to a phase changing other nodes phases if To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3187: phase: add dry-run functionality
khanchi97 added a comment. @pulkit Now I moved the logic for finding revs (those phase will change) to advanceboundry and retractboundry function and for now it shows all nodes. I am working to show range instead. Take a look at this when you are free :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3187 To: khanchi97, pulkit, #hg-reviewers Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3187: phase: add dry-run functionality
khanchi97 updated this revision to Diff 8896. khanchi97 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3187?vs=7877=8896 REVISION DETAIL https://phab.mercurial-scm.org/D3187 AFFECTED FILES mercurial/commands.py mercurial/phases.py tests/test-completion.t tests/test-phases.t CHANGE DETAILS diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -826,3 +826,107 @@ rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 [255] + +Test dry-run functionality + + $ hg init dryrunrepo + $ cd dryrunrepo + $ echo a > a + $ hg ci -qAm 0 + test-debug-phase: new rev 0: x -> 1 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: -> draft + $ echo b > b + $ hg ci -qAm 1 + test-debug-phase: new rev 1: x -> 1 + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: -> draft + $ echo c > c + $ hg ci -qAm 2 + test-debug-phase: new rev 2: x -> 1 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: -> draft + $ echo d > d + $ hg ci -qAm 3 + test-debug-phase: new rev 3: x -> 1 + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: -> draft + $ echo e > e + $ hg ci -qAm 4 + test-debug-phase: new rev 4: x -> 1 + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: -> draft + $ echo f > f + $ hg ci -qAm 5 + test-debug-phase: new rev 5: x -> 1 + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: -> draft + $ hg up 3 -q + $ echo g > g + $ hg ci -qAm 6 + test-debug-phase: new rev 6: x -> 1 + test-hook-close-phase: f19b7f89f44eee9ffe34ba58b4e4ee3b3cea1f34: -> draft + $ echo h > h + $ hg ci -qAm 7 + test-debug-phase: new rev 7: x -> 1 + test-hook-close-phase: 4ccc844d545402eb0f39cd294227cd38de3ece20: -> draft + + + $ hg phase --public 1 + test-debug-phase: move rev 0: 1 -> 0 + test-debug-phase: move rev 1: 1 -> 0 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: draft -> public + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: draft -> public + $ hg phase --secret 4 --force + test-debug-phase: move rev 2: 1 -> 2 + test-debug-phase: move rev 3: 1 -> 2 + test-debug-phase: move rev 4: 1 -> 2 + test-debug-phase: move rev 5: 1 -> 2 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: draft -> secret + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: draft -> secret + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: draft -> secret + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: draft -> secret + + $ hg log -G -T "{rev} : {node | short} : {phase}" + @ 7 : 4ccc844d5454 : draft + | + o 6 : f19b7f89f44e : draft + | + | o 5 : fdc0253c25cf : secret + | | + | o 4 : b385d13d5ed4 : secret + |/ + o 3 : 14b465a7e25b : draft + | + o 2 : 0316ce92851d : draft + | + o 1 : 925d80f479bb : public + | + o 0 : f7b1eb17ad24 : public + + $ hg phase --secret --force 1 -n + 925d80f479bb 1 public -> secret + 0316ce92851d 2 draft -> secret + 14b465a7e25b 3 draft -> secret + f19b7f89f44e 6 draft -> secret + 4ccc844d5454 7 draft -> secret + + $ hg phase --public 5 7 -n + 0316ce92851d 2 draft -> public + 14b465a7e25b 3 draft -> public + f19b7f89f44e 6 draft -> public + 4ccc844d5454 7 draft -> public + b385d13d5ed4 4 secret -> public + fdc0253c25cf 5 secret -> public + + $ hg log -G -T "{rev} : {node | short} : {phase}" + @ 7 : 4ccc844d5454 : draft + | + o 6 : f19b7f89f44e : draft + | + | o 5 : fdc0253c25cf : secret + | | + | o 4 : b385d13d5ed4 : secret + |/ + o 3 : 14b465a7e25b : draft + | + o 2 : 0316ce92851d : draft + | + o 1 : 925d80f479bb : public + | + o 0 : f7b1eb17ad24 : public + diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -323,7 +323,7 @@ outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos parents: rev, style, template paths: template - phase: public, draft, secret, force, rev + phase: public, draft, secret, force, rev, dry-run recover: rename: after, force, include, exclude, dry-run resolve: all, list, mark, unmark, no-status, tool, include, exclude, template diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -352,7 +352,7 @@ _trackphasechange(phasetracking, rev, None, revphase) repo.invalidatevolatilesets() -def advanceboundary(self, repo, tr, targetphase, nodes): +def advanceboundary(self, repo, tr, targetphase, nodes, dryrun=None): """Set all 'nodes' to phase 'targetphase' Nodes with a phase lower than
D3187: phase: add dry-run functionality
khanchi97 added a comment. okay, but I have some queries like 1. How about showing revision no. instead of cset id? 2. And in this https://pastebin.com/raw/kWcr9xVK example if I change revision 2 phase to --secret then how it should print the range, I mean now we have branches in this range? Can we show that range like this: 0316ce92851d : : b385d13d5ed4 draft -> secret 0316ce92851d : : 4ccc844d5454 draft -> secret REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3187 To: khanchi97, pulkit, #hg-reviewers Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. In https://phab.mercurial-scm.org/D2409#44682, @pulkit wrote: > In https://phab.mercurial-scm.org/D2409#43891, @khanchi97 wrote: > > > pulkit: Can you please review it? I have made the requested changes. > > > I am sorry but I will like this to wait before we land the new state format thing. I don't want to put more information in old state files which don't have good format. But yes, if someone else feels we can go with this, I am fine with that too. @pulkit do we have new state format pushed in? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3405: forget: rename --confirm to --interactive
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf10cb49951e1: forget: rename --confirm to --interactive (authored by khanchi97, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3405?vs=8379=8381#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3405?vs=8379=8381 REVISION DETAIL https://phab.mercurial-scm.org/D3405 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py tests/test-add.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 @@ -232,7 +232,7 @@ commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates, template - forget: include, exclude, dry-run, confirm + forget: interactive, include, exclude, dry-run init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -273,19 +273,19 @@ $ cd .. -test --confirm option in forget +test --interactive mode in forget - $ hg init forgetconfirm - $ cd forgetconfirm + $ hg init interactiveforget + $ cd interactiveforget $ echo foo > foo $ hg commit -qAm "foo" $ echo bar > bar $ hg commit -qAm "bar" - $ hg forget foo --dry-run --confirm - abort: cannot specify both --dry-run and --confirm + $ hg forget foo --dry-run -i + abort: cannot specify both --dry-run and --interactive [255] - $ hg forget foo --config ui.interactive=True --confirm << EOF + $ hg forget foo --config ui.interactive=True -i << EOF > ? > n > EOF @@ -297,7 +297,7 @@ ? - ? (display help) forget foo [Ynsa?] n - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > y > n > EOF @@ -308,14 +308,14 @@ R bar $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > s > EOF forget bar [Ynsa?] s $ hg st $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > a > EOF forget bar [Ynsa?] a diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -352,7 +352,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun, confirm): +def forget(self, match, prefix, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, after, force, subrepos, @@ -816,10 +816,10 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun, confirm): +def forget(self, match, prefix, dryrun, interactive): return cmdutil.forget(self.ui, self._repo, match, self.wvfs.reljoin(prefix, self._path), - True, dryrun=dryrun, confirm=confirm) + True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror def removefiles(self, matcher, prefix, after, force, subrepos, diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -112,7 +112,6 @@ ] dryrunopts = cmdutil.dryrunopts -confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2062,7 +2061,8 @@ @command( '^forget', -walkopts + dryrunopts + confirmopts, +[('i', 'interactive', None, _('use interactive mode')), +] + walkopts + dryrunopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2098,10 +2098,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun, confirm = opts.get('dry_run'), opts.get('confirm') +dryrun, interactive = opts.get('dry_run'), opts.get('interactive') rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False, dryrun=dryrun, - confirm=confirm)[0] +
D3405: forget: rename --confirm to --interactive
khanchi97 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/D3405 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py tests/test-add.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 @@ -232,7 +232,7 @@ commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates, template - forget: include, exclude, dry-run, confirm + forget: include, exclude, dry-run, interactive init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -273,19 +273,19 @@ $ cd .. -test --confirm option in forget +test --interactive mode in forget - $ hg init forgetconfirm - $ cd forgetconfirm + $ hg init interactiveforget + $ cd interactiveforget $ echo foo > foo $ hg commit -qAm "foo" $ echo bar > bar $ hg commit -qAm "bar" - $ hg forget foo --dry-run --confirm - abort: cannot specify both --dry-run and --confirm + $ hg forget foo --dry-run -i + abort: cannot specify both --dry-run and --interactive [255] - $ hg forget foo --config ui.interactive=True --confirm << EOF + $ hg forget foo --config ui.interactive=True -i << EOF > ? > n > EOF @@ -297,7 +297,7 @@ ? - ? (display help) forget foo [Ynsa?] n - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > y > n > EOF @@ -308,14 +308,14 @@ R bar $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > s > EOF forget bar [Ynsa?] s $ hg st $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > a > EOF forget bar [Ynsa?] a diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -352,7 +352,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun, confirm): +def forget(self, match, prefix, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, after, force, subrepos, @@ -816,10 +816,10 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun, confirm): +def forget(self, match, prefix, dryrun, interactive): return cmdutil.forget(self.ui, self._repo, match, self.wvfs.reljoin(prefix, self._path), - True, dryrun=dryrun, confirm=confirm) + True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror def removefiles(self, matcher, prefix, after, force, subrepos, diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -112,7 +112,6 @@ ] dryrunopts = cmdutil.dryrunopts -confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2062,7 +2061,8 @@ @command( '^forget', -walkopts + dryrunopts + confirmopts, +[('i', 'interactive', None, _('use interactive mode')), +] + walkopts + dryrunopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2098,10 +2098,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun, confirm = opts.get('dry_run'), opts.get('confirm') +dryrun, interactive = opts.get('dry_run'), opts.get('interactive') rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False, dryrun=dryrun, - confirm=confirm)[0] + interactive=interactive)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2031,9 +2031,9 @@ for subpath in
D2934: forget: add --confirm option
khanchi97 added a comment. In https://phab.mercurial-scm.org/D2934#54295, @pulkit wrote: > In https://phab.mercurial-scm.org/D2934#54256, @yuja wrote: > > > The change looks good, but new behavior sounds more like `--interactive` > > than `--confirm`. > > > I agree. @khanchi97 can you send a follow-up renaming the flag to `--interactive`? Okay, I will send one. I also think --interactive is better than --confirm. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2934 To: khanchi97, #hg-reviewers, av6, pulkit, durin42 Cc: durin42, mharbison72, yuja, pulkit, av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2934: forget: add --confirm option
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe7bf5a73e4e1: forget: add --confirm option (authored by khanchi97, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2934?vs=7285=8362#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2934?vs=7285=8362 REVISION DETAIL https://phab.mercurial-scm.org/D2934 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py tests/test-add.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 @@ -232,7 +232,7 @@ commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates, template - forget: include, exclude, dry-run + forget: include, exclude, dry-run, confirm init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -272,3 +272,58 @@ [1] $ cd .. + +test --confirm option in forget + + $ hg init forgetconfirm + $ cd forgetconfirm + $ echo foo > foo + $ hg commit -qAm "foo" + $ echo bar > bar + $ hg commit -qAm "bar" + $ hg forget foo --dry-run --confirm + abort: cannot specify both --dry-run and --confirm + [255] + + $ hg forget foo --config ui.interactive=True --confirm << EOF + > ? + > n + > EOF + forget foo [Ynsa?] ? + y - yes, forget this file + n - no, skip this file + s - skip remaining files + a - include all remaining files + ? - ? (display help) + forget foo [Ynsa?] n + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > y + > n + > EOF + forget bar [Ynsa?] y + forget foo [Ynsa?] n + removing bar + $ hg status + R bar + $ hg up -qC . + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > s + > EOF + forget bar [Ynsa?] s + $ hg st + $ hg up -qC . + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > a + > EOF + forget bar [Ynsa?] a + removing bar + removing foo + $ hg status + R bar + R foo + $ hg up -qC . + + $ cd .. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -352,7 +352,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun): +def forget(self, match, prefix, dryrun, confirm): return ([], []) def removefiles(self, matcher, prefix, after, force, subrepos, @@ -815,10 +815,10 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun): +def forget(self, match, prefix, dryrun, confirm): return cmdutil.forget(self.ui, self._repo, match, self.wvfs.reljoin(prefix, self._path), - True, dryrun=dryrun) + True, dryrun=dryrun, confirm=confirm) @annotatesubrepoerror def removefiles(self, matcher, prefix, after, force, subrepos, diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -112,6 +112,7 @@ ] dryrunopts = cmdutil.dryrunopts +confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2060,7 +2061,7 @@ @command( '^forget', -walkopts + dryrunopts, +walkopts + dryrunopts + confirmopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2096,9 +2097,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun = opts.get('dry_run') +dryrun, confirm = opts.get('dry_run'), opts.get('confirm') rejected = cmdutil.forget(ui, repo, m, prefix="", - explicitonly=False, dryrun=dryrun)[0] + explicitonly=False, dryrun=dryrun, + confirm=confirm)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -63,6 +63,11 @@ _('do not perform actions, just print output')), ] +confirmopts = [ +('', 'confirm', None, + _('ask
D3187: phase: add dry-run functionality
khanchi97 added a comment. @pulkit Can you please review it? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3187 To: khanchi97, pulkit, #hg-reviewers Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3187: phase: add dry-run functionality
khanchi97 updated this revision to Diff 7877. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3187?vs=7874=7877 REVISION DETAIL https://phab.mercurial-scm.org/D3187 AFFECTED FILES mercurial/commands.py tests/test-completion.t tests/test-phases.t CHANGE DETAILS diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -826,3 +826,217 @@ rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 [255] + +Test dry-run functionality + + $ hg init dryrunrepo + $ cd dryrunrepo + $ echo a > a + $ hg ci -qAm 0 + test-debug-phase: new rev 0: x -> 1 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: -> draft + $ echo b > b + $ hg ci -qAm 1 + test-debug-phase: new rev 1: x -> 1 + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: -> draft + $ echo c > c + $ hg ci -qAm 2 + test-debug-phase: new rev 2: x -> 1 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: -> draft + $ echo d > d + $ hg ci -qAm 3 + test-debug-phase: new rev 3: x -> 1 + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: -> draft + $ echo e > e + $ hg ci -qAm 4 + test-debug-phase: new rev 4: x -> 1 + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: -> draft + $ echo f > f + $ hg ci -qAm 5 + test-debug-phase: new rev 5: x -> 1 + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: -> draft + $ hg up 3 -q + $ echo g > g + $ hg ci -qAm 6 + test-debug-phase: new rev 6: x -> 1 + test-hook-close-phase: f19b7f89f44eee9ffe34ba58b4e4ee3b3cea1f34: -> draft + $ echo h > h + $ hg ci -qAm 7 + test-debug-phase: new rev 7: x -> 1 + test-hook-close-phase: 4ccc844d545402eb0f39cd294227cd38de3ece20: -> draft + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: draft + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: draft + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |summary: 4 + | + o changeset: 3:14b465a7e25b + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 3 + | + o changeset: 2:0316ce92851d + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 2 + | + o changeset: 1:925d80f479bb + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 1 + | + o changeset: 0:f7b1eb17ad24 + phase: draft + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + + $ hg phase --public 1 + test-debug-phase: move rev 0: 1 -> 0 + test-debug-phase: move rev 1: 1 -> 0 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: draft -> public + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: draft -> public + $ hg phase --secret 4 --force + test-debug-phase: move rev 2: 1 -> 2 + test-debug-phase: move rev 3: 1 -> 2 + test-debug-phase: move rev 4: 1 -> 2 + test-debug-phase: move rev 5: 1 -> 2 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: draft -> secret + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: draft -> secret + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: draft -> secret + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: draft -> secret + + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: secret + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: secret + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |summary: 4 + | + o changeset: 3:14b465a7e25b + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 3 + | + o changeset: 2:0316ce92851d + | phase:
D3187: phase: add dry-run functionality
khanchi97 updated this revision to Diff 7874. khanchi97 retitled this revision from "phase: Add dry-run functionality" to "phase: add dry-run functionality". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3187?vs=7873=7874 REVISION DETAIL https://phab.mercurial-scm.org/D3187 AFFECTED FILES mercurial/commands.py tests/test-completion.t tests/test-phases.t CHANGE DETAILS diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -826,3 +826,217 @@ rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 [255] + +Test dry-run functionality + + $ hg init dryrunrepo + $ cd dryrunrepo + $ echo a > a + $ hg ci -qAm 0 + test-debug-phase: new rev 0: x -> 1 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: -> draft + $ echo b > b + $ hg ci -qAm 1 + test-debug-phase: new rev 1: x -> 1 + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: -> draft + $ echo c > c + $ hg ci -qAm 2 + test-debug-phase: new rev 2: x -> 1 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: -> draft + $ echo d > d + $ hg ci -qAm 3 + test-debug-phase: new rev 3: x -> 1 + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: -> draft + $ echo e > e + $ hg ci -qAm 4 + test-debug-phase: new rev 4: x -> 1 + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: -> draft + $ echo f > f + $ hg ci -qAm 5 + test-debug-phase: new rev 5: x -> 1 + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: -> draft + $ hg up 3 -q + $ echo g > g + $ hg ci -qAm 6 + test-debug-phase: new rev 6: x -> 1 + test-hook-close-phase: f19b7f89f44eee9ffe34ba58b4e4ee3b3cea1f34: -> draft + $ echo h > h + $ hg ci -qAm 7 + test-debug-phase: new rev 7: x -> 1 + test-hook-close-phase: 4ccc844d545402eb0f39cd294227cd38de3ece20: -> draft + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: draft + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: draft + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |summary: 4 + | + o changeset: 3:14b465a7e25b + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 3 + | + o changeset: 2:0316ce92851d + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 2 + | + o changeset: 1:925d80f479bb + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 1 + | + o changeset: 0:f7b1eb17ad24 + phase: draft + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + + $ hg phase --public 1 + test-debug-phase: move rev 0: 1 -> 0 + test-debug-phase: move rev 1: 1 -> 0 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: draft -> public + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: draft -> public + $ hg phase --secret 4 --force + test-debug-phase: move rev 2: 1 -> 2 + test-debug-phase: move rev 3: 1 -> 2 + test-debug-phase: move rev 4: 1 -> 2 + test-debug-phase: move rev 5: 1 -> 2 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: draft -> secret + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: draft -> secret + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: draft -> secret + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: draft -> secret + + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: secret + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: secret + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |summary: 4 + | + o changeset: 3:14b465a7e25b + | phase: draft + | user:test + | date:
D3187: phase: Add dry-run functionality
khanchi97 created this revision. khanchi97 added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Added the logic to count the number of csets whose phases will be changed, for now it just prints the same stats as we get without dry-run, remaining work is to show the which cset and what phase to be changed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3187 AFFECTED FILES mercurial/commands.py tests/test-phases.t CHANGE DETAILS diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -826,3 +826,217 @@ rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 [255] + +Test dry-run functionality + + $ hg init dryrunrepo + $ cd dryrunrepo + $ echo a > a + $ hg ci -qAm 0 + test-debug-phase: new rev 0: x -> 1 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: -> draft + $ echo b > b + $ hg ci -qAm 1 + test-debug-phase: new rev 1: x -> 1 + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: -> draft + $ echo c > c + $ hg ci -qAm 2 + test-debug-phase: new rev 2: x -> 1 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: -> draft + $ echo d > d + $ hg ci -qAm 3 + test-debug-phase: new rev 3: x -> 1 + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: -> draft + $ echo e > e + $ hg ci -qAm 4 + test-debug-phase: new rev 4: x -> 1 + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: -> draft + $ echo f > f + $ hg ci -qAm 5 + test-debug-phase: new rev 5: x -> 1 + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: -> draft + $ hg up 3 -q + $ echo g > g + $ hg ci -qAm 6 + test-debug-phase: new rev 6: x -> 1 + test-hook-close-phase: f19b7f89f44eee9ffe34ba58b4e4ee3b3cea1f34: -> draft + $ echo h > h + $ hg ci -qAm 7 + test-debug-phase: new rev 7: x -> 1 + test-hook-close-phase: 4ccc844d545402eb0f39cd294227cd38de3ece20: -> draft + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: draft + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: draft + |user:test + |date:Thu Jan 01 00:00:00 1970 + + |summary: 4 + | + o changeset: 3:14b465a7e25b + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 3 + | + o changeset: 2:0316ce92851d + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 2 + | + o changeset: 1:925d80f479bb + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 1 + | + o changeset: 0:f7b1eb17ad24 + phase: draft + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: 0 + + + $ hg phase --public 1 + test-debug-phase: move rev 0: 1 -> 0 + test-debug-phase: move rev 1: 1 -> 0 + test-hook-close-phase: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac: draft -> public + test-hook-close-phase: 925d80f479bb026b0fb3deb27503780b13f74123: draft -> public + $ hg phase --secret 4 --force + test-debug-phase: move rev 2: 1 -> 2 + test-debug-phase: move rev 3: 1 -> 2 + test-debug-phase: move rev 4: 1 -> 2 + test-debug-phase: move rev 5: 1 -> 2 + test-hook-close-phase: 0316ce92851d493393d2181900388caa05d256c3: draft -> secret + test-hook-close-phase: 14b465a7e25bf201e963c055be0e780414cff648: draft -> secret + test-hook-close-phase: b385d13d5ed4ceb2b67ced172470734a60187cd1: draft -> secret + test-hook-close-phase: fdc0253c25cfd67fe42b7be81e3abc9f92bebbd5: draft -> secret + + $ hg log -G -T phases + @ changeset: 7:4ccc844d5454 + | tag: tip + | phase: draft + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 7 + | + o changeset: 6:f19b7f89f44e + | phase: draft + | parent: 3:14b465a7e25b + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: 6 + | + | o changeset: 5:fdc0253c25cf + | | phase: secret + | | user:test + | | date:Thu Jan 01 00:00:00 1970 + + | | summary: 5 + | | + | o changeset: 4:b385d13d5ed4 + |/ phase: secret + |user:test + |date:Thu Jan 01 00:00:00 1970 +
D3000: addremove: remove dry_run, similarity from scmutil.addremove
This revision was automatically updated to reflect the committed changes. Closed by commit rHG14cd5290c4e6: addremove: remove dry_run, similarity from scmutil.addremove (API) (authored by khanchi97, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3000?vs=7524=7535#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3000?vs=7524=7535 REVISION DETAIL https://phab.mercurial-scm.org/D3000 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts, dry_run, similarity): +def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts, dry_run, similarity): +def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -736,14 +736,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher -if dry_run is None: -dry_run = opts.get('dry_run') -if similarity is None: -similarity = float(opts.get('similarity') or 0) +dry_run = opts.get('dry_run') +similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -754,7 +752,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: -if sub.addremove(submatch, prefix, opts, dry_run, similarity): +if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) +opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) +return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. diff --git a/contrib/perf.py b/contrib/perf.py ---
D3000: addremove: remove dry_run, similarity from scmutil.addremove
khanchi97 updated this revision to Diff 7524. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3000?vs=7523=7524 REVISION DETAIL https://phab.mercurial-scm.org/D3000 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts, dry_run, similarity): +def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts, dry_run, similarity): +def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -731,14 +731,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher -if dry_run is None: -dry_run = opts.get('dry_run') -if similarity is None: -similarity = float(opts.get('similarity') or 0) +dry_run = opts.get('dry_run') +similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -749,7 +747,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: -if sub.addremove(submatch, prefix, opts, dry_run, similarity): +if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) +opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) +return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -423,7 +423,8 @@ oldquiet = repo.ui.quiet repo.ui.quiet = True matcher = scmutil.match(repo[None]) -timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True)) +
D3000: addremove: remove dry_run, similarity from scmutil.addremove
khanchi97 updated this revision to Diff 7523. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3000?vs=7500=7523 REVISION DETAIL https://phab.mercurial-scm.org/D3000 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts, dry_run, similarity): +def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts, dry_run, similarity): +def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -731,14 +731,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher -if dry_run is None: -dry_run = opts.get('dry_run') -if similarity is None: -similarity = float(opts.get('similarity') or 0) +dry_run = opts.get('dry_run') +similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -749,7 +747,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: -if sub.addremove(submatch, prefix, opts, dry_run, similarity): +if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) +opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) +return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -423,7 +423,8 @@ oldquiet = repo.ui.quiet repo.ui.quiet = True matcher = scmutil.match(repo[None]) -timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True)) +
D3000: addremove: remove dry_run, similarity from scmutil.addremove
khanchi97 updated this revision to Diff 7500. khanchi97 retitled this revision from "addremove: remove opts from scmutil.addremove" to "addremove: remove dry_run, similarity from scmutil.addremove". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3000?vs=7476=7500 REVISION DETAIL https://phab.mercurial-scm.org/D3000 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts, dry_run, similarity): +def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts, dry_run, similarity): +def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -731,14 +731,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher -if dry_run is None: -dry_run = opts.get('dry_run') -if similarity is None: -similarity = float(opts.get('similarity') or 0) +dry_run = opts.get('dry_run') +similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -749,7 +747,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: -if sub.addremove(submatch, prefix, opts, dry_run, similarity): +if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) +opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) +return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -423,7 +423,7 @@ oldquiet = repo.ui.quiet
D2934: forget: add --confirm option
khanchi97 added a comment. I have made the requested changes. Now --confirm will prompt per file and also added all/skip option which will either include all the remaining files or skip all the remaining files according the user input. INLINE COMMENTS > av6 wrote in cmdutil.py:2007 > "cannot specify both --dry-run and --confirm" is the style used in other > commands. sorry, am I supposed to make any change here? > pulkit wrote in cmdutil.py:2047 > I think the right behavior should be to ask for each file and forget the ones > which user confirmed to forget. cool :) > av6 wrote in commands.py:2043 > Looks like test-completion.t also needs to be updated. yeah, I will update this. > test-add.t:302 > + removing foo > + are you sure you want to forget (yn)? y > + $ cd .. I need some help here. Why it's not passing `n` as a response? I passed `n` in line 299 but as a response from user why it is taking `y` everytime? > pulkit wrote in test-add.t:302 > Looks like it's not reading the input. Look whether ui.interactive is set or > not. I have set ui.interactive=True but, the problem is still same. And also by default ui.interactive is always True. > test-add.t:296 > + > EOF > + forget foo (yn)? y > + removing foo I have set ui.interactive=True but it still not read input. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2934 To: khanchi97, #hg-reviewers, av6, pulkit Cc: mharbison72, yuja, pulkit, av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3000: addremove: remove opts from scmutil.addremove
khanchi97 added a subscriber: yuja. khanchi97 added a comment. I ran all the tests those are related to addremove and they are passing. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3000 To: khanchi97, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2934: forget: add --confirm option
khanchi97 updated this revision to Diff 7285. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2934?vs=7254=7285 REVISION DETAIL https://phab.mercurial-scm.org/D2934 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py tests/test-add.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 @@ -232,7 +232,7 @@ commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates - forget: include, exclude, dry-run + forget: include, exclude, dry-run, confirm init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -272,3 +272,58 @@ [1] $ cd .. + +test --confirm option in forget + + $ hg init forgetconfirm + $ cd forgetconfirm + $ echo foo > foo + $ hg commit -qAm "foo" + $ echo bar > bar + $ hg commit -qAm "bar" + $ hg forget foo --dry-run --confirm + abort: can't specify --dry-run and --confirm + [255] + + $ hg forget foo --config ui.interactive=True --confirm << EOF + > ? + > n + > EOF + forget foo [Ynsa?] ? + y - yes, forget this file + n - no, skip this file + s - skip remaining files + a - include all remaining files + ? - ? (display help) + forget foo [Ynsa?] n + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > y + > n + > EOF + forget bar [Ynsa?] y + forget foo [Ynsa?] n + removing bar + $ hg status + R bar + $ hg up -qC . + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > s + > EOF + forget bar [Ynsa?] s + $ hg st + $ hg up -qC . + + $ hg forget foo bar --config ui.interactive=True --confirm << EOF + > a + > EOF + forget bar [Ynsa?] a + removing bar + removing foo + $ hg status + R bar + R foo + $ hg up -qC . + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -108,6 +108,7 @@ ] dryrunopts = cmdutil.dryrunopts +confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2039,7 +2040,7 @@ @command( '^forget', -walkopts + dryrunopts, +walkopts + dryrunopts + confirmopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2075,9 +2076,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun = opts.get(r'dry_run') +dryrun, confirm = opts.get('dry_run'), opts.get('confirm') rejected = cmdutil.forget(ui, repo, m, prefix="", - explicitonly=False, dryrun=dryrun)[0] + explicitonly=False, dryrun=dryrun, + confirm=confirm)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -58,6 +58,11 @@ _('do not perform actions, just print output')), ] +confirmopts = [ +('', 'confirm', None, + _('ask before applying actions')), +] + remoteopts = [ ('e', 'ssh', '', _('specify ssh command to use'), _('CMD')), @@ -1997,7 +2002,9 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun): +def forget(ui, repo, match, prefix, explicitonly, dryrun, confirm): +if dryrun and confirm: +raise error.Abort(_("can't specify --dry-run and --confirm")) join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2013,7 +2020,8 @@ sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) -subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun) +subbad, subforgot = sub.forget(submatch, prefix, + dryrun=dryrun, confirm=confirm) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: @@ -2036,8 +2044,35 @@ % match.rel(f))
D2934: forget: add --confirm option
khanchi97 updated this revision to Diff 7254. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2934?vs=7252=7254 REVISION DETAIL https://phab.mercurial-scm.org/D2934 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py tests/test-add.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 @@ -232,7 +232,7 @@ commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates - forget: include, exclude, dry-run + forget: include, exclude, dry-run, confirm init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -272,3 +272,30 @@ [1] $ cd .. + +test --confirm option in forget + + $ hg init forgetconfirm + $ cd forgetconfirm + $ echo foo > foo + $ hg commit -qAm "foo" + $ hg forget foo --dry-run --confirm + abort: can't specify --dry-run and --confirm + [255] + $ hg forget foo --confirm << EOF + > y + > EOF + forget foo (yn)? y + removing foo + $ hg status + R foo + $ hg up -qC . + $ hg forget foo --confirm << EOF + > n + > EOF + forget foo (yn)? y + removing foo + $ hg status + R foo + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -108,6 +108,7 @@ ] dryrunopts = cmdutil.dryrunopts +confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2039,7 +2040,7 @@ @command( '^forget', -walkopts + dryrunopts, +walkopts + dryrunopts + confirmopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2075,9 +2076,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun = opts.get(r'dry_run') +dryrun, confirm = opts.get('dry_run'), opts.get('confirm') rejected = cmdutil.forget(ui, repo, m, prefix="", - explicitonly=False, dryrun=dryrun)[0] + explicitonly=False, dryrun=dryrun, + confirm=confirm)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -58,6 +58,11 @@ _('do not perform actions, just print output')), ] +confirmopts = [ +('', 'confirm', None, + _('ask before applying actions')), +] + remoteopts = [ ('e', 'ssh', '', _('specify ssh command to use'), _('CMD')), @@ -1997,7 +2002,9 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun): +def forget(ui, repo, match, prefix, explicitonly, dryrun, confirm): +if dryrun and confirm: +raise error.Abort(_("can't specify --dry-run and --confirm")) join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2013,7 +2020,8 @@ sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) -subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun) +subbad, subforgot = sub.forget(submatch, prefix, + dryrun=dryrun, confirm=confirm) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: @@ -2036,8 +2044,14 @@ % match.rel(f)) bad.append(f) +if confirm: +filenames = ' '.join(forget) +if ui.promptchoice(_('forget %s (yn)?' + '$$ $$ ') % filenames): +raise error.Abort(_('forget canceled')) + for f in forget: -if ui.verbose or not match.exact(f): +if ui.verbose or not match.exact(f) or confirm: ui.status(_('removing %s\n') % match.rel(f)) if not dryrun: To: khanchi97, #hg-reviewers, av6, pulkit Cc: pulkit, av6, mercurial-devel ___ Mercurial-devel mailing list
D2934: forget: add --confirm option
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Also added confirmopts in cmdutil.py REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2934 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py tests/test-add.t CHANGE DETAILS diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -272,3 +272,32 @@ [1] $ cd .. + +test --confirm option in forget + + $ hg init forgetconfirm + $ cd forgetconfirm + $ echo foo > foo + $ hg commit -qAm "foo" + $ hg forget foo --dry-run --confirm + abort: can't specify --dry-run and --confirm + [255] + $ hg forget foo --confirm -v << EOF + > y + > EOF + removing foo + are you sure you want to forget (yn)? y + $ hg diff + diff -r e63c23eaa88a foo + --- a/fooThu Jan 01 00:00:00 1970 + + +++ /dev/nullThu Jan 01 00:00:00 1970 + + @@ -1,1 +0,0 @@ + -foo + + $ hg up -qC . + $ hg forget foo --confirm -v << EOF + > n + > EOF + removing foo + are you sure you want to forget (yn)? y + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -108,6 +108,7 @@ ] dryrunopts = cmdutil.dryrunopts +confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2039,7 +2040,7 @@ @command( '^forget', -walkopts + dryrunopts, +walkopts + dryrunopts + confirmopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2075,9 +2076,10 @@ raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) -dryrun = opts.get(r'dry_run') +dryrun, confirm = opts.get(r'dry_run'), opts.get(r'confirm') rejected = cmdutil.forget(ui, repo, m, prefix="", - explicitonly=False, dryrun=dryrun)[0] + explicitonly=False, dryrun=dryrun, + confirm=confirm)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -58,6 +58,11 @@ _('do not perform actions, just print output')), ] +confirmopts = [ +('', 'confirm', None, + _('ask before applying actions')), +] + remoteopts = [ ('e', 'ssh', '', _('specify ssh command to use'), _('CMD')), @@ -1997,7 +2002,9 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun): +def forget(ui, repo, match, prefix, explicitonly, dryrun, confirm): +if dryrun and confirm: +raise error.Abort(_("can't specify --dry-run and --confirm")) join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2013,7 +2020,8 @@ sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) -subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun) +subbad, subforgot = sub.forget(submatch, prefix, + dryrun=dryrun, confirm=confirm) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: @@ -2037,9 +2045,14 @@ bad.append(f) for f in forget: -if ui.verbose or not match.exact(f): +if ui.verbose or not match.exact(f) or confirm: ui.status(_('removing %s\n') % match.rel(f)) +if confirm: +if ui.promptchoice(_('are you sure you want to forget (yn)?' + '$$ $$ ')): +raise error.Abort(_('forget canceled')) + if not dryrun: rejected = wctx.forget(forget, prefix) bad.extend(f for f in rejected if f in match.files()) To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. pulkit: Can you please review it? I have made the requested changes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. I have added tests to show the behavior of --no-commit with other flags. INLINE COMMENTS > pulkit wrote in commands.py:2309 > To be honest I am not fan of storing data in such format, but that's how we > store data right now. I have finally a series in review where we can use cbor > to serialize data while writing to state files. Look at > https://phab.mercurial-scm.org/D2591. I think if that goes in, we should use > that format to store about `no-commit` flag. okay, when your series will be pushed in, I will use cbor to write in statefile. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 updated this revision to Diff 6538. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2409?vs=6325=6538 REVISION DETAIL https://phab.mercurial-scm.org/D2409 AFFECTED FILES mercurial/commands.py tests/test-graft.t CHANGE DETAILS diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -1373,3 +1373,104 @@ note: graft of 7:d3c3f2b38ecc created no changes to commit $ cd .. + +Graft a change from a branch without making any commit using --no-commit option: + + $ hg init dirtochecknocommit + $ cd dirtochecknocommit + $ echo a > a + $ hg ci -qAm0 + $ echo b > b + $ hg ci -qAm1 + $ hg up -q 0 + $ echo c > c + $ hg ci -qAm2 +Check --no-commit do not work with those options which are used for making a commit +like -e/-D/-U/-d/-u: + $ hg graft 1 --no-commit -e + abort: can't specify --no-commit and --edit + [255] + $ hg graft 1 --no-commit + grafting 1:925d80f479bb "1" + + $ hg tip -T "rev: {rev}\n" + rev: 2 + + $ hg diff + diff -r db815d6d32e6 b + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/b Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +b + + $ hg ci -qm3 + +Make a conflict between two heads and check --no-commit is resepected after --continue: + + $ echo A>a + $ hg ci -qm4 + $ hg up -q 1 + $ echo B>a + $ hg ci -qm5 + $ hg graft 4 --no-commit + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Resolving conflict: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue: + + $ hg graft --continue + grafting 4:a08bb3910e7c "4" + + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + +For checking --continue and --no-commit, again make the same conflict: + $ echo B>a + $ hg graft 4 + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Resolving conflict: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue with --no-commit: + $ hg graft --continue --no-commit + grafting 4:a08bb3910e7c "4" + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2074,6 +2074,8 @@ ('c', 'continue', False, _('resume interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), + ('', 'no-commit', None, + _("don't commit, just apply the changes in working directory")), ('f', 'force', False, _('force graft')), ('D', 'currentdate', False, _('record the current date as commit date')), @@ -2110,7 +2112,7 @@ .. note:: The -c/--continue option does not reapply earlier options, except - for --force. + for --force and --no-commit. .. container:: verbose @@ -2162,13 +2164,31 @@ **pycompat.strkwargs(opts)) cont = False +if opts.get('no_commit'): +if opts.get('edit'): +raise error.Abort(_("can't specify --no-commit and --edit")) +elif opts.get('currentdate'): +raise error.Abort(_("can't specify --no-commit and --currentdate")) +elif opts.get('currentuser'): +raise error.Abort(_("can't specify --no-commit and --currentuser")) +elif opts.get('date'): +raise error.Abort(_("can't specify --no-commit and --date")) +elif opts.get('user'): +raise error.Abort(_("can't specify --no-commit and --user")) + if opts.get('continue'): +if opts.get('no_commit'): +lines = repo.vfs.read('graftstate').splitlines(True) +nodelines = [line for line in lines[1:]] +repo.vfs.write('graftstate', 'True\n') +repo.vfs.append('graftstate', ''.join(nodelines)) cont = True if revs: raise error.Abort(_("can't specify --continue and revisions")) # read in unfinished revisions try: -nodes = repo.vfs.read('graftstate').splitlines() +lines = repo.vfs.read('graftstate').splitlines() +nodes = lines[1:] revs = [repo[node].rev() for node in nodes] except
D2579: WIP: fix unshelve refuses to apply on modified MQ patch (issue4318)
khanchi97 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/D2579 AFFECTED FILES hgext/mq.py hgext/rebase.py CHANGE DETAILS diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1634,10 +1634,11 @@ # This check isn't strictly necessary, since mq detects commits over an # applied patch. But it prevents messing up the working directory when # 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: -raise error.Abort(_('cannot rebase onto an applied mq patch')) +if not repo.vfs.readlines('journal.desc')[1] == 'unshelve\n': +if 'qtip' in repo.tags(): +mqapplied = set(repo[s.node].rev() for s in repo.mq.applied) +if set(destmap.values()) & mqapplied: +raise error.Abort(_('cannot rebase onto an applied mq patch')) # Get "cycle" error early by exhausting the generator. sortedsrc = list(sortsource(destmap)) # a list of sorted revs diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -3482,9 +3482,10 @@ force=False, editor=False, extra=None): if extra is None: extra = {} -self.abortifwdirpatched( -_('cannot commit over an applied mq patch'), -force) +if not repo.vfs.readlines('journal.desc')[1] == 'unshelve\n': +self.abortifwdirpatched( +_('cannot commit over an applied mq patch'), +force) return super(mqrepo, self).commit(text, user, date, match, force, editor, extra) To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. What I did to store `--no-commit` flag in `graftstate` is: Add a flag `True/False` in 1st line of `graftstate` and keep it updated from previous value in `graftstate` for every iteration in `revs`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 updated this revision to Diff 6325. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2409?vs=6132=6325 REVISION DETAIL https://phab.mercurial-scm.org/D2409 AFFECTED FILES mercurial/commands.py tests/test-graft.t CHANGE DETAILS diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -1373,3 +1373,69 @@ note: graft of 7:d3c3f2b38ecc created no changes to commit $ cd .. + +Graft a change from a branch without making any commit using --no-commit option + + $ hg init dirtochecknocommit + $ cd dirtochecknocommit + $ echo a > a + $ hg ci -qAm0 + $ echo b > b + $ hg ci -qAm1 + $ hg up -q 0 + $ echo c > c + $ hg ci -qAm2 + $ hg graft 1 --no-commit + grafting 1:925d80f479bb "1" + + $ hg tip -T "rev: {rev}\n" + rev: 2 + + $ hg diff + diff -r db815d6d32e6 b + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/b Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +b + + $ hg ci -qm3 + +Make a conflict between two heads and check --no-commit is resepected after --continue + + $ echo A>a + $ hg ci -qm4 + $ hg up -q 1 + $ echo B>a + $ hg ci -qm5 + $ hg graft 4 --no-commit + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Edit: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue: + + $ hg graft --continue + grafting 4:a08bb3910e7c "4" + + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2074,6 +2074,8 @@ ('c', 'continue', False, _('resume interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), + ('', 'no-commit', None, + _("don't commit, just apply the changes in working directory")), ('f', 'force', False, _('force graft')), ('D', 'currentdate', False, _('record the current date as commit date')), @@ -2168,7 +2170,8 @@ raise error.Abort(_("can't specify --continue and revisions")) # read in unfinished revisions try: -nodes = repo.vfs.read('graftstate').splitlines() +lines = repo.vfs.read('graftstate').splitlines() +nodes = lines[1:] revs = [repo[node].rev() for node in nodes] except IOError as inst: if inst.errno != errno.ENOENT: @@ -2297,8 +2300,15 @@ # report any conflicts if stats and stats[3] > 0: # write out state for --continue +if opts.get('no_commit') and pos == 0: +repo.vfs.write('graftstate', 'True\n') +elif repo.vfs.exists('graftstate'): +lines = repo.vfs.read('graftstate').splitlines() +repo.vfs.write('graftstate', lines[0] + '\n') +else: +repo.vfs.write('graftstate', 'False\n') nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] -repo.vfs.write('graftstate', ''.join(nodelines)) +repo.vfs.append('graftstate', ''.join(nodelines)) extra = '' if opts.get('user'): extra += ' --user %s' % util.shellquote(opts['user']) @@ -2314,12 +2324,17 @@ cont = False # commit -node = repo.commit(text=message, user=user, -date=date, extra=extra, editor=editor) -if node is None: -ui.warn( -_('note: graft of %d:%s created no changes to commit\n') % -(ctx.rev(), ctx)) +nocommitflag = 'False' +if opts.get('continue'): +lines = repo.vfs.read('graftstate').splitlines() +nocommitflag = lines[0] +if not (opts.get('no_commit') or nocommitflag == 'True'): +node = repo.commit(text=message, user=user, +date=date, extra=extra, editor=editor) +if node is None: +ui.warn( +_('note: graft of %d:%s created no changes to commit\n') % +(ctx.rev(), ctx)) # remove state when we complete successfully if not opts.get('dry_run'): To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 updated this revision to Diff 6132. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2409?vs=6028=6132 REVISION DETAIL https://phab.mercurial-scm.org/D2409 AFFECTED FILES mercurial/commands.py tests/test-graft.t CHANGE DETAILS diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -1373,3 +1373,69 @@ note: graft of 7:d3c3f2b38ecc created no changes to commit $ cd .. + +Graft a change from a branch without making any commit using --no-commit option + + $ hg init dirtochecknocommit + $ cd dirtochecknocommit + $ echo a > a + $ hg ci -qAm0 + $ echo b > b + $ hg ci -qAm1 + $ hg up -q 0 + $ echo c > c + $ hg ci -qAm2 + $ hg graft 1 --no-commit + grafting 1:925d80f479bb "1" + + $ hg tip -T "rev: {rev}\n" + rev: 2 + + $ hg diff + diff -r db815d6d32e6 b + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/b Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +b + + $ hg ci -qm3 + +Make a conflict between two heads and check --no-commit is resepected after --continue + + $ echo A>a + $ hg ci -qm4 + $ hg up -q 1 + $ echo B>a + $ hg ci -qm5 + $ hg graft 4 --no-commit + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Edit: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue: + + $ hg graft --continue + grafting 4:a08bb3910e7c "4" + + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2074,6 +2074,8 @@ ('c', 'continue', False, _('resume interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), + ('', 'no-commit', None, + _("don't commit, just apply the changes in working directory")), ('f', 'force', False, _('force graft')), ('D', 'currentdate', False, _('record the current date as commit date')), @@ -2153,6 +2155,9 @@ revs = list(revs) revs.extend(opts.get('rev')) +if opts.get('no_commit'): +# write out flag for --continue +repo.vfs.write('nocommitflag','do not commit\n') if not opts.get('user') and opts.get('currentuser'): opts['user'] = ui.username() if not opts.get('date') and opts.get('currentdate'): @@ -2314,16 +2319,18 @@ cont = False # commit -node = repo.commit(text=message, user=user, -date=date, extra=extra, editor=editor) -if node is None: -ui.warn( -_('note: graft of %d:%s created no changes to commit\n') % -(ctx.rev(), ctx)) +if not repo.vfs.exists('nocommitflag'): +node = repo.commit(text=message, user=user, +date=date, extra=extra, editor=editor) +if node is None: +ui.warn( +_('note: graft of %d:%s created no changes to commit\n') % +(ctx.rev(), ctx)) # remove state when we complete successfully if not opts.get('dry_run'): repo.vfs.unlinkpath('graftstate', ignoremissing=True) +repo.vfs.unlinkpath('nocommitflag', ignoremissing=True) return 0 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. Hello Pulkit, After spending some time with graft implementation, I hope now I have a good understanding of how graft is working. Let me tell you what I have understood and how I want to implement `--no-commit` mode. So when we hit a merge conflict what we do is save the current state in `graftstate` by storing `rev for rev in revs[current_pos: ]` And after marking resolved, IIUC when we run `$ hg graft --continue` we only left with `graftstate` and we have no idea what are the previous flags passed to graft. My solution for `--no-commit` mode: As in case of continue, we are only left with graftstate, So I am thinking to make a `no_commit_flag` file similarly as we create `graftstate` file and when we get `--no-commit` flag we can create this file and after completion of the command we can unlink this `no_commit_flag` file. Please let me know if I am on the right path or not? Thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 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/D2409 AFFECTED FILES mercurial/commands.py tests/test-graft.t CHANGE DETAILS diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -1373,3 +1373,30 @@ note: graft of 7:d3c3f2b38ecc created no changes to commit $ cd .. + +Graft a change from a branch without making any commit using --no-commit option + + $ hg init dirtochecknocommit + $ cd dirtochecknocommit + $ echo a > a + $ hg ci -qAm0 + $ echo b > b + $ hg ci -qAm1 + $ hg up -q 0 + $ echo c > c + $ hg ci -qAm2 + $ hg graft 1 --no-commit + grafting 1:925d80f479bb "1" + note: graft of 1:925d80f479bb created no changes to commit + + $ hg tip -T "rev : {rev}\n" + rev : 2 + + $ hg diff + diff -r db815d6d32e6 b + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/b Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +b + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2074,6 +2074,8 @@ ('c', 'continue', False, _('resume interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), + ('', 'no-commit', None, + _("don't commit, just apply the changes in working directory")), ('f', 'force', False, _('force graft')), ('D', 'currentdate', False, _('record the current date as commit date')), @@ -2313,9 +2315,11 @@ else: cont = False +node = None # commit -node = repo.commit(text=message, user=user, -date=date, extra=extra, editor=editor) +if not opts.get('no_commit'): +node = repo.commit(text=message, user=user, +date=date, extra=extra, editor=editor) if node is None: ui.warn( _('note: graft of %d:%s created no changes to commit\n') % To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2278: bundle: updates the help text for hg bundle (issue5744) [bugzilla]
khanchi97 added a comment. Okay, I will take care of that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2278 To: khanchi97, #hg-reviewers, yuja Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2278: bundle: updates the help text for hg bundle (issue5744) [bugzilla]
This revision was automatically updated to reflect the committed changes. Closed by commit rHGff36116f30f3: bundle: updates the help text for hg bundle (issue5744) (authored by khanchi97, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2278?vs=5794=5809#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2278?vs=5794=5809 REVISION DETAIL https://phab.mercurial-scm.org/D2278 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 @@ -1157,13 +1157,15 @@ def bundle(ui, repo, fname, dest=None, **opts): """create a bundle file -Generate a bundle file containing data to be added to a repository. +Generate a bundle file containing data to be transferred to another +repository. To create a bundle containing all changesets, use -a/--all (or --base null). Otherwise, hg assumes the destination will have all the nodes you specify with --base parameters. Otherwise, hg will assume the repository has all the nodes in destination, or -default-push/default if no destination is specified. +default-push/default if no destination is specified, where destination +is the repository you provide through DEST option. You can change bundle format with the -t/--type option. See :hg:`help bundlespec` for documentation on this format. By default, To: khanchi97, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2278: bundle: updates the help text for hg bundle (issue5744) [bugzilla]
khanchi97 updated this revision to Diff 5778. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2278?vs=5760=5778 REVISION DETAIL https://phab.mercurial-scm.org/D2278 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 @@ -1157,11 +1157,13 @@ def bundle(ui, repo, fname, dest=None, **opts): """create a bundle file -Generate a bundle file containing data to be added to a repository. +Generate a bundle file containing data to be transferred to another +repository. To create a bundle containing all changesets, use -a/--all (or --base null). Otherwise, hg assumes the destination will have -all the nodes you specify with --base parameters. Otherwise, hg +all the nodes you specify with --base parameters, where destination is +the repository you provide through [DEST] option. Otherwise, hg will assume the repository has all the nodes in destination, or default-push/default if no destination is specified. To: khanchi97, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2276: a: change a to add some new lines
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY So I have added some code to check how my patch will be look like. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2276 AFFECTED FILES a CHANGE DETAILS diff --git a/a b/a --- a/a +++ b/a @@ -1 +1,2 @@ -a +So it's very nice to see you! +Btw, I dont' have any idea about it. To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel