D3187: phase: add dry-run functionality
This revision now requires changes to proceed. baymax added a comment. baymax requested changes to this revision. There seems to have been no activities on this Diff for the past 3 Months. By policy, we are automatically moving it out of the `need-review` state. Please, move it back to `need-review` without hesitation if this diff should still be discussed. :baymax:need-review-idle: REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D3187/new/ REVISION DETAIL https://phab.mercurial-scm.org/D3187 To: khanchi97, pulkit, #hg-reviewers, baymax 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 8962. khanchi97 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3187?vs=8896=8962 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,122 @@ rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 [255] + +Test dry-run functionality, first lets prepare wrdir: + + $ cd .. + $ 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 + +Now, lets check working of --dry-run: + + $ hg phase --secret --force 1 -n + revisions whose phase can be changed: + [1, 2, 3, 6, 7] + + $ 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 --public 5 7 -n + revisions whose phase can be changed: + [2, 3, 4, 5, 6, 7] + + $ 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 + + + $ cd .. diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -324,7 +324,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/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3898,7 +3898,7 @@ ('s', 'secret', False, _('set changeset phase to secret')), ('f', 'force', False, _('allow to move boundary backward')), ('r', 'rev', [], _('target revision'), _('REV')), -], +] +
D3187: phase: add dry-run functionality
pulkit added a comment. Nice work! I like where how you simplified things from previous version. If you look at the patch, this seems to do multiple things at once which are: - adding dry-run argument to advanceboundary and retractboundary functions - adding a new --dry-run flag to hg phase Let's break things up in individual patches so that we can improve more on individual pieces. Can you split this into a separate patch for adding dryrun argument to each function, i.e. one patch for adcanceboundary, one for retractboundary, and then one last patch which adds the new flag? That will be very much helpful in reviewing this work and also making incremental changes and moving forward step by step. 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 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
pulkit added a comment. In https://phab.mercurial-scm.org/D3187#57349, @khanchi97 wrote: > okay, but I have some queries like > > 1. How about showing revision no. instead of cset id? I think we should show cset ids. If you want to with rev numbers, go with that. This should not be a blocker to get the initial patch in. > 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 There are two ways you can show the range in this case: 1. 0316ce92851d::b385d13d5ed4 and f19b7f89f44e::4ccc844d5454 2. 0316ce92851d::4ccc844d5454 and b385d13d5ed4 Look into `hg help revsets` to understand what `::` means. 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 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
D3187: phase: add dry-run functionality
pulkit added inline comments. INLINE COMMENTS > commands.py:3898 > if newdata[cl.rev(n)] < targetphase] > +if opts['dry_run']: > +rejected = [] Since all the logic is copy-pasted from phases.advanceboundary and phases.retractboundary, why not we just pass the `--dry-run` option there and get the count from those functions only. > test-phases.t:990 > + $ hg phase --draft 0 5 --force -n > + phase changed for 4 changesets > + This is not very much helpful. In such cases, how about showing the range of changesets, something like: f7b1eb17ad24::925d80f479bb public -> draft b385d13d5ed4::fdc0253c25cf secret -> draft 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 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
av6 added inline comments. INLINE COMMENTS > commands.py:3872 > +if opts['dry_run']: > +raise error.Abort(_("can't use --dryrun when no targetphase")) > # display `"cannot use --dry-run without target phase"` 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 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 +