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


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


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

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

REPOSITORY
  rHG Mercurial

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

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 bechanged
   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 bechanged
   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 bechanged
   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 bechanged
   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
@@ -820,14 +820,18 @@
 
 if dryrun:
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+ui.status(_('starting dry-run rebase; repository will not be'
+'changed\n'))
+
 with repo.wlock(), repo.lock():
 try:
 _dryrunrebase(ui, repo, rbsrt, **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'))
+ui.status(_('dry-run rebase completed successfully; run 
without'
+' -n/--dry-run to perform this rebase\n'))
 return 0
 finally:
 # no need to store back in case of dry-run



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-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 

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:
  

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


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-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, 

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


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

2018-06-18 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In https://phab.mercurial-scm.org/D3764#59425, @pulkit wrote:
  
  > Thinking out loud here: I see that `--dry-run` for rebase will be very 
useful for automation. How about returning 1 when there are conflicts and 
returning 0 when there are no conflicts? Also maybe we should add formatter 
support to the dry-run output for each command so that automation can read the 
JSON output and tell user what can happen.
  
  
  I approve of both of these feature suggestions! However, they should be 
implemented in standalone changesets and not incorporated into this one.

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-18 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Thinking out loud here: I see that `--dry-run` for rebase will be very useful 
for automation. How about returning 1 when there are conflicts and returning 0 
when there are no conflicts? Also maybe we should add formatter support to the 
dry-run output for each command so that automation can read the JSON output and 
tell user what can happen.

REPOSITORY
  rHG Mercurial

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

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-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 @@