D2409: graft: add no-commit mode (issue5631)

2018-05-13 Thread khanchi97 (Sushil khanchi)
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


D3187: phase: add dry-run functionality

2018-05-24 Thread khanchi97 (Sushil khanchi)
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

2018-05-25 Thread khanchi97 (Sushil khanchi)
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 

D3757: rebase: add dry-run functionality

2018-06-16 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For now, it just notify that if we will hit a conflict or not, but
  we can improve this like making it a --confirm flag or by showing the
  graph that would result when we will run the command without --dry-run

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -155,4 +155,169 @@
   |/
   o  0: b173517d0057 'a'
   
+Test dry-run rebasing
+  $ hg init skrepo
+  $ cd skrepo
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo b>b
+  $ hg ci -Aqmb
+  $ echo c>c
+  $ hg ci -Aqmc
+  $ echo d>d
+  $ hg ci -Aqmd
+  $ echo e>e
+  $ hg ci -Aqme
 
+  $ hg up 1 -q
+  $ echo f>f
+  $ hg ci -Amf
+  adding f
+  created new head
+  $ echo g>g
+  $ hg ci -Aqmg
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Make sure it throws error while passing --continue or --abort with --dry-run
+  $ hg rebase -s 2 -d 6 -n --continue
+  abort: cannot specify both --dry-run and --continue
+  [255]
+  $ hg rebase -s 2 -d 6 -n --abort
+  abort: cannot specify both --dry-run and --abort
+  [255]
+
+Check dryrun gives correct results when there is no conflict in rebasing
+  $ hg rebase -s 2 -d 6 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  There will be no conflict, you can rebase
+  rebase aborted
+
+  $ hg diff
+  $ hg status
+
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is no conflict
+  $ hg rebase -s 2 -d 6 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  There will be no conflict, you can rebase
+  rebase aborted
+
+Check dryrun gives correct results when there is conflict in rebasing
+Make a conflict:
+  $ hg up 6 -q
+  $ echo conflict>e
+  $ hg ci -Aqm "conflict with e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d 7 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  transaction abort!
+  rollback completed
+  Hit a merge conflict
+  rebase aborted
+  $ hg diff
+  $ hg status
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is conflicts
+  $ hg rebase -s 2 -d 7 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  Hit a merge conflict
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -673,8 +673,7 @@
 ('a', 'abort', False, _('abort an interrupted rebase')),
 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
'in the specified revset (EXPERIMENTAL)')),
- ] +
-cmdutil.formatteropts,
+ ] + cmdutil.dryrunopts + cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
@@ -798,6 +797,15 @@
 
 """
 inmemory = ui.configbool('rebase', 'experimental.inmemory')
+dryrun = opts.get(r'dry_run')
+if dryrun:
+if (opts.get(r'abort')):
+raise error.Abort(_('cannot specify both --dry-run '
+  

D3756: rebase: no need to backup rebased csets while aborting

2018-06-16 Thread khanchi97 (Sushil khanchi)
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/D3756

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-abort.t

CHANGE DETAILS

diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -115,7 +115,6 @@
 Abort (should clear out unsupported merge state):
 
   $ hg rebase --abort
-  saved backup bundle to 
$TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
   rebase aborted
   $ hg debugmergestate
   no merge state found
@@ -406,7 +405,6 @@
   [255]
 
   $ hg rebase --abort
-  saved backup bundle to 
$TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
   rebase aborted
   $ hg log -G --template "{rev} {desc} {bookmarks}"
   o  6 no-a
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1573,7 +1573,7 @@
 # Strip from the first rebased revision
 if rebased:
 # no backup of rebased cset versions needed
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=False)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3757: rebase: add dry-run functionality

2018-06-18 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf4f1fb1cbfb4: rebase: add dry-run functionality (authored 
by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3757?vs=9124=9177#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3757?vs=9124=9177

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -155,4 +155,170 @@
   |/
   o  0: b173517d0057 'a'
   
+Test dry-run rebasing
+  $ hg init skrepo
+  $ cd skrepo
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo b>b
+  $ hg ci -Aqmb
+  $ echo c>c
+  $ hg ci -Aqmc
+  $ echo d>d
+  $ hg ci -Aqmd
+  $ echo e>e
+  $ hg ci -Aqme
 
+  $ hg up 1 -q
+  $ echo f>f
+  $ hg ci -Amf
+  adding f
+  created new head
+  $ echo g>g
+  $ hg ci -Aqmg
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Make sure it throws error while passing --continue or --abort with --dry-run
+  $ hg rebase -s 2 -d 6 -n --continue
+  abort: cannot specify both --dry-run and --continue
+  [255]
+  $ hg rebase -s 2 -d 6 -n --abort
+  abort: cannot specify both --dry-run and --abort
+  [255]
+
+Check dryrun gives correct results when there is no conflict in rebasing
+  $ hg rebase -s 2 -d 6 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
+  rebase aborted
+
+  $ hg diff
+  $ hg status
+
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is no conflict
+  $ hg rebase -s 2 -d 6 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  rebase aborted
+
+Check dryrun gives correct results when there is conflict in rebasing
+Make a conflict:
+  $ hg up 6 -q
+  $ echo conflict>e
+  $ hg ci -Aqm "conflict with e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d 7 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  transaction abort!
+  rollback completed
+  hit a merge conflict
+  rebase aborted
+  $ hg diff
+  $ hg status
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is conflicts
+  $ hg rebase -s 2 -d 7 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  hit a merge conflict
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -673,8 +673,7 @@
 ('a', 'abort', False, _('abort an interrupted rebase')),
 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
'in the specified revset (EXPERIMENTAL)')),
- ] +
-cmdutil.formatteropts,
+ ] + cmdutil.dryrunopts + cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
@@ -798,6 +797,13 @@
 
 """
 inmemory = ui.configbool('rebase', 'experimental.inmemory')
+dryrun = opts.get(r'dry_run')
+if dryrun:
+if 

D3757: rebase: add dry-run functionality

2018-06-17 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9122.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3757?vs=9109=9122

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -155,4 +155,169 @@
   |/
   o  0: b173517d0057 'a'
   
+Test dry-run rebasing
+  $ hg init skrepo
+  $ cd skrepo
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo b>b
+  $ hg ci -Aqmb
+  $ echo c>c
+  $ hg ci -Aqmc
+  $ echo d>d
+  $ hg ci -Aqmd
+  $ echo e>e
+  $ hg ci -Aqme
 
+  $ hg up 1 -q
+  $ echo f>f
+  $ hg ci -Amf
+  adding f
+  created new head
+  $ echo g>g
+  $ hg ci -Aqmg
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Make sure it throws error while passing --continue or --abort with --dry-run
+  $ hg rebase -s 2 -d 6 -n --continue
+  abort: cannot specify both --dry-run and --continue
+  [255]
+  $ hg rebase -s 2 -d 6 -n --abort
+  abort: cannot specify both --dry-run and --abort
+  [255]
+
+Check dryrun gives correct results when there is no conflict in rebasing
+  $ hg rebase -s 2 -d 6 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  rebase aborted
+
+  $ hg diff
+  $ hg status
+
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is no conflict
+  $ hg rebase -s 2 -d 6 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  rebase aborted
+
+Check dryrun gives correct results when there is conflict in rebasing
+Make a conflict:
+  $ hg up 6 -q
+  $ echo conflict>e
+  $ hg ci -Aqm "conflict with e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d 7 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  transaction abort!
+  rollback completed
+  hit a merge conflict
+  rebase aborted
+  $ hg diff
+  $ hg status
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is conflicts
+  $ hg rebase -s 2 -d 7 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  hit a merge conflict
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -673,8 +673,7 @@
 ('a', 'abort', False, _('abort an interrupted rebase')),
 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
'in the specified revset (EXPERIMENTAL)')),
- ] +
-cmdutil.formatteropts,
+ ] + cmdutil.dryrunopts + cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
@@ -798,6 +797,13 @@
 
 """
 inmemory = ui.configbool('rebase', 'experimental.inmemory')
+dryrun = opts.get(r'dry_run')
+if dryrun:
+if opts.get(r'abort'):
+raise error.Abort(_('cannot specify both --dry-run and 
--abort'))
+if opts.get(r'continue'):
+raise error.Abort(_('cannot specify both --dry-run and 
--continue'))
+
 if (opts.get(r'continue') or opts.get(r'abort') or
   

D3757: rebase: add dry-run functionality

2018-06-17 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9124.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3757?vs=9122=9124

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -155,4 +155,169 @@
   |/
   o  0: b173517d0057 'a'
   
+Test dry-run rebasing
+  $ hg init skrepo
+  $ cd skrepo
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo b>b
+  $ hg ci -Aqmb
+  $ echo c>c
+  $ hg ci -Aqmc
+  $ echo d>d
+  $ hg ci -Aqmd
+  $ echo e>e
+  $ hg ci -Aqme
 
+  $ hg up 1 -q
+  $ echo f>f
+  $ hg ci -Amf
+  adding f
+  created new head
+  $ echo g>g
+  $ hg ci -Aqmg
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Make sure it throws error while passing --continue or --abort with --dry-run
+  $ hg rebase -s 2 -d 6 -n --continue
+  abort: cannot specify both --dry-run and --continue
+  [255]
+  $ hg rebase -s 2 -d 6 -n --abort
+  abort: cannot specify both --dry-run and --abort
+  [255]
+
+Check dryrun gives correct results when there is no conflict in rebasing
+  $ hg rebase -s 2 -d 6 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  rebase aborted
+
+  $ hg diff
+  $ hg status
+
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is no conflict
+  $ hg rebase -s 2 -d 6 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  there will be no conflict, you can rebase
+  rebase aborted
+
+Check dryrun gives correct results when there is conflict in rebasing
+Make a conflict:
+  $ hg up 6 -q
+  $ echo conflict>e
+  $ hg ci -Aqm "conflict with e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d 7 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  transaction abort!
+  rollback completed
+  hit a merge conflict
+  rebase aborted
+  $ hg diff
+  $ hg status
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is conflicts
+  $ hg rebase -s 2 -d 7 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  hit a merge conflict
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -673,8 +673,7 @@
 ('a', 'abort', False, _('abort an interrupted rebase')),
 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
'in the specified revset (EXPERIMENTAL)')),
- ] +
-cmdutil.formatteropts,
+ ] + cmdutil.dryrunopts + cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
@@ -798,6 +797,13 @@
 
 """
 inmemory = ui.configbool('rebase', 'experimental.inmemory')
+dryrun = opts.get(r'dry_run')
+if dryrun:
+if opts.get(r'abort'):
+raise error.Abort(_('cannot specify both --dry-run and --abort'))
+if opts.get(r'continue'):
+raise error.Abort(_('cannot specify both --dry-run and 
--continue'))
+
 if (opts.get(r'continue') or opts.get(r'abort') or
 repo.currenttransaction() is not None):
 

D3757: rebase: add dry-run functionality

2018-06-17 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  @yuja I have the made the requested changes. See if I have made the correct
  changes.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

To: khanchi97, #hg-reviewers, indygreg
Cc: yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3757: rebase: add dry-run functionality

2018-06-17 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3757#58993, @yuja wrote:
  
  > > +dryrun = opts.get(r'dry_run')
  > >  +if dryrun:
  > >  +if opts.get(r'abort'):
  > >  +raise error.Abort(_('cannot specify both --dry-run and 
--abort'))
  > >  +if opts.get(r'continue'):
  > >  +raise error.Abort(_('cannot specify both --dry-run and 
--continue'))
  >
  > Please remove the excessive 4 spaces before the "raise".
  
  
  Oh, sorry.
  
  > 
  > 
  >> +if dryrun:
  >>  +try:
  >>  +overrides = {('rebase', 'singletransaction'): True}
  >>  +with ui.configoverride(overrides, 'rebase'):
  >>  +_origrebase(ui, repo, inmemory=True, dryrun=dryrun, 
**opts)
  > 
  > I meant the argument name `dryrun=` is misleading because it actually does
  >  rebase so `inmemory=True` and `_origrebase(ui, repo, abort=True)` are 
required.
  >  I think it's something like `leaveunfinished=`.
  
  Ah, right. I got it.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

To: khanchi97, #hg-reviewers, indygreg
Cc: yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3757: rebase: add dry-run functionality

2018-06-17 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  @indygreg  @yuja thanks for your reviews :)  
  I will send some patches to improve --dry-run for rebase as greg suggested.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3757

To: khanchi97, #hg-reviewers, indygreg
Cc: yuja, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3764: rebase: improve output of --dry-run

2018-06-17 Thread khanchi97 (Sushil khanchi)
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/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,11 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -241,11 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -278,14 +278,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -315,9 +315,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, **opts):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,10 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+suppwarning = opts.get(r'dry_run')
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark,
+ suppwarning=suppwarning)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -821,16 +823,19 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be 
changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True, 
**opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
-_origrebase(ui, repo, abort=True)
+opts = {'abort':True, 'dry_run':True}
+_origrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -891,7 +896,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf)
+retcode = rbsrt._prepareabortorcontinue(abortf, **opts)
 if retcode is not None:
 return retcode
 else:
@@ -1545,7 +1550,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None,
+  suppwarning=None):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1599,7 +1605,8 @@
   

D3671: advanceboundary: add dryrun parameter

2018-05-30 Thread khanchi97 (Sushil khanchi)
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


D3671: advanceboundary: add dryrun parameter

2018-05-31 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> khanchi97 wrote in phases.py:371
> I thought we would calculate `rejected` only when we are in dryrun mode.

okay its fine. I will remove this unnecessary condition. Because I think 
`rejected` value can also be used in `phase` method of `mercurial/commands.py` 
even when we are not in dryrun.

> phases.py:391
> +   affected)
> +changes[phase].update(faffected)
> +else:

I think I can add `continue` here and prevent `else` from next block.

> pulkit wrote in phases.py:392
> We can prevent this else by returning the values early.

But we are returning values after 'for loop' ends. As I am updating `changes` 
data in each iteration of loop.
I think we can add `continue` in `if dryrun:` condition and prevent `else`.

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


D3671: advanceboundary: add dryrun parameter

2018-05-31 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8940.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3671?vs=8928=8940

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,17 @@
 
 repo = repo.unfiltered()
 
+rejected = list() # set of rejected nodes
+changes = [set(), set(), set()]
+# `changes` stores revs (whose phases will be changed) in three
+# different sets where each set is for different phase and ordered
+# from --public to --secret.
+
+# Find nodes that are not in a compatible phase and will be rejected
+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,6 +388,12 @@
 olds = self.phaseroots[phase]
 
 affected = repo.revs('%ln::%ln', olds, nodes)
+if dryrun:
+faffected = filter(lambda x: getphase(repo,
+  repo[x].rev()) == phase,
+   affected)
+changes[phase].update(faffected)
+continue
 for r in affected:
 _trackphasechange(phasetracking, r, self.phase(repo, r),
   targetphase)
@@ -387,6 +404,8 @@
 self._updateroots(phase, roots, tr)
 # some roots may need to be declared for lower phases
 delroots.extend(olds - roots)
+if dryrun:
+return rejected, changes
 # declare deleted root in the target phase
 if targetphase != 0:
 self._retractboundary(repo, tr, targetphase, delroots)
@@ -478,16 +497,30 @@
 # (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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is true then it will not perform any action and only calculate
+`rejected` and `changes`, where:
+rejected - list of rejected nodes
+changes - list of three sets (each for different phase and ordered
+  from --public to --secret) where each set contains those
+  revisions whose phases are changed or can be changed (depends
+  of dryrun value) from their current phase to targetphase.
+
+Returns `rejected` and `changes`.
+"""
 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, pulkit
Cc: pulkit, 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

2018-05-30 Thread khanchi97 (Sushil khanchi)
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


D3672: retractboundary: add dryrun parameter

2018-05-30 Thread khanchi97 (Sushil khanchi)
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


D3187: phase: add dry-run functionality

2018-05-29 Thread khanchi97 (Sushil khanchi)
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


D2409: graft: add no-commit mode (issue5631)

2018-06-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8961.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=8958=8961

REVISION DETAIL
  https://phab.mercurial-scm.org/D2409

AFFECTED FILES
  mercurial/commands.py
  tests/test-completion.t
  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
@@ -1536,3 +1536,216 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: bar to b
   
+Test for --no-commit option:
+
+  $ cd ..
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAm0
+  $ echo b > b
+  $ hg ci -qAm1
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAm2
+  $ hg log
+  changeset:   2:db815d6d32e6
+  tag: tip
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: cannot specify --no-commit and --edit together
+  [255]
+
+  $ hg graft 1 --no-commit --log
+  abort: cannot specify --no-commit and --log together
+  [255]
+
+  $ hg graft 1 --no-commit -D
+  abort: cannot specify --no-commit and --currentdate together
+  [255]
+
+Test --no-commit is working:
+  $ hg graft 1 --no-commit
+  grafting 1:925d80f479bb "1"
+
+  $ hg log
+  changeset:   2:db815d6d32e6
+  tag: tip
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+  $ 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
+
+Prepare wrdir to check --no-commit is resepected after --continue:
+
+  $ echo A>a
+  $ hg ci -qm4
+  $ hg up -q 1
+  $ echo B>a
+  $ hg ci -qm5
+  $ hg log
+  changeset:   5:b1d5b5056844
+  tag: tip
+  parent:  1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 5
+  
+  changeset:   4:a08bb3910e7c
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 4
+  
+  changeset:   3:af773ba6509d
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 3
+  
+  changeset:   2:db815d6d32e6
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+  $ 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
+
+Test --no-commit is respected after --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
+
+Prepare wrdir to check --no-commit is resepected when passed with --continue:
+
+  $ 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
+
+Test --no-commit is respected with --continue:
+  $ 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 log
+  changeset:   5:b1d5b5056844
+  tag: tip
+  parent:  1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 5
+  
+  changeset:   4:a08bb3910e7c
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 4
+  
+  changeset:   3:af773ba6509d
+  user:test
+  date:

D3671: advanceboundary: add dryrun parameter

2018-06-03 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG36ba5dba372d: advanceboundary: add dryrun parameter 
(authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3671?vs=8950=8957#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3671?vs=8950=8957

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
@@ -354,10 +354,14 @@
 _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.
+
+If dryrun is True, no actions will be performed
+
+Returns a set of revs whose phase is changed or should be changed
 """
 # Be careful to preserve shallow-copied values: do not update
 # phaseroots values, replace them.
@@ -368,6 +372,7 @@
 
 repo = repo.unfiltered()
 
+changes = set() # set of revisions to be changed
 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
@@ -379,6 +384,9 @@
 olds = self.phaseroots[phase]
 
 affected = repo.revs('%ln::%ln', olds, nodes)
+changes.update(affected)
+if dryrun:
+continue
 for r in affected:
 _trackphasechange(phasetracking, r, self.phase(repo, r),
   targetphase)
@@ -389,10 +397,12 @@
 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()
+if not dryrun:
+# declare deleted root in the target phase
+if targetphase != 0:
+self._retractboundary(repo, tr, targetphase, delroots)
+repo.invalidatevolatilesets()
+return changes
 
 def retractboundary(self, repo, tr, targetphase, nodes):
 oldroots = self.phaseroots[:targetphase + 1]
@@ -480,16 +490,24 @@
 # (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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is True, no actions will be performed
+
+Returns a set of revs whose phase is changed or should be changed
+"""
 phcache = repo._phasecache.copy()
-phcache.advanceboundary(repo, tr, targetphase, nodes)
-repo._phasecache.replace(phcache)
+changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
+  dryrun=dryrun)
+if not dryrun:
+repo._phasecache.replace(phcache)
+return changes
 
 def retractboundary(repo, tr, targetphase, nodes):
 """Set nodes back to a phase changing other nodes phases if



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

2018-06-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8959.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3672?vs=8948=8959

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
@@ -404,32 +404,46 @@
 repo.invalidatevolatilesets()
 return changes
 
-def retractboundary(self, repo, tr, targetphase, nodes):
+def retractboundary(self, repo, tr, targetphase, nodes, dryrun=None):
+"""If dryrun is True, no actions will be performed
+
+Return a set of revs whose phase is changed or should be changed.
+"""
 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):
+changes = set() # set or revisions whose phase can be changed.
 
-# find the affected revisions
-new = self.phaseroots[targetphase]
-old = oldroots[targetphase]
-affected = set(repo.revs('(%ln::) - (%ln::)', new, old))
+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))
+changes.update(affected)
+if not dryrun:
+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
@@ -509,17 +523,25 @@
 repo._phasecache.replace(phcache)
 return changes
 
-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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is True, no actions will be performed
+
+Return a set of revs whose phase is changed or should be changed.
+"""
 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: pulkit, 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

2018-06-03 Thread khanchi97 (Sushil khanchi)
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')),
-],
+] + 

D2409: graft: add no-commit mode (issue5631)

2018-06-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8955.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=8953=8955

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
@@ -1536,3 +1536,106 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: bar to b
   
+Test for --no-commit option:
+
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAm0
+  $ echo b > b
+  $ hg ci -qAm1
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAm2
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: can't specify --no-commit and --edit
+  [255]
+
+Test --no-commit is working:
+  $ 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
+
+Prepare wrdir to 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
+
+Test --no-commit is respected after --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
+
+Prepare wrdir to check --no-commit is resepected when passed with --continue:
+
+  $ 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
+
+Test --no-commit is respected with --continue:
+  $ 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
@@ -2128,6 +2128,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')),
@@ -2164,7 +2166,7 @@
 .. note::
 
The -c/--continue option does not reapply earlier options, except
-   for --force, --user and --date.
+   for --force, --user, --date and --no-commit.
 
 .. container:: verbose
 
@@ -2218,6 +2220,14 @@
  **pycompat.strkwargs(opts))
 
 cont = False
+if opts.get('no_commit'):
+if opts.get('edit'):
+raise error.Abort(_("can't specify --no-commit and --edit"))
+if opts.get('currentuser'):
+raise error.Abort(_("can't specify --no-commit and --currentuser"))
+if opts.get('currentdate'):
+raise error.Abort(_("can't specify --no-commit and --currentdate"))
+
 graftstate = statemod.cmdstate(repo, 'graftstate')
 if opts.get('continue'):
 cont = True
@@ -2230,6 +2240,8 @@
 opts['date'] = statedata['date']
 if statedata.get('user'):
 opts['user'] = statedata['user']
+if statedata.get('no_commit'):
+opts['no_commit'] = statedata.get('no_commit')
 nodes = statedata['nodes']
 revs = [repo[node].rev() for node in nodes]
 else:
@@ -2316,6 +2328,8 @@
 if not revs:
 return -1
 
+if opts.get('no_commit'):
+statedata['no_commit'] = True
 for pos, ctx in enumerate(repo.set("%ld", revs)):
 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
ctx.description().split('\n', 1)[0])
@@ -2373,13 +2387,14 @@
 else:
 cont = False
 
-# commit
-node = 

D2409: graft: add no-commit mode (issue5631)

2018-06-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8958.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=8955=8958

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
@@ -1536,3 +1536,216 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: bar to b
   
+Test for --no-commit option:
+
+  $ cd ..
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAm0
+  $ echo b > b
+  $ hg ci -qAm1
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAm2
+  $ hg log
+  changeset:   2:db815d6d32e6
+  tag: tip
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: cannot specify --no-commit and --edit together
+  [255]
+
+  $ hg graft 1 --no-commit --log
+  abort: cannot specify --no-commit and --log together
+  [255]
+
+  $ hg graft 1 --no-commit -D
+  abort: cannot specify --no-commit and --currentdate together
+  [255]
+
+Test --no-commit is working:
+  $ hg graft 1 --no-commit
+  grafting 1:925d80f479bb "1"
+
+  $ hg log
+  changeset:   2:db815d6d32e6
+  tag: tip
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+  $ 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
+
+Prepare wrdir to check --no-commit is resepected after --continue:
+
+  $ echo A>a
+  $ hg ci -qm4
+  $ hg up -q 1
+  $ echo B>a
+  $ hg ci -qm5
+  $ hg log
+  changeset:   5:b1d5b5056844
+  tag: tip
+  parent:  1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 5
+  
+  changeset:   4:a08bb3910e7c
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 4
+  
+  changeset:   3:af773ba6509d
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 3
+  
+  changeset:   2:db815d6d32e6
+  parent:  0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 2
+  
+  changeset:   1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 1
+  
+  changeset:   0:f7b1eb17ad24
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 0
+  
+
+  $ 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
+
+Test --no-commit is respected after --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
+
+Prepare wrdir to check --no-commit is resepected when passed with --continue:
+
+  $ 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
+
+Test --no-commit is respected with --continue:
+  $ 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 log
+  changeset:   5:b1d5b5056844
+  tag: tip
+  parent:  1:925d80f479bb
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 5
+  
+  changeset:   4:a08bb3910e7c
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: 4
+  
+  changeset:   3:af773ba6509d
+  user:test
+  date:Thu Jan 01 00:00:00 

D3672: retractboundary: add dryrun parameter

2018-06-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8960.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3672?vs=8959=8960

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
@@ -404,32 +404,46 @@
 repo.invalidatevolatilesets()
 return changes
 
-def retractboundary(self, repo, tr, targetphase, nodes):
+def retractboundary(self, repo, tr, targetphase, nodes, dryrun=None):
+"""If dryrun is True, no actions will be performed
+
+Return a set of revs whose phase is changed or should be changed.
+"""
 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):
+changes = set() # set of revisions whose phase can be changed.
 
-# find the affected revisions
-new = self.phaseroots[targetphase]
-old = oldroots[targetphase]
-affected = set(repo.revs('(%ln::) - (%ln::)', new, old))
+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))
+changes.update(affected)
+if not dryrun:
+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
@@ -509,17 +523,25 @@
 repo._phasecache.replace(phcache)
 return changes
 
-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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is True, no actions will be performed
+
+Return a set of revs whose phase is changed or should be changed.
+"""
 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: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3678: graft: correct documentation about options can be reapplied

2018-06-04 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad50f0399e1e: graft: correct documentation about options 
can be reapplied (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3678?vs=8952=8964

REVISION DETAIL
  https://phab.mercurial-scm.org/D3678

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
@@ -2164,7 +2164,7 @@
 .. note::
 
The -c/--continue option does not reapply earlier options, except
-   for --force.
+   for --force, --user and --date.
 
 .. container:: verbose
 



To: khanchi97, #hg-reviewers, av6
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3678: graft: correct documentation about options can be reapplied

2018-06-04 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3678#57907, @yuja wrote:
  
  > Queued per review, thanks.
  >
  > >   The -c/--continue option does not reapply earlier options, except
  > > 
  > > - for --force. +   for --force, --user and --date.
  >
  > Does it mean --currentuser and --currentdate aren't saved in the state file?
  
  
  Yes, options that are saved in state file are --user and --date. And 
--no-commit is going to be added in this list.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3678

To: khanchi97, #hg-reviewers, av6
Cc: yuja, 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

2018-06-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8947.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3671?vs=8940=8947

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,7 @@
 
 repo = repo.unfiltered()
 
+changes = set() # set of revisions to be changed
 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,6 +378,9 @@
 olds = self.phaseroots[phase]
 
 affected = repo.revs('%ln::%ln', olds, nodes)
+if dryrun:
+changes.update(affected)
+continue
 for r in affected:
 _trackphasechange(phasetracking, r, self.phase(repo, r),
   targetphase)
@@ -387,10 +391,12 @@
 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()
+if not dryrun:
+# declare deleted root in the target phase
+if targetphase != 0:
+self._retractboundary(repo, tr, targetphase, delroots)
+repo.invalidatevolatilesets()
+return changes
 
 def retractboundary(self, repo, tr, targetphase, nodes):
 oldroots = self.phaseroots[:targetphase + 1]
@@ -478,16 +484,23 @@
 # (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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is true then it will not perform any action and only returns
+revisions whose phase could be changed.
+"""
 phcache = repo._phasecache.copy()
-phcache.advanceboundary(repo, tr, targetphase, nodes)
-repo._phasecache.replace(phcache)
+changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
+dryrun=dryrun)
+if not dryrun:
+repo._phasecache.replace(phcache)
+return changes
 
 def retractboundary(repo, tr, targetphase, nodes):
 """Set nodes back to a phase changing other nodes phases if



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

2018-06-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8948.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3672?vs=8929=8948

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,42 @@
 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 or revisions whose phase can be changed.
+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))
+changes.update(affected)
+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 +499,24 @@
 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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is true then it will not perform any action and only returns
+set of revision whose phase can be changed.
+"""
 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

2018-06-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8949.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3671?vs=8947=8949

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,10 +352,15 @@
 _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.
+
+If dryrun is true then it will not perform any action and only return
+set of revisions whose phase can be changed.
+
+Return set of csets whose phase is changed or can be changed.
 """
 # Be careful to preserve shallow-copied values: do not update
 # phaseroots values, replace them.
@@ -366,6 +371,7 @@
 
 repo = repo.unfiltered()
 
+changes = set() # set of revisions to be changed
 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,6 +383,9 @@
 olds = self.phaseroots[phase]
 
 affected = repo.revs('%ln::%ln', olds, nodes)
+changes.update(affected)
+if dryrun:
+continue
 for r in affected:
 _trackphasechange(phasetracking, r, self.phase(repo, r),
   targetphase)
@@ -387,10 +396,12 @@
 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()
+if not dryrun:
+# declare deleted root in the target phase
+if targetphase != 0:
+self._retractboundary(repo, tr, targetphase, delroots)
+repo.invalidatevolatilesets()
+return changes
 
 def retractboundary(self, repo, tr, targetphase, nodes):
 oldroots = self.phaseroots[:targetphase + 1]
@@ -478,16 +489,25 @@
 # (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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is true then it will not perform any action and only returns
+revisions whose phase can be changed.
+
+Return set of csets whose phase is changed or can be changed.
+"""
 phcache = repo._phasecache.copy()
-phcache.advanceboundary(repo, tr, targetphase, nodes)
-repo._phasecache.replace(phcache)
+changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
+dryrun=dryrun)
+if not dryrun:
+repo._phasecache.replace(phcache)
+return changes
 
 def retractboundary(repo, tr, targetphase, nodes):
 """Set nodes back to a phase changing other nodes phases if



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


D3671: advanceboundary: add dryrun parameter

2018-06-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8950.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3671?vs=8949=8950

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,10 +352,14 @@
 _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.
+
+If dryrun is True, no actions will be performed
+
+Returns a set of revs whose phase is changed or should be changed
 """
 # Be careful to preserve shallow-copied values: do not update
 # phaseroots values, replace them.
@@ -366,6 +370,7 @@
 
 repo = repo.unfiltered()
 
+changes = set() # set of revisions to be changed
 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,6 +382,9 @@
 olds = self.phaseroots[phase]
 
 affected = repo.revs('%ln::%ln', olds, nodes)
+changes.update(affected)
+if dryrun:
+continue
 for r in affected:
 _trackphasechange(phasetracking, r, self.phase(repo, r),
   targetphase)
@@ -387,10 +395,12 @@
 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()
+if not dryrun:
+# declare deleted root in the target phase
+if targetphase != 0:
+self._retractboundary(repo, tr, targetphase, delroots)
+repo.invalidatevolatilesets()
+return changes
 
 def retractboundary(self, repo, tr, targetphase, nodes):
 oldroots = self.phaseroots[:targetphase + 1]
@@ -478,16 +488,24 @@
 # (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."""
+Simplify boundary to contains phase roots only.
+
+If dryrun is True, no actions will be performed
+
+Returns a set of revs whose phase is changed or should be changed
+"""
 phcache = repo._phasecache.copy()
-phcache.advanceboundary(repo, tr, targetphase, nodes)
-repo._phasecache.replace(phcache)
+changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
+dryrun=dryrun)
+if not dryrun:
+repo._phasecache.replace(phcache)
+return changes
 
 def retractboundary(repo, tr, targetphase, nodes):
 """Set nodes back to a phase changing other nodes phases if



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

2018-06-01 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> pulkit wrote in phases.py:395
> Add documentation about dry-run and the return value.

okay

> pulkit wrote in phases.py:417
> Why are we not using this affected set here to find the changesets whose 
> phase is changed?

Because I think this affected set is calculated after performing actions, when 
phases are changed. And calculating affected using new phaseroots. Am I missing 
something here?

> pulkit wrote in phases.py:430
> (Not sure which line I should put this comment on)
> 
> Just like https://phab.mercurial-scm.org/D3671, here also, the function 
> should return the correct set of changes whose phase have been changed 
> irrespective of the dryrun value passed.

yeah, I got it.

> pulkit wrote in phases.py:511
> This should better be:
> 
> `If dryrun is True, no actions will be performed
> 
> returns a set of revs whose phase is changed or should be changed`

okay, will do this for 'advanceboundry' too

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3672

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)

2018-06-02 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D2409#57814, @pulkit wrote:
  
  > In https://phab.mercurial-scm.org/D2409#56200, @khanchi97 wrote:
  >
  > > @pulkit do we have new state format pushed in?
  >
  >
  > Yep, you can go ahead and rebase this patch to make it use the new 
statefile format.
  
  
  I have updated the patch and now it is using the new statefile format.

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)

2018-06-02 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 8953.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=6538=8953

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
@@ -1536,3 +1536,106 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: bar to b
   
+Test for --no-commit option:
+
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAm0
+  $ echo b > b
+  $ hg ci -qAm1
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAm2
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: can't specify --no-commit and --edit
+  [255]
+
+Test --no-commit is working:
+  $ 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
+
+Prepare wrdir to 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
+
+Test --no-commit is respected after --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
+
+Prepare wrdir to check --no-commit is resepected when passed with --continue:
+
+  $ 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
+
+Test --no-commit is respected with --continue:
+  $ 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
@@ -2128,6 +2128,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')),
@@ -2164,7 +2166,7 @@
 .. note::
 
The -c/--continue option does not reapply earlier options, except
-   for --force, --user and --date.
+   for --force, --user, --date and --no-commit.
 
 .. container:: verbose
 
@@ -2218,6 +2220,14 @@
  **pycompat.strkwargs(opts))
 
 cont = False
+if opts.get('no_commit'):
+if opts.get('edit'):
+raise error.Abort(_("can't specify --no-commit and --edit"))
+if opts.get('currentuser'):
+raise error.Abort(_("can't specify --no-commit and --currentuser"))
+if opts.get('currentdate'):
+raise error.Abort(_("can't specify --no-commit and --currentdate"))
+
 graftstate = statemod.cmdstate(repo, 'graftstate')
 if opts.get('continue'):
 cont = True
@@ -2232,6 +2242,10 @@
 opts['user'] = statedata['user']
 nodes = statedata['nodes']
 revs = [repo[node].rev() for node in nodes]
+if opts.get('no_commit'):
+statedata['no_commit'] = True
+stateversion = 1
+graftstate.save(stateversion, statedata)
 else:
 cmdutil.wrongtooltocontinue(repo, _('graft'))
 else:
@@ -2361,6 +2375,11 @@
 # write out state for --continue
 nodes = [repo[rev].hex() for rev in revs[pos:]]
 statedata['nodes'] = nodes
+if pos == 0:
+if opts.get('no_commit'):
+statedata['no_commit'] = True
+else:
+

D3678: graft: correct documentation about options can be reapplied

2018-06-02 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now options --user and --date can be reapplied after we hit a conflict.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3678

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
@@ -2164,7 +2164,7 @@
 .. note::
 
The -c/--continue option does not reapply earlier options, except
-   for --force.
+   for --force, --user and --date.
 
 .. container:: verbose
 



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


D3764: rebase: improve output of --dry-run

2018-07-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9385.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9360=9385

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,10 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -240,10 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -276,6 +278,7 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
@@ -311,6 +314,7 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -838,6 +838,7 @@
 
 def _dryrunrebase(ui, repo, opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
+ui.status(_('starting dry-run rebase; repository will not be changed\n'))
 with repo.wlock(), repo.lock():
 try:
 overrides = {('rebase', 'singletransaction'): True}
@@ -848,7 +849,8 @@
 ui.status(_('hit a merge conflict\n'))
 return 1
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 return 0
 finally:
 # no need to store backup in case of dryrun



To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3870: rebase: add --confirm option

2018-07-01 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This feature adds a functionality in rebase to confirm before applying
  changes. And also give useful information about result of rebase i.e will
  be successful or hit a merge conflict.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3870

AFFECTED FILES
  hgext/rebase.py
  mercurial/cmdutil.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -4,6 +4,7 @@
   > amend=
   > rebase=
   > debugdrawdag=$TESTDIR/drawdag.py
+  > strip=
   > [rebase]
   > experimental.inmemory=1
   > [diff]
@@ -156,8 +157,8 @@
   o  0: b173517d0057 'a'
   
 Test dry-run rebasing
-  $ hg init skrepo
-  $ cd skrepo
+  $ hg init repo3
+  $ cd repo3
   $ echo a>a
   $ hg ci -Aqma
   $ echo b>b
@@ -321,3 +322,237 @@
   merging e
   hit a merge conflict
   [1]
+
+==
+Test for --confirm option|
+==
+  $ cd ..
+  $ hg clone repo3 repo4 -q
+  $ cd repo4
+  $ hg strip 7 -q
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
+  > n
+  > EOF
+  starting rebase...
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  rebase completed successfully
+  apply changes (yn)? n
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
+  > y
+  > EOF
+  starting rebase...
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  rebase completed successfully
+  apply changes (yn)? y
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  o  9:9fd28f55f6dc test
+  |  e
+  |
+  o  8:12cbf031f469 test
+  |  d
+  |
+  o  7:c83b1da5b1ae test
+  |  c
+  |
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Test --confirm option when there is a conflict
+  $ hg up tip -q
+  $ echo ee>e
+  $ hg ci --amend -m "conflict with e" -q
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  9:906d72f66a59 test
+  |  conflict with e
+  |
+  o  8:12cbf031f469 test
+  |  d
+  |
+  o  7:c83b1da5b1ae test
+  |  c
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 4 -d . --keep --config ui.interactive=True --confirm << EOF
+  > n
+  > EOF
+  starting rebase...
+  rebasing 4:e860deea161a "e"
+  merging e
+  hit a merge conflict
+  apply changes (yn)? n
+  [1]
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  9:906d72f66a59 test
+  |  conflict with e
+  |
+  o  8:12cbf031f469 test
+  |  d
+  |
+  o  7:c83b1da5b1ae test
+  |  c
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+
+  $ hg rebase -s 4 -d . --keep --config ui.interactive=True --confirm << EOF
+  > y
+  > EOF
+  starting rebase...
+  rebasing 4:e860deea161a "e"
+  merging e
+  hit a merge conflict
+  apply changes (yn)? y
+  rebasing 4:e860deea161a "e"
+  merging e
+  warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ echo e>e
+  $ hg resolve --mark --all
+  (no more unresolved files)
+  continue: hg rebase --continue

D3871: rebase: improve output of --confirm option

2018-07-01 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch --cofirm option was thorwing the same rebasing
  information two times, one before confirmation and one after. Also
  added tests to reflect the same behavior.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3871

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -392,9 +392,6 @@
   rebasing 4:e860deea161a "e"
   rebase completed successfully
   apply changes (yn)? y
-  rebasing 2:177f92b77385 "c"
-  rebasing 3:055a42cdd887 "d"
-  rebasing 4:e860deea161a "e"
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
   o  9:9fd28f55f6dc test
   |  e
@@ -510,7 +507,6 @@
   merging e
   hit a merge conflict
   apply changes (yn)? y
-  rebasing 4:e860deea161a "e"
   merging e
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -400,7 +400,7 @@
 self.repo.ui.debug("rebasing on disk\n")
 self.repo.ui.log("rebase", "", rebase_imm_used=self.inmemory)
 
-def _performrebase(self, tr):
+def _performrebase(self, tr, supprbinfo=False):
 self._assignworkingcopy()
 repo, ui = self.repo, self.ui
 if self.keepbranchesf:
@@ -449,7 +449,8 @@
 self.obsoletewithoutsuccessorindestination,
 )
 for rev in sortedrevs:
-self._rebasenode(tr, rev, allowdivergence, progress)
+self._rebasenode(tr, rev, allowdivergence, progress,
+ supprbinfo=supprbinfo)
 p.complete()
 ui.note(_('rebase merging completed\n'))
 
@@ -498,7 +499,8 @@
 mergemod.mergestate.clean(repo)
 return newnode
 
-def _rebasenode(self, tr, rev, allowdivergence, progressfn):
+def _rebasenode(self, tr, rev, allowdivergence, progressfn,
+supprbinfo=False):
 repo, ui, opts = self.repo, self.ui, self.opts
 dest = self.destmap[rev]
 ctx = repo[rev]
@@ -529,7 +531,8 @@
   self.skipped))
 self.state[rev] = dest
 elif self.state[rev] == revtodo:
-ui.status(_('rebasing %s\n') % desc)
+if not supprbinfo:
+ui.status(_('rebasing %s\n') % desc)
 progressfn(ctx)
 p1, p2, base = defineparents(repo, rev, self.destmap,
  self.state, self.skipped,
@@ -874,15 +877,17 @@
 if not conflict:
 inmemory = ui.configbool('rebase',
  'experimental.inmemory')
-return _dorebase(ui, repo, opts, inmemory=inmemory)
-return _dorebase(ui, repo, opts)
-
-def _dorebase(ui, repo, opts, inmemory=False):
+return _dorebase(ui, repo, opts, inmemory=inmemory,
+ supprbinfo=True)
+return _dorebase(ui, repo, opts, supprbinfo=True)
+
+def _dorebase(ui, repo, opts, inmemory=False, supprbinfo=False):
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-return _origrebase(ui, repo, opts, rbsrt, inmemory=inmemory)
+return _origrebase(ui, repo, opts, rbsrt, inmemory=inmemory,
+   supprbinfo=supprbinfo)
 
 def _origrebase(ui, repo, opts, rbsrt, inmemory=False, leaveunfinished=False,
-supptrwarns=False):
+supptrwarns=False, supprbinfo=False):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)
@@ -951,7 +956,7 @@
 if singletr and not inmemory:
 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
 with util.acceptintervention(dsguard):
-rbsrt._performrebase(tr)
+rbsrt._performrebase(tr, supprbinfo=supprbinfo)
 if not leaveunfinished:
 rbsrt._finishrebase()
 



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


D3830: rebase: suppress transaction warns during dry-run

2018-07-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9384.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3830?vs=9359=9384

REVISION DETAIL
  https://phab.mercurial-scm.org/D3830

AFFECTED FILES
  hgext/rebase.py
  mercurial/localrepo.py
  mercurial/transaction.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -280,8 +280,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
-  transaction abort!
-  rollback completed
   hit a merge conflict
   [1]
   $ hg diff
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
 def __init__(self, report, opener, vfsmap, journalname, undoname=None,
  after=None, createmode=None, validator=None, releasefn=None,
- checkambigfiles=None, name=r''):
+ checkambigfiles=None, name=r'', suppwarns=False):
 """Begin a new transaction
 
 Begins a new transaction that allows rolling back writes in the event 
of
@@ -133,6 +133,7 @@
 self.map = {}
 self.journal = journalname
 self.undoname = undoname
+self.suppwarns = suppwarns
 self._queue = []
 # A callback to validate transaction content before closing it.
 # should raise exception is anything is wrong.
@@ -570,7 +571,8 @@
 self.opener.unlink(self.journal)
 return
 
-self.report(_("transaction abort!\n"))
+if not self.suppwarns:
+self.report(_("transaction abort!\n"))
 
 try:
 for cat in sorted(self._abortcallback):
@@ -580,7 +582,8 @@
 _playback(self.journal, self.report, self.opener, self._vfsmap,
   self.entries, self._backupentries, False,
   checkambigfiles=self.checkambigfiles)
-self.report(_("rollback completed\n"))
+if not self.suppwarns:
+self.report(_("rollback completed\n"))
 except BaseException:
 self.report(_("rollback failed - please run hg recover\n"))
 finally:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,7 +1224,7 @@
 return tr
 return None
 
-def transaction(self, desc, report=None):
+def transaction(self, desc, report=None, supptrwarns=False):
 if (self.ui.configbool('devel', 'all-warnings')
 or self.ui.configbool('devel', 'check-locks')):
 if self._currentlock(self._lockref) is None:
@@ -1371,7 +1371,8 @@
  validator=validate,
  releasefn=releasefn,
  checkambigfiles=_cachedfiles,
- name=desc)
+ name=desc,
+ suppwarns=supptrwarns)
 tr.changes['revs'] = xrange(0, 0)
 tr.changes['obsmarkers'] = set()
 tr.changes['phases'] = {}
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -843,7 +843,7 @@
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, opts, rbsrt, inmemory=True,
-leaveunfinished=True)
+leaveunfinished=True, supptrwarns=True)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
@@ -859,7 +859,8 @@
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 return _origrebase(ui, repo, opts, rbsrt, inmemory=inmemory)
 
-def _origrebase(ui, repo, opts, rbsrt, inmemory=False, leaveunfinished=False):
+def _origrebase(ui, repo, opts, rbsrt, inmemory=False, leaveunfinished=False,
+supptrwarns=False):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)
@@ -916,7 +917,7 @@
 
 singletr = ui.configbool('rebase', 'singletransaction')
 if singletr:
-tr = repo.transaction('rebase')
+tr = repo.transaction('rebase', supptrwarns=supptrwarns)
 
 # If `rebase.singletransaction` is enabled, wrap the entire operation 
in
 # one transaction here. Otherwise, transactions are obtained when



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


D3854: rebase: add lock to cover whole dryrun process

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9354.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3854?vs=9342=9354

REVISION DETAIL
  https://phab.mercurial-scm.org/D3854

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,22 +818,20 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-leaveunfinished = True
-inmemory = True
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=leaveunfinished, **opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-with repo.wlock(), repo.lock():
+rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
+with repo.wlock(), repo.lock():
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=True, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
 rbsrt._prepareabortorcontinue(isabort=True)
 elif inmemory:
 try:



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


D3855: rebase: extract dryrun as a function

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3855#60250, @yuja wrote:
  
  > >   rbsrt = rebaseruntime(repo, ui, inmemory, opts)
  > >   with repo.wlock(), repo.lock():
  > >   try:
  > > 
  > > - overrides = {('rebase', 'singletransaction'): True}
  > > - with ui.configoverride(overrides, 'rebase'):
  > > - _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
  > > - leaveunfinished=True, **opts) +_dryrunrebase(ui, repo, 
rbsrt, **opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a 
merge conflict\n')) return 1
  >
  > Oops, I meant the whole dryrun process could be extracted to a function
  >  because it's getting bigger.
  >
  >   if dryrun:
  >   return _dryrunrebase(...)
  >   else:
  >   ...
  >
  >
  > But feel free to ignore my suggestion if there's a reason to not move
  >  everything.
  
  
  Aha, I thought you were pointing out to only "try:" block for more no. of 
indented blocks. I will update this.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3855

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


D3827: rebase: no need to store backup in case of dryrun

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9357.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3827?vs=9345=9357

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, backup=True):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,8 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, backup=backup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -849,7 +849,8 @@
 ui.status(_('there will be no conflict, you can rebase\n'))
 return 0
 finally:
-rbsrt._prepareabortorcontinue(isabort=True)
+# no need to store backup in case of dryrun
+rbsrt._prepareabortorcontinue(isabort=True, backup=False)
 
 def _dorebase(ui, repo, inmemory=False, **opts):
 opts = pycompat.byteskwargs(opts)
@@ -1552,7 +1553,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1597,7 +1598,7 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=backup)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3764: rebase: improve output of --dry-run

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9360.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9348=9360

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,10 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -240,10 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -276,6 +278,7 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
@@ -311,6 +314,7 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -837,6 +837,7 @@
 
 def _dryrunrebase(ui, repo, **opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
+ui.status(_('starting dry-run rebase; repository will not be changed\n'))
 with repo.wlock(), repo.lock():
 try:
 overrides = {('rebase', 'singletransaction'): True}
@@ -847,7 +848,8 @@
 ui.status(_('hit a merge conflict\n'))
 return 1
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without'
+' -n/--dry-run to perform this rebase\n'))
 return 0
 finally:
 # no need to store backup in case of dryrun



To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3857: rebase: suppress warning thrown when aborting rebase in case of dryrun

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9358.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3857?vs=9346=9358

REVISION DETAIL
  https://phab.mercurial-scm.org/D3857

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
   $ hg diff
   $ hg status
@@ -245,7 +244,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -285,7 +283,6 @@
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   [1]
   $ hg diff
   $ hg status
@@ -321,5 +318,4 @@
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
   [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort, backup=True):
+def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@
 raise error.Abort(msg, hint=hint)
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, backup=backup)
+ activebookmark=self.activebookmark, backup=backup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -850,7 +851,8 @@
 return 0
 finally:
 # no need to store backup in case of dryrun
-rbsrt._prepareabortorcontinue(isabort=True, backup=False)
+rbsrt._prepareabortorcontinue(isabort=True, backup=False,
+  suppwarns=True)
 
 def _dorebase(ui, repo, inmemory=False, **opts):
 opts = pycompat.byteskwargs(opts)
@@ -1553,7 +1555,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1606,7 +1609,8 @@
 finally:
 clearstatus(repo)
 clearcollapsemsg(repo)
-repo.ui.warn(_('rebase aborted\n'))
+if not suppwarns:
+repo.ui.warn(_('rebase aborted\n'))
 return 0
 
 def sortsource(destmap):



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


D3830: rebase: suppress transaction warns during dry-run

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9359.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3830?vs=9347=9359

REVISION DETAIL
  https://phab.mercurial-scm.org/D3830

AFFECTED FILES
  hgext/rebase.py
  mercurial/localrepo.py
  mercurial/transaction.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -280,8 +280,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
-  transaction abort!
-  rollback completed
   hit a merge conflict
   [1]
   $ hg diff
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
 def __init__(self, report, opener, vfsmap, journalname, undoname=None,
  after=None, createmode=None, validator=None, releasefn=None,
- checkambigfiles=None, name=r''):
+ checkambigfiles=None, name=r'', suppwarns=False):
 """Begin a new transaction
 
 Begins a new transaction that allows rolling back writes in the event 
of
@@ -133,6 +133,7 @@
 self.map = {}
 self.journal = journalname
 self.undoname = undoname
+self.suppwarns = suppwarns
 self._queue = []
 # A callback to validate transaction content before closing it.
 # should raise exception is anything is wrong.
@@ -570,7 +571,8 @@
 self.opener.unlink(self.journal)
 return
 
-self.report(_("transaction abort!\n"))
+if not self.suppwarns:
+self.report(_("transaction abort!\n"))
 
 try:
 for cat in sorted(self._abortcallback):
@@ -580,7 +582,8 @@
 _playback(self.journal, self.report, self.opener, self._vfsmap,
   self.entries, self._backupentries, False,
   checkambigfiles=self.checkambigfiles)
-self.report(_("rollback completed\n"))
+if not self.suppwarns:
+self.report(_("rollback completed\n"))
 except BaseException:
 self.report(_("rollback failed - please run hg recover\n"))
 finally:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,7 +1224,7 @@
 return tr
 return None
 
-def transaction(self, desc, report=None):
+def transaction(self, desc, report=None, supptrwarns=False):
 if (self.ui.configbool('devel', 'all-warnings')
 or self.ui.configbool('devel', 'check-locks')):
 if self._currentlock(self._lockref) is None:
@@ -1371,7 +1371,8 @@
  validator=validate,
  releasefn=releasefn,
  checkambigfiles=_cachedfiles,
- name=desc)
+ name=desc,
+ suppwarns=supptrwarns)
 tr.changes['revs'] = xrange(0, 0)
 tr.changes['obsmarkers'] = set()
 tr.changes['phases'] = {}
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -842,7 +842,7 @@
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, rbsrt, inmemory=True,
-leaveunfinished=True, **opts)
+leaveunfinished=True, supptrwarns=True, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
@@ -859,7 +859,8 @@
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
 
-def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, 
**opts):
+def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False,
+supptrwarns=False, **opts):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)
@@ -916,7 +917,7 @@
 
 singletr = ui.configbool('rebase', 'singletransaction')
 if singletr:
-tr = repo.transaction('rebase')
+tr = repo.transaction('rebase', supptrwarns=supptrwarns)
 
 # If `rebase.singletransaction` is enabled, wrap the entire operation 
in
 # one transaction here. Otherwise, transactions are obtained when



To: khanchi97, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

D3856: rebase: split _origrebase() for conveniece in dryrun

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9356.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3856?vs=9344=9356

REVISION DETAIL
  https://phab.mercurial-scm.org/D3856

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -825,22 +825,22 @@
 # and re-run as an on-disk merge.
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-return _origrebase(ui, repo, inmemory=inmemory, **opts)
+return _dorebase(ui, repo, inmemory=inmemory, **opts)
 except error.InMemoryMergeConflictsError:
 ui.warn(_('hit merge conflicts; re-running rebase without 
in-memory'
   ' merge\n'))
-_origrebase(ui, repo, abort=True)
-return _origrebase(ui, repo, inmemory=False, **opts)
+_dorebase(ui, repo, abort=True)
+return _dorebase(ui, repo, inmemory=False, **opts)
 else:
-return _origrebase(ui, repo, **opts)
+return _dorebase(ui, repo, **opts)
 
 def _dryrunrebase(ui, repo, **opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
 with repo.wlock(), repo.lock():
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+_origrebase(ui, repo, rbsrt, inmemory=True,
 leaveunfinished=True, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
@@ -851,12 +851,12 @@
 finally:
 rbsrt._prepareabortorcontinue(isabort=True)
 
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
-**opts):
+def _dorebase(ui, repo, inmemory=False, **opts):
 opts = pycompat.byteskwargs(opts)
-if not rbsrt:
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
+
+def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, 
**opts):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)



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


D3855: rebase: extract dryrun as a function

2018-06-29 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9355.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3855?vs=9343=9355

REVISION DETAIL
  https://phab.mercurial-scm.org/D3855

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,21 +818,7 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
-with repo.wlock(), repo.lock():
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=True, **opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-rbsrt._prepareabortorcontinue(isabort=True)
+return _dryrunrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -848,6 +834,23 @@
 else:
 return _origrebase(ui, repo, **opts)
 
+def _dryrunrebase(ui, repo, **opts):
+rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
+with repo.wlock(), repo.lock():
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=True, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
+rbsrt._prepareabortorcontinue(isabort=True)
+
 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
 **opts):
 opts = pycompat.byteskwargs(opts)



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


D3827: rebase: no need to store backup in case of dryrun

2018-06-29 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc892a30bafb9: rebase: no need to store backup in case of 
dryrun (authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3827?vs=9357=9372#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3827?vs=9357=9372

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, backup=True):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,8 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, backup=backup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -850,7 +850,8 @@
 ui.status(_('there will be no conflict, you can rebase\n'))
 return 0
 finally:
-rbsrt._prepareabortorcontinue(isabort=True)
+# no need to store backup in case of dryrun
+rbsrt._prepareabortorcontinue(isabort=True, backup=False)
 
 def _dorebase(ui, repo, inmemory=False, **opts):
 rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
@@ -1553,7 +1554,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1598,7 +1599,7 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=backup)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3854: rebase: add lock to cover whole dryrun process

2018-06-29 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGba6d2c32f34a: rebase: add lock to cover whole dryrun 
process (authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3854?vs=9354=9369#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3854?vs=9354=9369

REVISION DETAIL
  https://phab.mercurial-scm.org/D3854

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,22 +818,21 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-leaveunfinished = True
-inmemory = True
-rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=leaveunfinished, **opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-with repo.wlock(), repo.lock():
+rbsrt = rebaseruntime(repo, ui, inmemory=True,
+  opts=pycompat.byteskwargs(opts))
+with repo.wlock(), repo.lock():
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=True, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
 rbsrt._prepareabortorcontinue(isabort=True)
 elif inmemory:
 try:



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


D3855: rebase: extract dryrun as a function

2018-06-29 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc92fdc27cbdd: rebase: extract dryrun as a function 
(authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3855?vs=9355=9370#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3855?vs=9355=9370

REVISION DETAIL
  https://phab.mercurial-scm.org/D3855

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,22 +818,7 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-rbsrt = rebaseruntime(repo, ui, inmemory=True,
-  opts=pycompat.byteskwargs(opts))
-with repo.wlock(), repo.lock():
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=True, **opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-rbsrt._prepareabortorcontinue(isabort=True)
+return _dryrunrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -849,6 +834,24 @@
 else:
 return _origrebase(ui, repo, **opts)
 
+def _dryrunrebase(ui, repo, **opts):
+rbsrt = rebaseruntime(repo, ui, inmemory=True,
+  opts=pycompat.byteskwargs(opts))
+with repo.wlock(), repo.lock():
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=True, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
+rbsrt._prepareabortorcontinue(isabort=True)
+
 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
 **opts):
 opts = pycompat.byteskwargs(opts)



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


D3857: rebase: suppress warning thrown when aborting rebase in case of dryrun

2018-06-29 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG999e5c218daf: rebase: suppress warning thrown when aborting 
rebase in case of dryrun (authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3857?vs=9358=9373#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3857?vs=9358=9373

REVISION DETAIL
  https://phab.mercurial-scm.org/D3857

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
   $ hg diff
   $ hg status
@@ -245,7 +244,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -285,7 +283,6 @@
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   [1]
   $ hg diff
   $ hg status
@@ -321,5 +318,4 @@
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
   [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort, backup=True):
+def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@
 raise error.Abort(msg, hint=hint)
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, backup=backup)
+ activebookmark=self.activebookmark, backup=backup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -851,7 +852,8 @@
 return 0
 finally:
 # no need to store backup in case of dryrun
-rbsrt._prepareabortorcontinue(isabort=True, backup=False)
+rbsrt._prepareabortorcontinue(isabort=True, backup=False,
+  suppwarns=True)
 
 def _dorebase(ui, repo, inmemory=False, **opts):
 rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
@@ -1554,7 +1556,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1607,7 +1610,8 @@
 finally:
 clearstatus(repo)
 clearcollapsemsg(repo)
-repo.ui.warn(_('rebase aborted\n'))
+if not suppwarns:
+repo.ui.warn(_('rebase aborted\n'))
 return 0
 
 def sortsource(destmap):



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


D3827: rebase: no need to store backup during dry-run while aborting

2018-06-25 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3827#59873, @yuja wrote:
  
  > > - retcode = rbsrt._prepareabortorcontinue(abortf) +# If 
in-memory, means aborting during dry-run, no need to backup +backup 
= not rbsrt.inmemory +retcode = 
rbsrt._prepareabortorcontinue(abortf, backup=backup)
  >
  > This seems confusing and is probably wrong since we wouldn't overwrite
  >  `inmemory` to `False` if in-memory rebase were resumable.
  >
  > I think explicit `backup` flag is less bad.
  
  
  @yuja Can I pass a indicator type flag to _origrebase() just to indicate that 
we are in dryrun and then I can use that flag to set values for `backup` and 
`suppwarns` (suppress warning when aborting rebase). I think it would be better 
than explicitly passing flags for each case. What do you say?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

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


D2409: graft: add no-commit mode (issue5631)

2018-06-26 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG622f79e3a1cb: graft: add no-commit mode (issue5631) 
(authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D2409?vs=9301=9311#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=9301=9311

REVISION DETAIL
  https://phab.mercurial-scm.org/D2409

AFFECTED FILES
  mercurial/commands.py
  tests/test-completion.t
  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
@@ -1885,3 +1885,246 @@
   new changesets detected on destination branch, can't strip
   graft aborted
   working directory is now at 6b98ff0062dd
+
+  $ cd ..
+
+
+Testing --no-commit option:|
+
+
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAma
+  $ echo b > b
+  $ hg ci -qAmb
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAmc
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  2:d36c0562f908 c
+  |
+  | o  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: cannot specify --no-commit and --edit together
+  [255]
+
+  $ hg graft 1 --no-commit --log
+  abort: cannot specify --no-commit and --log together
+  [255]
+
+  $ hg graft 1 --no-commit -D
+  abort: cannot specify --no-commit and --currentdate together
+  [255]
+
+Test --no-commit is working:
+  $ hg graft 1 --no-commit
+  grafting 1:d2ae7f538514 "b"
+
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  2:d36c0562f908 c
+  |
+  | o  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+  $ hg diff
+  diff -r d36c0562f908 b
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/b  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +b
+
+Prepare wrdir to check --no-commit is resepected after --continue:
+
+  $ hg up -qC
+  $ echo A>a
+  $ hg ci -qm "A in file a"
+  $ hg up -q 1
+  $ echo B>a
+  $ hg ci -qm "B in file a"
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+  $ hg graft 3 --no-commit
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+Resolve conflict:
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+  $ hg diff
+  diff -r 2aa9ad1006ff 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 up -qC
+
+Check --no-commit is resepected when passed with --continue:
+
+  $ hg graft 3
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+Resolve conflict:
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue --no-commit
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg diff
+  diff -r 2aa9ad1006ff 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 log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+  $ hg up -qC
+
+Test --no-commit when graft multiple revisions:
+When there is conflict:
+  $ hg graft -r "2::3" --no-commit
+  grafting 2:d36c0562f908 "c"
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+  $ hg graft --continue
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg diff
+  diff -r 2aa9ad1006ff 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
+  diff -r 2aa9ad1006ff c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+
+  $ hg log -GT 

D3849: rebase: refactor dryrun implementation

2018-06-27 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9324.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3849?vs=9321=9324

REVISION DETAIL
  https://phab.mercurial-scm.org/D3849

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,19 +818,23 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+leaveunfinished = True
+inmemory = True
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, leaveunfinished=True,
-**opts)
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=leaveunfinished, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
 return 0
 finally:
-_origrebase(ui, repo, abort=True)
+with repo.wlock(), repo.lock():
+rbsrt._prepareabortorcontinue(isabort=True)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -846,9 +850,11 @@
 else:
 return _origrebase(ui, repo, **opts)
 
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
+def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
+**opts):
 opts = pycompat.byteskwargs(opts)
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+if not rbsrt:
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points



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


D3827: rebase: no need to store backup during dry-run while aborting

2018-06-25 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3827#59878, @yuja wrote:
  
  > >   > > - retcode = rbsrt._prepareabortorcontinue(abortf) +# If 
in-memory, means aborting during dry-run, no need to backup +backup 
= not rbsrt.inmemory +retcode = 
rbsrt._prepareabortorcontinue(abortf, backup=backup)
  > >   >
  > >   > This seems confusing and is probably wrong since we wouldn't overwrite
  > >   >  `inmemory` to `False` if in-memory rebase were resumable.
  > >   >
  > >   > I think explicit `backup` flag is less bad.
  > >   
  > >   
  > >   @yuja Can I pass a indicator type flag to _origrebase() just to 
indicate that we are in dryrun and then I can use that flag to set values for 
`backup` and `suppwarns` (suppress warning when aborting rebase). I think it 
would be better than explicitly passing flags for each case. What do you say?
  >
  > Sounds good.
  >
  > A cleaner (but not simple) approach would be to stop calling `_origrebase()`
  >  twice, and instead refactor `_origrebase()` and/or `rebaseruntime` to 
support
  >  dry-run operation.
  
  
  Sounds interesting. Let me try this.
  Thanks for review :)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

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


D3829: rebase: make dry-run return 1 or 0 according to result

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In dry-run mode, if there is no conflict return 0, if any then return 1

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3829

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -287,6 +287,7 @@
   rollback completed
   hit a merge conflict
   rebase aborted
+  [1]
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -322,3 +323,4 @@
   merging e
   hit a merge conflict
   rebase aborted
+  [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -825,10 +825,13 @@
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
+retcode = 1
 else:
+retcode = 0
 ui.status(_('there will be no conflict, you can rebase\n'))
 finally:
 _origrebase(ui, repo, abort=True)
+return retcode
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort



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


D3764: rebase: no need to store backup during dry-run while aborting

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3764#59797, @pulkit wrote:
  
  > @khanchi97 you should have created a new differential so that we don't 
loose your earlier patch titled: 'rebase: improve output of --dry-run' which is 
yet under review.
  
  
  Oh sorry, it was by mistake.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3764: rebase: improve output of --dry-run

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9259.
khanchi97 retitled this revision from "rebase: no need to store backup during 
dry-run while aborting" to "rebase: improve output of --dry-run".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9258=9259

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,12 +208,12 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
   saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
-  rebase aborted
 
   $ hg diff
   $ hg status
@@ -242,11 +242,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -279,14 +279,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -316,9 +316,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, **opts):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,10 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+suppwarning = opts.get(r'dry_run')
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark,
+ suppwarning=suppwarning)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -818,17 +820,20 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be 
changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
-_origrebase(ui, repo, abort=True)
+opts = {'abort':True, 'dry_run':True}
+_origrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -889,7 +894,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf)
+retcode = rbsrt._prepareabortorcontinue(abortf, **opts)
 if retcode is not None:
 return retcode
 else:
@@ -1543,7 +1548,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, 

D3827: rebase: no need to store backup during dry-run while aborting

2018-06-23 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9262.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3827?vs=9260=9262

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, opts={}):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,9 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+nobackup = opts.get(r'no_backup')
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, nobackup=nobackup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -828,7 +829,8 @@
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
 finally:
-_origrebase(ui, repo, abort=True)
+opts = {'abort':True, 'no_backup':True}
+_origrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -889,7 +891,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf)
+retcode = rbsrt._prepareabortorcontinue(abortf, opts=opts)
 if retcode is not None:
 return retcode
 else:
@@ -1543,7 +1545,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1588,7 +1590,10 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+if nobackup:
+repair.strip(repo.ui, repo, strippoints, backup=False)
+else:
+repair.strip(repo.ui, repo, strippoints)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3764: rebase: improve output of --dry-run

2018-06-23 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9263.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9259=9263

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,11 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -241,11 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -278,14 +278,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -315,9 +315,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -341,9 +341,11 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
+suppwarns = opts.get(r'dry_run')
 nobackup = opts.get(r'no_backup')
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, nobackup=nobackup)
+ activebookmark=self.activebookmark, nobackup=nobackup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -819,17 +821,19 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be 
changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
-opts = {'abort':True, 'no_backup':True}
+opts = {'abort':True, 'no_backup':True, 'dry_run':True}
 _origrebase(ui, repo, **opts)
 elif inmemory:
 try:
@@ -1545,7 +1549,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False):
+def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False,
+  suppwarning=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1601,7 +1606,8 @@
 finally:
 clearstatus(repo)
 clearcollapsemsg(repo)
-repo.ui.warn(_('rebase aborted\n'))
+if not suppwarning:
+repo.ui.warn(_('rebase aborted\n'))
 return 0
 
 def sortsource(destmap):



To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3764: rebase: improve output of --dry-run

2018-06-23 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9264.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9263=9264

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,11 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -241,11 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -278,14 +278,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -315,9 +315,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -341,9 +341,11 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
+suppwarns = opts.get(r'dry_run')
 nobackup = opts.get(r'no_backup')
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, nobackup=nobackup)
+ activebookmark=self.activebookmark, nobackup=nobackup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -819,17 +821,19 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be 
changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
-opts = {'abort':True, 'no_backup':True}
+opts = {'abort':True, 'no_backup':True, 'dry_run':True}
 _origrebase(ui, repo, **opts)
 elif inmemory:
 try:
@@ -1545,7 +1549,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False):
+def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1601,7 +1606,8 @@
 finally:
 clearstatus(repo)
 clearcollapsemsg(repo)
-repo.ui.warn(_('rebase aborted\n'))
+if not suppwarns:
+repo.ui.warn(_('rebase aborted\n'))
 return 0
 
 def sortsource(destmap):



To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3829: rebase: make dry-run return 1 or 0 according to result

2018-06-24 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe6b643ccf87d: rebase: make dry-run return 1 or 0 according 
to result (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3829?vs=9270=9271

REVISION DETAIL
  https://phab.mercurial-scm.org/D3829

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -287,6 +287,7 @@
   rollback completed
   hit a merge conflict
   rebase aborted
+  [1]
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -322,3 +323,4 @@
   merging e
   hit a merge conflict
   rebase aborted
+  [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -825,8 +825,10 @@
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
+return 1
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
 finally:
 _origrebase(ui, repo, abort=True)
 elif inmemory:



To: khanchi97, #hg-reviewers, pulkit
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3827: rebase: no need to store backup during dry-run while aborting

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9265.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3827?vs=9262=9265

REVISION DETAIL
  https://phab.mercurial-scm.org/D3827

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, backup=True):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,8 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, backup=backup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -828,7 +828,7 @@
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
 finally:
-_origrebase(ui, repo, abort=True)
+_origrebase(ui, repo, inmemory=True, abort=True)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -889,7 +889,9 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf)
+# If in-memory, means aborting during dry-run, no need to backup
+backup = not rbsrt.inmemory
+retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
 if retcode is not None:
 return retcode
 else:
@@ -1543,7 +1545,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1588,7 +1590,7 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=backup)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3764: rebase: improve output of --dry-run

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9266.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9264=9266

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,11 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -241,11 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -278,14 +278,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -315,9 +315,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort, backup=True):
+def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@
 raise error.Abort(msg, hint=hint)
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, backup=backup)
+ activebookmark=self.activebookmark, backup=backup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -818,15 +819,17 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be 
changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
 _origrebase(ui, repo, inmemory=True, abort=True)
 elif inmemory:
@@ -890,8 +893,11 @@
 mergeutil.checkunresolved(ms)
 
 # If in-memory, means aborting during dry-run, no need to backup
+# but suppress warnings
 backup = not rbsrt.inmemory
-retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
+suppwarns = rbsrt.inmemory
+retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup,
+suppwarns=suppwarns)
 if retcode is not None:
 return retcode
 else:
@@ -1545,7 +1551,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1598,7 +1605,8 @@
 finally:
  

D3830: rebase: suppress transaction warns during dry-run

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Suppressed warnings thrown while aborting a transaction during
  dryrun because these warnings does not sound safe to user.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3830

AFFECTED FILES
  hgext/rebase.py
  mercurial/localrepo.py
  mercurial/transaction.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -283,8 +283,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
-  transaction abort!
-  rollback completed
   hit a merge conflict
   $ hg diff
   $ hg status
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
 def __init__(self, report, opener, vfsmap, journalname, undoname=None,
  after=None, createmode=None, validator=None, releasefn=None,
- checkambigfiles=None, name=r''):
+ checkambigfiles=None, name=r'', suppwarns=False):
 """Begin a new transaction
 
 Begins a new transaction that allows rolling back writes in the event 
of
@@ -133,6 +133,7 @@
 self.map = {}
 self.journal = journalname
 self.undoname = undoname
+self.suppwarns = suppwarns
 self._queue = []
 # A callback to validate transaction content before closing it.
 # should raise exception is anything is wrong.
@@ -570,7 +571,8 @@
 self.opener.unlink(self.journal)
 return
 
-self.report(_("transaction abort!\n"))
+if not self.suppwarns:
+self.report(_("transaction abort!\n"))
 
 try:
 for cat in sorted(self._abortcallback):
@@ -580,7 +582,8 @@
 _playback(self.journal, self.report, self.opener, self._vfsmap,
   self.entries, self._backupentries, False,
   checkambigfiles=self.checkambigfiles)
-self.report(_("rollback completed\n"))
+if not self.suppwarns:
+self.report(_("rollback completed\n"))
 except BaseException:
 self.report(_("rollback failed - please run hg recover\n"))
 finally:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,7 +1224,7 @@
 return tr
 return None
 
-def transaction(self, desc, report=None):
+def transaction(self, desc, report=None, supptrwarns=False):
 if (self.ui.configbool('devel', 'all-warnings')
 or self.ui.configbool('devel', 'check-locks')):
 if self._currentlock(self._lockref) is None:
@@ -1371,7 +1371,8 @@
  validator=validate,
  releasefn=releasefn,
  checkambigfiles=_cachedfiles,
- name=desc)
+ name=desc,
+ suppwarns=supptrwarns)
 tr.changes['revs'] = xrange(0, 0)
 tr.changes['obsmarkers'] = set()
 tr.changes['phases'] = {}
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -824,7 +824,7 @@
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
-**opts)
+supptrwarns=True, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
@@ -847,7 +847,7 @@
 else:
 return _origrebase(ui, repo, **opts)
 
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
+def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, 
supptrwarns=False, **opts):
 opts = pycompat.byteskwargs(opts)
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 
@@ -912,7 +912,7 @@
 
 singletr = ui.configbool('rebase', 'singletransaction')
 if singletr:
-tr = repo.transaction('rebase')
+tr = repo.transaction('rebase', supptrwarns=supptrwarns)
 
 # If `rebase.singletransaction` is enabled, wrap the entire operation 
in
 # one transaction here. Otherwise, transactions are obtained when



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


D3830: rebase: suppress transaction warns during dry-run

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9269.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3830?vs=9267=9269

REVISION DETAIL
  https://phab.mercurial-scm.org/D3830

AFFECTED FILES
  hgext/rebase.py
  mercurial/localrepo.py
  mercurial/transaction.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -283,8 +283,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
-  transaction abort!
-  rollback completed
   hit a merge conflict
   $ hg diff
   $ hg status
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
 def __init__(self, report, opener, vfsmap, journalname, undoname=None,
  after=None, createmode=None, validator=None, releasefn=None,
- checkambigfiles=None, name=r''):
+ checkambigfiles=None, name=r'', suppwarns=False):
 """Begin a new transaction
 
 Begins a new transaction that allows rolling back writes in the event 
of
@@ -133,6 +133,7 @@
 self.map = {}
 self.journal = journalname
 self.undoname = undoname
+self.suppwarns = suppwarns
 self._queue = []
 # A callback to validate transaction content before closing it.
 # should raise exception is anything is wrong.
@@ -570,7 +571,8 @@
 self.opener.unlink(self.journal)
 return
 
-self.report(_("transaction abort!\n"))
+if not self.suppwarns:
+self.report(_("transaction abort!\n"))
 
 try:
 for cat in sorted(self._abortcallback):
@@ -580,7 +582,8 @@
 _playback(self.journal, self.report, self.opener, self._vfsmap,
   self.entries, self._backupentries, False,
   checkambigfiles=self.checkambigfiles)
-self.report(_("rollback completed\n"))
+if not self.suppwarns:
+self.report(_("rollback completed\n"))
 except BaseException:
 self.report(_("rollback failed - please run hg recover\n"))
 finally:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,7 +1224,7 @@
 return tr
 return None
 
-def transaction(self, desc, report=None):
+def transaction(self, desc, report=None, supptrwarns=False):
 if (self.ui.configbool('devel', 'all-warnings')
 or self.ui.configbool('devel', 'check-locks')):
 if self._currentlock(self._lockref) is None:
@@ -1371,7 +1371,8 @@
  validator=validate,
  releasefn=releasefn,
  checkambigfiles=_cachedfiles,
- name=desc)
+ name=desc,
+ suppwarns=supptrwarns)
 tr.changes['revs'] = xrange(0, 0)
 tr.changes['obsmarkers'] = set()
 tr.changes['phases'] = {}
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -825,7 +825,7 @@
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
-**opts)
+supptrwarns=True, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
@@ -848,7 +848,8 @@
 else:
 return _origrebase(ui, repo, **opts)
 
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
+def _origrebase(ui, repo, inmemory=False, leaveunfinished=False,
+supptrwarns=False, **opts):
 opts = pycompat.byteskwargs(opts)
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 
@@ -913,7 +914,7 @@
 
 singletr = ui.configbool('rebase', 'singletransaction')
 if singletr:
-tr = repo.transaction('rebase')
+tr = repo.transaction('rebase', supptrwarns=supptrwarns)
 
 # If `rebase.singletransaction` is enabled, wrap the entire operation 
in
 # one transaction here. Otherwise, transactions are obtained when



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


D3764: rebase: improve output of --dry-run

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9268.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9266=9268

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -208,11 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -241,11 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
-  rebase aborted
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -278,14 +278,14 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -315,9 +315,9 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not be changed
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort, backup=True):
+def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@
 raise error.Abort(msg, hint=hint)
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, backup=backup)
+ activebookmark=self.activebookmark, backup=backup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -818,15 +819,18 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+ui.status(_('starting dry-run rebase; repository will not be'
+'changed\n'))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run without '
+'-n/--dry-run to perform this rebase\n'))
 finally:
 _origrebase(ui, repo, inmemory=True, abort=True)
 elif inmemory:
@@ -890,8 +894,11 @@
 mergeutil.checkunresolved(ms)
 
 # If in-memory, means aborting during dry-run, no need to backup
+# but suppress warnings
 backup = not rbsrt.inmemory
-retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
+suppwarns = rbsrt.inmemory
+retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup,
+suppwarns=suppwarns)
 if retcode is not None:
 return retcode
 else:
@@ -1545,7 +1552,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1598,7 +1606,8 

D3829: rebase: make dry-run return 1 or 0 according to result

2018-06-24 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9270.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3829?vs=9261=9270

REVISION DETAIL
  https://phab.mercurial-scm.org/D3829

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -287,6 +287,7 @@
   rollback completed
   hit a merge conflict
   rebase aborted
+  [1]
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -322,3 +323,4 @@
   merging e
   hit a merge conflict
   rebase aborted
+  [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -825,8 +825,10 @@
 **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
+return 1
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
 finally:
 _origrebase(ui, repo, abort=True)
 elif inmemory:



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


D3828: rebase: add **opts to _prepareabortorcontinue

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Added keyword arguments option so that we can pass some options
  to abort method like nobackup option.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3828

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, **opts):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)



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


D3764: rebase: no need to store backup during dry-run while aborting

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9258.
khanchi97 edited the summary of this revision.
khanchi97 retitled this revision from "rebase: improve output of --dry-run" to 
"rebase: no need to store backup during dry-run while aborting".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9126=9258

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -341,8 +341,9 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+nobackup = opts.get('nobackup')
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, nobackup=nobackup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -828,7 +829,7 @@
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
 finally:
-_origrebase(ui, repo, abort=True)
+_origrebase(ui, repo, abort=True, nobackup=True)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -859,6 +860,7 @@
 destspace = opts.get('_destspace')
 contf = opts.get('continue')
 abortf = opts.get('abort')
+nobackup = opts.get('nobackup')
 if opts.get('interactive'):
 try:
 if extensions.find('histedit'):
@@ -889,7 +891,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf)
+retcode = rbsrt._prepareabortorcontinue(abortf, nobackup=nobackup)
 if retcode is not None:
 return retcode
 else:
@@ -1543,7 +1545,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, 
nobackup=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1588,7 +1590,10 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+if nobackup:
+repair.strip(repo.ui, repo, strippoints, backup=False)
+else:
+repair.strip(repo.ui, repo, strippoints)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3849: rebase: refactor dryrun implementation

2018-06-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch refactor dry-run code to make it easy to add additional
  functionality in dryrun. Otherwise we had to add every functionality
  through _origrebase() which does not seem a good implementation.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3849

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -644,6 +644,12 @@
 repo['.'].node() == repo._bookmarks[self.activebookmark]):
 bookmarks.activate(repo, self.activebookmark)
 
+def _abortunfinishedrebase(self, backup=False, suppwarns=True):
+repo = self.repo
+with repo.wlock(), repo.lock():
+retcode = self._prepareabortorcontinue(isabort=True)
+return retcode
+
 @command('rebase',
 [('s', 'source', '',
  _('rebase the specified changeset and descendants'), _('REV')),
@@ -818,19 +824,7 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, leaveunfinished=True,
-**opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-_origrebase(ui, repo, abort=True)
+return _dryrunrebase(ui, repo, **opts)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -846,6 +840,24 @@
 else:
 return _origrebase(ui, repo, **opts)
 
+def _dryrunrebase(ui, repo, **opts):
+leaveunfinished = True
+inmemory = True
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True,
+leaveunfinished=leaveunfinished, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
+rbsrt._abortunfinishedrebase()
+
 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
 opts = pycompat.byteskwargs(opts)
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)



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


D3849: rebase: refactor dryrun implementation

2018-06-27 Thread khanchi97 (Sushil khanchi)
khanchi97 added a subscriber: yuja.
khanchi97 added a comment.


  @yuja In this patch rebaseruntime is instantiated two times, one in 
_dryrunrebase and second in _origrebase, I don't know if it could make any 
problem although all tests are passing. Maybe _origrebase() also need some 
refactoring.
  See if this refactoring is good or if this can be improved, then please give 
some suggestions.
  Thanks :)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3849

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


D2409: graft: add no-commit mode (issue5631)

2018-06-26 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9301.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2409?vs=8961=9301

REVISION DETAIL
  https://phab.mercurial-scm.org/D2409

AFFECTED FILES
  mercurial/commands.py
  tests/test-completion.t
  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
@@ -1885,3 +1885,245 @@
   new changesets detected on destination branch, can't strip
   graft aborted
   working directory is now at 6b98ff0062dd
+
+
+Testing --no-commit option:|
+
+
+  $ cd ..
+  $ hg init nocommit
+  $ cd nocommit
+  $ echo a > a
+  $ hg ci -qAma
+  $ echo b > b
+  $ hg ci -qAmb
+  $ hg up -q 0
+  $ echo c > c
+  $ hg ci -qAmc
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  2:d36c0562f908 c
+  |
+  | o  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+Check reporting when --no-commit used with non-applicable options:
+
+  $ hg graft 1 --no-commit -e
+  abort: cannot specify --no-commit and --edit together
+  [255]
+
+  $ hg graft 1 --no-commit --log
+  abort: cannot specify --no-commit and --log together
+  [255]
+
+  $ hg graft 1 --no-commit -D
+  abort: cannot specify --no-commit and --currentdate together
+  [255]
+
+Test --no-commit is working:
+  $ hg graft 1 --no-commit
+  grafting 1:d2ae7f538514 "b"
+
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  2:d36c0562f908 c
+  |
+  | o  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+  $ hg diff
+  diff -r d36c0562f908 b
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/b  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +b
+
+Prepare wrdir to check --no-commit is resepected after --continue:
+
+  $ hg up -qC
+  $ echo A>a
+  $ hg ci -qm "A in file a"
+  $ hg up -q 1
+  $ echo B>a
+  $ hg ci -qm "B in file a"
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+
+  $ hg graft 3 --no-commit
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+Resolve conflict:
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+  $ hg diff
+  diff -r 2aa9ad1006ff 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 up -qC
+
+Check --no-commit is resepected when passed with --continue:
+
+  $ hg graft 3
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+Resolve conflict:
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue --no-commit
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg diff
+  diff -r 2aa9ad1006ff 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 log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  0:cb9a9f314b8b a
+  
+  $ hg up -qC
+
+Test --no-commit when graft multiple revisions:
+When there is conflict:
+  $ hg graft -r "2::3" --no-commit
+  grafting 2:d36c0562f908 "c"
+  grafting 3:09e253b87e17 "A in file a"
+  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]
+
+  $ echo A>a
+  $ hg resolve --mark
+  (no more unresolved files)
+  continue: hg graft --continue
+  $ hg graft --continue
+  grafting 3:09e253b87e17 "A in file a"
+  $ hg diff
+  diff -r 2aa9ad1006ff 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
+  diff -r 2aa9ad1006ff c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  4:2aa9ad1006ff B in file a
+  |
+  | o  3:09e253b87e17 A in file a
+  | |
+  | o  2:d36c0562f908 c
+  | |
+  o |  1:d2ae7f538514 b
+  |/
+  o  

D3872: histedit: add --no-backup option (issue5825)

2018-07-01 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This option provides a functionality to not store a backup
  while aborting histedit in between. Also added tests for the
  same.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3872

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-no-backup.t

CHANGE DETAILS

diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
new file mode 100644
--- /dev/null
+++ b/tests/test-histedit-no-backup.t
@@ -0,0 +1,95 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+Enable extension used by this test
+  $ cat >>$HGRCPATH < [extensions]
+  > histedit=
+  > EOF
+
+Repo setup:
+  $ hg init foo
+  $ cd foo
+  $ echo first>file
+  $ hg ci -qAm one
+  $ echo second>>file
+  $ hg ci -m two
+  $ echo third>>file
+  $ hg ci -m three
+  $ echo forth>>file
+  $ hg ci -m four
+  $ hg log -G --style compact
+  @  3[tip]   7d5187087c79   1970-01-01 00:00 +   test
+  |four
+  |
+  o  2   80d23dfa866d   1970-01-01 00:00 +   test
+  |three
+  |
+  o  1   6153eb23e623   1970-01-01 00:00 +   test
+  |two
+  |
+  o  0   36b4bdd91f5b   1970-01-01 00:00 +   test
+   one
+  
+Check when --no-backup is not passed
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
+
+  $ hg st
+  $ hg diff
+  $ hg log -G --style compact
+  @  3[tip]   7d5187087c79   1970-01-01 00:00 +   test
+  |four
+  |
+  o  2   80d23dfa866d   1970-01-01 00:00 +   test
+  |three
+  |
+  o  1   6153eb23e623   1970-01-01 00:00 +   test
+  |two
+  |
+  o  0   36b4bdd91f5b   1970-01-01 00:00 +   test
+   one
+  
+
+Check when --no-backup is passed
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+
+  $ hg histedit --abort --no-backup
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg st
+  $ hg diff
+  $ hg log -G --style compact
+  @  3[tip]   7d5187087c79   1970-01-01 00:00 +   test
+  |four
+  |
+  o  2   80d23dfa866d   1970-01-01 00:00 +   test
+  |three
+  |
+  o  1   6153eb23e623   1970-01-01 00:00 +   test
+  |two
+  |
+  o  0   36b4bdd91f5b   1970-01-01 00:00 +   test
+   one
+  
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -924,6 +924,7 @@
   _("don't strip old nodes after edit is complete")),
  ('', 'abort', False, _('abort an edit in progress')),
  ('o', 'outgoing', False, _('changesets not found in destination')),
+ ('', 'no-backup', False, _('no backup')),
  ('f', 'force', False,
   _('force outgoing even for unrelated repositories')),
  ('r', 'rev', [], _('first revision to be edited'), _('REV'))] +
@@ -1109,6 +1110,7 @@
 fm.startitem()
 goal = _getgoal(opts)
 revs = opts.get('rev', [])
+nobackup = opts.get('no_backup')
 rules = opts.get('commands', '')
 state.keep = opts.get('keep', False)
 
@@ -1122,7 +1124,7 @@
 _edithisteditplan(ui, repo, state, rules)
 return
 elif goal == goalabort:
-_aborthistedit(ui, repo, state)
+_aborthistedit(ui, repo, state, nobackup=nobackup)
 return
 else:
 # goal == goalnew
@@ -1222,7 +1224,7 @@
 if repo.vfs.exists('histedit-last-edit.txt'):
 repo.vfs.unlink('histedit-last-edit.txt')
 
-def _aborthistedit(ui, repo, state):
+def _aborthistedit(ui, repo, state, nobackup=False):
 try:
 state.read()
 __, leafs, tmpnodes, __ = processreplacement(state)
@@ -1244,8 +1246,8 @@
 if repo.unfiltered().revs('parents() and (%n  or %ln::)',
 state.parentctxnode, leafs | tmpnodes):
 hg.clean(repo, state.topmost, show_stats=True, quietempty=True)
-cleanupnode(ui, repo, tmpnodes)
-cleanupnode(ui, repo, leafs)
+cleanupnode(ui, repo, tmpnodes, nobackup=nobackup)
+cleanupnode(ui, repo, leafs, nobackup=nobackup)
 except Exception:
 if state.inprogress():
 ui.warn(_('warning: encountered an exception during histedit '
@@ 

D2276: a: change a to add some new lines

2018-02-14 Thread khanchi97 (Sushil khanchi)
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


D2278: bundle: updates the help text for hg bundle (issue5744) [bugzilla]

2018-02-17 Thread khanchi97 (Sushil khanchi)
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


D2409: graft: add no-commit mode (issue5631)

2018-02-24 Thread khanchi97 (Sushil khanchi)
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]

2018-02-16 Thread khanchi97 (Sushil khanchi)
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


D2278: bundle: updates the help text for hg bundle (issue5744) [bugzilla]

2018-02-18 Thread khanchi97 (Sushil khanchi)
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


D2409: graft: add no-commit mode (issue5631)

2018-02-26 Thread khanchi97 (Sushil khanchi)
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)

2018-02-26 Thread khanchi97 (Sushil khanchi)
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


D3764: rebase: improve output of --dry-run

2018-06-19 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  okay @pulkit , let me confirm if IIUC your points.
  
  1. First thing is we would have a function which will accept a 
`return_code`(0 or 1) and `output_data` (what can happen without --dry-run)  
from any command (which has dry-run functionality). And will give output to the 
user according to the `return_code`. Following is the rough code for this, 
correct me if I am wrong at any point.
  
def dryrunformatter(retcode, **outputdata):
ui.status(_("starting dry-run; repository will not be changed"))

# here show the outputdata accordingly

if retcode == 0:
ui.status(_("dry-run completed successfully; run without 
--dry-run/-n to perform this action"))
else:
ui.status(_("hit conflicts!"))
  
  
  
  2. If above explanation is right, talking about "additional functionality in 
dryrun" like --verbose mode in rebase which @indygreg suggested. May be we can 
add this type of functionality too in dryrunformatter? What do you say?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3764

To: khanchi97, #hg-reviewers
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3756: rebase: delete the comment which was not following "do not eat my data"

2018-06-22 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9253.
khanchi97 retitled this revision from "rebase: no need to backup rebased csets 
while aborting" to "rebase: delete the comment which was not following "do not 
eat my data"".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3756?vs=9108=9253

REVISION DETAIL
  https://phab.mercurial-scm.org/D3756

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1572,7 +1572,6 @@
 
 # Strip from the first rebased revision
 if rebased:
-# no backup of rebased cset versions needed
 repair.strip(repo.ui, repo, strippoints)
 
 if activebookmark and activebookmark in repo._bookmarks:



To: khanchi97, #hg-reviewers
Cc: indygreg, durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3756: rebase: delete the comment which was not following "do not eat my data"

2018-06-22 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd6686f864a70: rebase: delete the comment which was not 
following do not eat my data (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3756?vs=9253=9254

REVISION DETAIL
  https://phab.mercurial-scm.org/D3756

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1588,7 +1588,6 @@
 
 # Strip from the first rebased revision
 if rebased:
-# no backup of rebased cset versions needed
 repair.strip(repo.ui, repo, strippoints)
 
 if activebookmark and activebookmark in repo._bookmarks:



To: khanchi97, #hg-reviewers
Cc: indygreg, durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3887: rebase: support "history-editing-backup" config option

2018-08-02 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3887#62850, @pulkit wrote:
  
  > In https://phab.mercurial-scm.org/D3887#62825, @yuja wrote:
  >
  > > Queued, thanks.
  > >
  > > > @@ -829,6 +833,8 @@
  > > > 
  > > >   userrevs = list(repo.revs(opts.get('auto_orphans')))
  > > >   opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
  > > >   opts['dest'] = '_destautoorphanrebase(SRC)'
  > > > 
  > > > +backup = ui.configbool('ui', 'history-editing-backup')
  > > >  +opts['backup'] = backup
  > >
  > > This seems getting ugly. Maybe the option can be carried by rbsrt instead?
  > >
  > >   self.backupf = ui.configbool('ui', 'history-editing-backup')
  > >   
  >
  >
  > I like Yuya's suggestion here. @khanchi97 can you please follow-up?
  
  
  Okay, I will send a follow-up.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3887

To: khanchi97, #hg-reviewers
Cc: pulkit, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3988: resolve: add confirm config option

2018-08-01 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9678.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3988?vs=9676=9678

REVISION DETAIL
  https://phab.mercurial-scm.org/D3988

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -374,3 +374,93 @@
   $ hg resolve -l
 
   $ cd ..
+
+==
+Test 'hg resolve' confirm config option functionality |
+==
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
+  > EOF
+
+  $ hg init repo2
+  $ cd repo2
+
+  $ echo boss > boss
+  $ hg ci -Am "add boss"
+  adding boss
+
+  $ for emp in emp1 emp2 emp3; do echo work > $emp; done;
+  $ hg ci -Aqm "added emp1 emp2 emp3"
+
+  $ hg up 0
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done;
+  $ hg ci -Aqm "added lazy emp1 emp2 emp3"
+
+  $ hg log -GT "{rev} {node|short} {firstline(desc)}\n"
+  @  2 0acfd4a49af0 added lazy emp1 emp2 emp3
+  |
+  | o  1 f30f98a8181f added emp1 emp2 emp3
+  |/
+  o  0 88660038d466 add boss
+  
+  $ hg rebase -s 1 -d 2
+  rebasing 1:f30f98a8181f "added emp1 emp2 emp3"
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+Test when commands.resolve.confirm config option is not set:
+===
+  $ hg resolve --all
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+Test when config option is set:
+==
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > interactive = True
+  > [commands]
+  > resolve.confirm = True
+  > EOF
+
+  $ hg resolve
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+  $ hg resolve --all << EOF
+  > n
+  > EOF
+  re-merge all unresolved files (yn)? n
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+
+  $ hg resolve --all << EOF
+  > y
+  > EOF
+  re-merge all unresolved files (yn)? y
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+  $ hg rebase --abort
+  rebase aborted
+  $ cd ..
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -190,6 +190,9 @@
 coreconfigitem('commands', 'grep.all-files',
 default=False,
 )
+coreconfigitem('commands', 'resolve.confirm',
+default=False,
+)
 coreconfigitem('commands', 'show.aliasprefix',
 default=list,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4528,10 +4528,15 @@
 """
 
 opts = pycompat.byteskwargs(opts)
+confirm = ui.configbool('commands', 'resolve.confirm')
 flaglist = 'all mark unmark list no_status'.split()
 all, mark, unmark, show, nostatus = \
 [opts.get(o) for o in flaglist]
 
+if all and confirm and ui.promptchoice(_(b're-merge all unresolved files'
+ b' (yn)?$$  $$ ')):
+all = False
+
 if (show and (mark or unmark)) or (mark and unmark):
 raise error.Abort(_("too many options specified"))
 if pats and all:



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


D4055: rebase: move "backup" flag to rbsrt

2018-08-02 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It was getting messy to populate "backup" flag to calls
  of `_finishrebase()` and `_prepareabortorcontinue`, so
  made some changes to move "backup" flag to rbsrt.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4055

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -177,6 +177,7 @@
 if e:
 self.extrafns = [e]
 
+self.backupf = ui.configbool('ui', 'history-editing-backup')
 self.keepf = opts.get('keep', False)
 self.keepbranchesf = opts.get('keepbranches', False)
 self.obsoletenotrebased = {}
@@ -343,6 +344,10 @@
 msg = _('cannot continue inconsistent rebase')
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
+
+nobackup = (not backup) or (not self.backupf)
+backup = not nobackup
+
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
  activebookmark=self.activebookmark, backup=backup,
@@ -585,11 +590,7 @@
 # case and realize that the commit was in progress.
 self.storestatus()
 
-def _finishrebase(self, backup=True):
-"""
-backup:   if False, no backup will be stored when stripping rebased
-  revisions
-"""
+def _finishrebase(self):
 repo, ui, opts = self.repo, self.ui, self.opts
 fm = ui.formatter('rebase', opts)
 fm.startitem()
@@ -636,7 +637,7 @@
 if self.collapsef and not self.keepf:
 collapsedas = newnode
 clearrebased(ui, repo, self.destmap, self.state, self.skipped,
- collapsedas, self.keepf, fm=fm, backup=backup)
+ collapsedas, self.keepf, fm=fm, backup=self.backupf)
 
 clearstatus(repo)
 clearcollapsemsg(repo)
@@ -833,8 +834,6 @@
 userrevs = list(repo.revs(opts.get('auto_orphans')))
 opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
 opts['dest'] = '_destautoorphanrebase(SRC)'
-backup = ui.configbool('ui', 'history-editing-backup')
-opts['backup'] = backup
 
 if dryrun:
 return _dryrunrebase(ui, repo, opts)
@@ -856,7 +855,6 @@
 def _dryrunrebase(ui, repo, opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
 confirm = opts.get('confirm')
-backup = opts.get('backup')
 if confirm:
 ui.status(_('starting in-memory rebase\n'))
 else:
@@ -878,7 +876,7 @@
 if not ui.promptchoice(_(b'apply changes (yn)?'
  b'$$  $$ ')):
 # finish unfinished rebase
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 else:
 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
   suppwarns=True)
@@ -909,7 +907,6 @@
 destspace = opts.get('_destspace')
 contf = opts.get('continue')
 abortf = opts.get('abort')
-backup = opts.get('backup')
 if opts.get('interactive'):
 try:
 if extensions.find('histedit'):
@@ -940,7 +937,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
+retcode = rbsrt._prepareabortorcontinue(abortf)
 if retcode is not None:
 return retcode
 else:
@@ -969,7 +966,7 @@
 with util.acceptintervention(dsguard):
 rbsrt._performrebase(tr)
 if not leaveunfinished:
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, inmemory, destf=None, srcf=None, basef=None,
revf=None, destspace=None):



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


D3968: amend: support "history-editing-backup" config option

2018-08-02 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9794.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3968?vs=9640=9794

REVISION DETAIL
  https://phab.mercurial-scm.org/D3968

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -331,3 +331,37 @@
   ? missing_content2_content2-untracked
   ? missing_content2_content3-untracked
   ? missing_missing_content3-untracked
+
+==
+Test history-editing-backup config option|
+==
+  $ hg init $TESTTMP/repo4
+  $ cd $TESTTMP/repo4
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo oops>b
+  $ hg ci -Aqm "b"
+  $ echo partiallyfixed > b
+
+#if obsstore-off
+  $ hg amend
+  saved backup bundle to 
$TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
+When history-editing-backup config option is set:
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > history-editing-backup = False
+  > EOF
+  $ echo fixed > b
+  $ hg amend
+
+#else
+  $ hg amend
+When history-editing-backup config option is set:
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > history-editing-backup = False
+  > EOF
+  $ echo fixed > b
+  $ hg amend
+
+#endif
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2556,8 +2556,10 @@
 obsmetadata = None
 if opts.get('note'):
 obsmetadata = {'note': encoding.fromlocal(opts['note'])}
+backup = ui.configbool('ui', 'history-editing-backup')
 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata,
- fixphase=True, targetphase=commitphase)
+ fixphase=True, targetphase=commitphase,
+ backup=backup)
 
 # Fixing the dirstate because localrepo.commitctx does not update
 # it. This is rather convenient because we did not need to update



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


D4055: rebase: move "backup" flag to rbsrt

2018-08-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9815.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4055?vs=9793=9815

REVISION DETAIL
  https://phab.mercurial-scm.org/D4055

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -177,6 +177,7 @@
 if e:
 self.extrafns = [e]
 
+self.backupf = ui.configbool('ui', 'history-editing-backup')
 self.keepf = opts.get('keep', False)
 self.keepbranchesf = opts.get('keepbranches', False)
 self.obsoletenotrebased = {}
@@ -343,7 +344,9 @@
 msg = _('cannot continue inconsistent rebase')
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
+
 if isabort:
+backup = backup and self.backupf
 return abort(self.repo, self.originalwd, self.destmap, self.state,
  activebookmark=self.activebookmark, backup=backup,
  suppwarns=suppwarns)
@@ -585,11 +588,7 @@
 # case and realize that the commit was in progress.
 self.storestatus()
 
-def _finishrebase(self, backup=True):
-"""
-backup:   if False, no backup will be stored when stripping rebased
-  revisions
-"""
+def _finishrebase(self):
 repo, ui, opts = self.repo, self.ui, self.opts
 fm = ui.formatter('rebase', opts)
 fm.startitem()
@@ -636,7 +635,7 @@
 if self.collapsef and not self.keepf:
 collapsedas = newnode
 clearrebased(ui, repo, self.destmap, self.state, self.skipped,
- collapsedas, self.keepf, fm=fm, backup=backup)
+ collapsedas, self.keepf, fm=fm, backup=self.backupf)
 
 clearstatus(repo)
 clearcollapsemsg(repo)
@@ -833,8 +832,6 @@
 userrevs = list(repo.revs(opts.get('auto_orphans')))
 opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
 opts['dest'] = '_destautoorphanrebase(SRC)'
-backup = ui.configbool('ui', 'history-editing-backup')
-opts['backup'] = backup
 
 if dryrun:
 return _dryrunrebase(ui, repo, opts)
@@ -856,7 +853,6 @@
 def _dryrunrebase(ui, repo, opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
 confirm = opts.get('confirm')
-backup = opts.get('backup')
 if confirm:
 ui.status(_('starting in-memory rebase\n'))
 else:
@@ -878,7 +874,7 @@
 if not ui.promptchoice(_(b'apply changes (yn)?'
  b'$$  $$ ')):
 # finish unfinished rebase
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 else:
 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
   suppwarns=True)
@@ -909,7 +905,6 @@
 destspace = opts.get('_destspace')
 contf = opts.get('continue')
 abortf = opts.get('abort')
-backup = opts.get('backup')
 if opts.get('interactive'):
 try:
 if extensions.find('histedit'):
@@ -940,7 +935,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
+retcode = rbsrt._prepareabortorcontinue(abortf)
 if retcode is not None:
 return retcode
 else:
@@ -969,7 +964,7 @@
 with util.acceptintervention(dsguard):
 rbsrt._performrebase(tr)
 if not leaveunfinished:
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, inmemory, destf=None, srcf=None, basef=None,
revf=None, destspace=None):



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


D4055: rebase: move "backup" flag to rbsrt

2018-08-03 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> pulkit wrote in rebase.py:349
> not A or not B = not (A and B)
> not(not A or not B) = A and B

Ah, right.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4055

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


D3988: resolve: add confirm config option

2018-08-03 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9816.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3988?vs=9785=9816

REVISION DETAIL
  https://phab.mercurial-scm.org/D3988

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/help/config.txt
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -374,3 +374,92 @@
   $ hg resolve -l
 
   $ cd ..
+
+==
+Test 'hg resolve' confirm config option functionality |
+==
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
+  > EOF
+
+  $ hg init repo2
+  $ cd repo2
+
+  $ echo boss > boss
+  $ hg ci -Am "add boss"
+  adding boss
+
+  $ for emp in emp1 emp2 emp3; do echo work > $emp; done;
+  $ hg ci -Aqm "added emp1 emp2 emp3"
+
+  $ hg up 0
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done;
+  $ hg ci -Aqm "added lazy emp1 emp2 emp3"
+
+  $ hg log -GT "{rev} {node|short} {firstline(desc)}\n"
+  @  2 0acfd4a49af0 added lazy emp1 emp2 emp3
+  |
+  | o  1 f30f98a8181f added emp1 emp2 emp3
+  |/
+  o  0 88660038d466 add boss
+  
+  $ hg rebase -s 1 -d 2
+  rebasing 1:f30f98a8181f "added emp1 emp2 emp3"
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+Test when commands.resolve.confirm config option is not set:
+===
+  $ hg resolve --all
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+Test when config option is set:
+==
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > interactive = True
+  > [commands]
+  > resolve.confirm = True
+  > EOF
+
+  $ hg resolve
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+  $ hg resolve --all << EOF
+  > n
+  > EOF
+  re-merge all unresolved files (yn)? n
+  abort: user quit
+  [255]
+
+  $ hg resolve --all << EOF
+  > y
+  > EOF
+  re-merge all unresolved files (yn)? y
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+  $ hg rebase --abort
+  rebase aborted
+  $ cd ..
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -438,6 +438,11 @@
 ``commands``
 
 
+``resolve.confirm``
+Confirm before re-merging all unresolved files when running
+:hg:`resolve --all`.
+(default: False)
+
 ``status.relative``
 Make paths in :hg:`status` output relative to the current directory.
 (default: False)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -190,6 +190,9 @@
 coreconfigitem('commands', 'grep.all-files',
 default=False,
 )
+coreconfigitem('commands', 'resolve.confirm',
+default=False,
+)
 coreconfigitem('commands', 'show.aliasprefix',
 default=list,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4528,10 +4528,16 @@
 """
 
 opts = pycompat.byteskwargs(opts)
+confirm = ui.configbool('commands', 'resolve.confirm')
 flaglist = 'all mark unmark list no_status'.split()
 all, mark, unmark, show, nostatus = \
 [opts.get(o) for o in flaglist]
 
+if all and confirm:
+if ui.promptchoice(_(b're-merge all unresolved files (yn)?'
+ b'$$  $$ ')):
+raise error.Abort(_('user quit'))
+
 if (show and (mark or unmark)) or (mark and unmark):
 raise error.Abort(_("too many options specified"))
 if pats and all:



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


D4055: rebase: move "backup" flag to rbsrt

2018-08-03 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2b728789edfd: rebase: move backup flag to 
rebaseruntime (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4055?vs=9815=9817

REVISION DETAIL
  https://phab.mercurial-scm.org/D4055

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -177,6 +177,7 @@
 if e:
 self.extrafns = [e]
 
+self.backupf = ui.configbool('ui', 'history-editing-backup')
 self.keepf = opts.get('keep', False)
 self.keepbranchesf = opts.get('keepbranches', False)
 self.obsoletenotrebased = {}
@@ -343,7 +344,9 @@
 msg = _('cannot continue inconsistent rebase')
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
+
 if isabort:
+backup = backup and self.backupf
 return abort(self.repo, self.originalwd, self.destmap, self.state,
  activebookmark=self.activebookmark, backup=backup,
  suppwarns=suppwarns)
@@ -585,11 +588,7 @@
 # case and realize that the commit was in progress.
 self.storestatus()
 
-def _finishrebase(self, backup=True):
-"""
-backup:   if False, no backup will be stored when stripping rebased
-  revisions
-"""
+def _finishrebase(self):
 repo, ui, opts = self.repo, self.ui, self.opts
 fm = ui.formatter('rebase', opts)
 fm.startitem()
@@ -636,7 +635,7 @@
 if self.collapsef and not self.keepf:
 collapsedas = newnode
 clearrebased(ui, repo, self.destmap, self.state, self.skipped,
- collapsedas, self.keepf, fm=fm, backup=backup)
+ collapsedas, self.keepf, fm=fm, backup=self.backupf)
 
 clearstatus(repo)
 clearcollapsemsg(repo)
@@ -833,8 +832,6 @@
 userrevs = list(repo.revs(opts.get('auto_orphans')))
 opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
 opts['dest'] = '_destautoorphanrebase(SRC)'
-backup = ui.configbool('ui', 'history-editing-backup')
-opts['backup'] = backup
 
 if dryrun:
 return _dryrunrebase(ui, repo, opts)
@@ -856,7 +853,6 @@
 def _dryrunrebase(ui, repo, opts):
 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
 confirm = opts.get('confirm')
-backup = opts.get('backup')
 if confirm:
 ui.status(_('starting in-memory rebase\n'))
 else:
@@ -878,7 +874,7 @@
 if not ui.promptchoice(_(b'apply changes (yn)?'
  b'$$  $$ ')):
 # finish unfinished rebase
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 else:
 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
   suppwarns=True)
@@ -909,7 +905,6 @@
 destspace = opts.get('_destspace')
 contf = opts.get('continue')
 abortf = opts.get('abort')
-backup = opts.get('backup')
 if opts.get('interactive'):
 try:
 if extensions.find('histedit'):
@@ -940,7 +935,7 @@
 ms = mergemod.mergestate.read(repo)
 mergeutil.checkunresolved(ms)
 
-retcode = rbsrt._prepareabortorcontinue(abortf, backup=backup)
+retcode = rbsrt._prepareabortorcontinue(abortf)
 if retcode is not None:
 return retcode
 else:
@@ -969,7 +964,7 @@
 with util.acceptintervention(dsguard):
 rbsrt._performrebase(tr)
 if not leaveunfinished:
-rbsrt._finishrebase(backup=backup)
+rbsrt._finishrebase()
 
 def _definedestmap(ui, repo, inmemory, destf=None, srcf=None, basef=None,
revf=None, destspace=None):



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


D3968: amend: support "history-editing-backup" config option

2018-08-03 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG32ece991955c: amend: support 
history-editing-backup config option (authored by khanchi97, 
committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3968?vs=9794=9818

REVISION DETAIL
  https://phab.mercurial-scm.org/D3968

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -331,3 +331,37 @@
   ? missing_content2_content2-untracked
   ? missing_content2_content3-untracked
   ? missing_missing_content3-untracked
+
+==
+Test history-editing-backup config option|
+==
+  $ hg init $TESTTMP/repo4
+  $ cd $TESTTMP/repo4
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo oops>b
+  $ hg ci -Aqm "b"
+  $ echo partiallyfixed > b
+
+#if obsstore-off
+  $ hg amend
+  saved backup bundle to 
$TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
+When history-editing-backup config option is set:
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > history-editing-backup = False
+  > EOF
+  $ echo fixed > b
+  $ hg amend
+
+#else
+  $ hg amend
+When history-editing-backup config option is set:
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > history-editing-backup = False
+  > EOF
+  $ echo fixed > b
+  $ hg amend
+
+#endif
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2556,8 +2556,10 @@
 obsmetadata = None
 if opts.get('note'):
 obsmetadata = {'note': encoding.fromlocal(opts['note'])}
+backup = ui.configbool('ui', 'history-editing-backup')
 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata,
- fixphase=True, targetphase=commitphase)
+ fixphase=True, targetphase=commitphase,
+ backup=backup)
 
 # Fixing the dirstate because localrepo.commitctx does not update
 # it. This is rather convenient because we did not need to update



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


D3988: resolve: add confirm config option

2018-08-03 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf8732e33bcbc: resolve: add confirm config option (authored 
by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3988?vs=9816=9823#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3988?vs=9816=9823

REVISION DETAIL
  https://phab.mercurial-scm.org/D3988

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/help/config.txt
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -423,3 +423,92 @@
   R file2
 
   $ cd ..
+
+==
+Test 'hg resolve' confirm config option functionality |
+==
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
+  > EOF
+
+  $ hg init repo2
+  $ cd repo2
+
+  $ echo boss > boss
+  $ hg ci -Am "add boss"
+  adding boss
+
+  $ for emp in emp1 emp2 emp3; do echo work > $emp; done;
+  $ hg ci -Aqm "added emp1 emp2 emp3"
+
+  $ hg up 0
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done;
+  $ hg ci -Aqm "added lazy emp1 emp2 emp3"
+
+  $ hg log -GT "{rev} {node|short} {firstline(desc)}\n"
+  @  2 0acfd4a49af0 added lazy emp1 emp2 emp3
+  |
+  | o  1 f30f98a8181f added emp1 emp2 emp3
+  |/
+  o  0 88660038d466 add boss
+  
+  $ hg rebase -s 1 -d 2
+  rebasing 1:f30f98a8181f "added emp1 emp2 emp3"
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+Test when commands.resolve.confirm config option is not set:
+===
+  $ hg resolve --all
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+Test when config option is set:
+==
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > interactive = True
+  > [commands]
+  > resolve.confirm = True
+  > EOF
+
+  $ hg resolve
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+  $ hg resolve --all << EOF
+  > n
+  > EOF
+  re-merge all unresolved files (yn)? n
+  abort: user quit
+  [255]
+
+  $ hg resolve --all << EOF
+  > y
+  > EOF
+  re-merge all unresolved files (yn)? y
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+  $ hg rebase --abort
+  rebase aborted
+  $ cd ..
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -438,6 +438,11 @@
 ``commands``
 
 
+``resolve.confirm``
+Confirm before re-merging all unresolved files when running
+:hg:`resolve --all`.
+(default: False)
+
 ``status.relative``
 Make paths in :hg:`status` output relative to the current directory.
 (default: False)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -190,6 +190,9 @@
 coreconfigitem('commands', 'grep.all-files',
 default=False,
 )
+coreconfigitem('commands', 'resolve.confirm',
+default=False,
+)
 coreconfigitem('commands', 'show.aliasprefix',
 default=list,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4529,10 +4529,16 @@
 """
 
 opts = pycompat.byteskwargs(opts)
+confirm = ui.configbool('commands', 'resolve.confirm')
 flaglist = 'all mark unmark list no_status'.split()
 all, mark, unmark, show, nostatus = \
 [opts.get(o) for o in flaglist]
 
+if all and confirm:
+if ui.promptchoice(_(b're-merge all unresolved files (yn)?'
+ b'$$  $$ ')):
+raise error.Abort(_('user quit'))
+
 if (show and (mark or unmark)) or (mark and unmark):
 raise error.Abort(_("too many options specified"))
 if pats and all:



To: khanchi97, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

D3982: rebase: add test to show --stop moves bookmarks

2018-07-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Added tests to show that --stop option moves bookmarks
  of rebased csets to their succs.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3982

AFFECTED FILES
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -2021,3 +2021,79 @@
   $ hg rebase --stop --continue
   abort: cannot use --stop with --abort or --continue
   [255]
+
+Test --stop moves bookmarks of original revisions to new rebased nodes:
+==
+  $ cd ..
+  $ hg init repo
+  $ cd repo
+
+  $ echo a > a
+  $ hg ci -Am A
+  adding a
+
+  $ echo b > b
+  $ hg ci -Am B
+  adding b
+  $ hg book X
+  $ hg book Y
+
+  $ echo c > c
+  $ hg ci -Am C
+  adding c
+  $ hg book Z
+
+  $ echo d > d
+  $ hg ci -Am D
+  adding d
+
+  $ hg up 0 -q
+  $ echo e > e
+  $ hg ci -Am E
+  adding e
+  created new head
+
+  $ echo doubt > d
+  $ hg ci -Am "conflict with d"
+  adding d
+
+  $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
+  @  5: 39adf30bc1be 'conflict with d' bookmarks:
+  |
+  o  4: 9c1e55f411b6 'E' bookmarks:
+  |
+  | o  3: 67a385d4e6f2 'D' bookmarks: Z
+  | |
+  | o  2: 49cb3485fa0c 'C' bookmarks: Y
+  | |
+  | o  1: 6c81ed0049f8 'B' bookmarks: X
+  |/
+  o  0: 1994f17a630e 'A' bookmarks:
+  
+  $ hg rebase -s 1 -d 5
+  rebasing 1:6c81ed0049f8 "B" (X)
+  rebasing 2:49cb3485fa0c "C" (Y)
+  rebasing 3:67a385d4e6f2 "D" (Z)
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ hg rebase --stop
+  1 new orphan changesets
+  $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
+  o  7: 9c86c650b686 'C' bookmarks: Y
+  |
+  o  6: 9b87b54e5fd8 'B' bookmarks: X
+  |
+  @  5: 39adf30bc1be 'conflict with d' bookmarks:
+  |
+  o  4: 9c1e55f411b6 'E' bookmarks:
+  |
+  | *  3: 67a385d4e6f2 'D' bookmarks: Z
+  | |
+  | x  2: 49cb3485fa0c 'C' bookmarks:
+  | |
+  | x  1: 6c81ed0049f8 'B' bookmarks:
+  |/
+  o  0: 1994f17a630e 'A' bookmarks:
+  



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


D3959: rebase: add --stop option to stop rebase at any point (issue5206)

2018-07-27 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3959#61803, @pulkit wrote:
  
  > You also need to take care of bookmark movements. Bookmark from changesets 
which have successfully rebased should be moved to their successors when we 
call --stop.
  
  
  @pulkit 
  I think bookmarks movement is already handled by `clearrebased()` function. I 
going to send a patch to reflect this behaviour. Correct me if I am missing 
something.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3959

To: khanchi97, #hg-reviewers
Cc: pulkit, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3988: resolve: add confirm config option

2018-07-31 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This config setting gives a functionality to confirm before
  it re-merge all unresolved files. If this config is enabled,
  when you run 'hg resolve' it will prompt with a msg
  "re-merge all unresolved files (yn)?"
  
  To enable this functionality:
  [ui]
  resolve.confirm = True

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3988

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -374,3 +374,84 @@
   $ hg resolve -l
 
   $ cd ..
+
+==
+Test 'hg resolve' confirm config option functionality |
+==
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
+  > EOF
+
+  $ hg init repo2
+  $ cd repo2
+
+  $ echo boss > boss
+  $ hg ci -Am "add boss"
+  adding boss
+
+  $ for emp in emp1 emp2 emp3; do echo work > $emp; done;
+  $ hg ci -Aqm "added emp1 emp2 emp3"
+
+  $ hg up 0
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done;
+  $ hg ci -Aqm "added lazy emp1 emp2 emp3"
+
+  $ hg log -GT "{rev} {node|short} {firstline(desc)}\n"
+  @  2 0acfd4a49af0 added lazy emp1 emp2 emp3
+  |
+  | o  1 f30f98a8181f added emp1 emp2 emp3
+  |/
+  o  0 88660038d466 add boss
+  
+  $ hg rebase -s 1 -d 2
+  rebasing 1:f30f98a8181f "added emp1 emp2 emp3"
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+Test when ui.resolve.confirm config option is not set:
+=
+  $ hg resolve
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+
+Test when config option is set:
+==
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > interactive = True
+  > resolve.confirm = True
+  > EOF
+
+  $ hg resolve << EOF
+  > n
+  > EOF
+  re-merge all unresolved files (yn)? n
+  abort: no files or directories specified
+  (use --all to re-merge all unresolved files)
+  [255]
+
+  $ hg resolve << EOF
+  > y
+  > EOF
+  re-merge all unresolved files (yn)? y
+  merging emp1
+  merging emp2
+  merging emp3
+  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
+  [1]
+
+  $ hg rebase --abort
+  rebase aborted
+  $ cd ..
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1156,6 +1156,9 @@
 coreconfigitem('ui', 'remotecmd',
 default='hg',
 )
+coreconfigitem('ui', 'resolve.confirm',
+default=False,
+)
 coreconfigitem('ui', 'report_untrusted',
 default=True,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4528,10 +4528,15 @@
 """
 
 opts = pycompat.byteskwargs(opts)
+confirm = ui.configbool('ui', 'resolve.confirm')
 flaglist = 'all mark unmark list no_status'.split()
 all, mark, unmark, show, nostatus = \
 [opts.get(o) for o in flaglist]
 
+if confirm and not ui.promptchoice(_(b're-merge all unresolved files (yn)?'
+ b'$$  $$ ')):
+all = True
+
 if (show and (mark or unmark)) or (mark and unmark):
 raise error.Abort(_("too many options specified"))
 if pats and all:



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


D4102: resolve: support confirm config option with --unmark flag

2018-08-04 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9905.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4102?vs=9899=9905

REVISION DETAIL
  https://phab.mercurial-scm.org/D4102

AFFECTED FILES
  mercurial/commands.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -536,6 +536,35 @@
   R emp2
   R emp3
 
+Test that commands.resolve.confirm respect --unmark option (only when no 
patterns args are given):
+===
+
+  $ hg resolve -u emp1
+
+  $ hg resolve -l
+  U emp1
+  R emp2
+  R emp3
+
+  $ hg resolve -u << EOF
+  > n
+  > EOF
+  mark all resolved files as unresolved (yn)? n
+  abort: user quit
+  [255]
+
+  $ hg resolve -m << EOF
+  > y
+  > EOF
+  mark all unresolved files as resolved (yn)? y
+  (no more unresolved files)
+  continue: hg rebase --continue
+
+  $ hg resolve -l
+  R emp1
+  R emp2
+  R emp3
+
   $ hg rebase --abort
   rebase aborted
   $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4546,10 +4546,15 @@
 if not (all or pats or show or mark or unmark):
 raise error.Abort(_('no files or directories specified'),
  hint=('use --all to re-merge all unresolved files'))
+
 if mark and confirm and not pats:
 if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?'
  b'$$  $$ ')):
 raise error.Abort(_('user quit'))
+if unmark and confirm and not pats:
+if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?'
+ b'$$  $$ ')):
+raise error.Abort(_('user quit'))
 
 if show:
 ui.pager('resolve')



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


D4103: resolve: update commands.resolve.confirm help text

2018-08-04 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9906.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4103?vs=9900=9906

REVISION DETAIL
  https://phab.mercurial-scm.org/D4103

AFFECTED FILES
  mercurial/help/config.txt

CHANGE DETAILS

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -439,8 +439,7 @@
 
 
 ``resolve.confirm``
-Confirm before re-merging all unresolved files when running
-:hg:`resolve --all`.
+Confirm before performing action if no filename is passed.
 (default: False)
 
 ``status.relative``



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


D4101: resolve: support commands.resolve.confirm option with --mark flag

2018-08-04 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdb03e5cefc82: resolve: support commands.resolve.confirm 
option with --mark flag (authored by khanchi97, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D4101?vs=9898=9903#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4101?vs=9898=9903

REVISION DETAIL
  https://phab.mercurial-scm.org/D4101

AFFECTED FILES
  mercurial/commands.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -509,6 +509,33 @@
   warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
   [1]
 
+Test that commands.resolve.confirm respect --mark option (only when no 
patterns args are given):
+===
+
+  $ hg resolve -m emp1
+  $ hg resolve -l
+  R emp1
+  U emp2
+  U emp3
+
+  $ hg resolve -m << EOF
+  > n
+  > EOF
+  mark all unresolved files as resolved (yn)? n
+  abort: user quit
+  [255]
+
+  $ hg resolve -m << EOF
+  > y
+  > EOF
+  mark all unresolved files as resolved (yn)? y
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg resolve -l
+  R emp1
+  R emp2
+  R emp3
+
   $ hg rebase --abort
   rebase aborted
   $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4546,6 +4546,10 @@
 if not (all or pats or show or mark or unmark):
 raise error.Abort(_('no files or directories specified'),
  hint=('use --all to re-merge all unresolved files'))
+if mark and confirm and not pats:
+if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?'
+ b'$$  $$ ')):
+raise error.Abort(_('user quit'))
 
 if show:
 ui.pager('resolve')



To: khanchi97, #hg-reviewers, pulkit
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


  1   2   3   4   >