Patchwork D3871: rebase: improve output of --confirm option

login
register
mail settings
Submitter phabricator
Date July 1, 2018, 9:52 a.m.
Message ID <differential-rev-PHID-DREV-4tae777sfwv2bopugbiq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32542/
State Superseded
Headers show

Comments

phabricator - July 1, 2018, 9:52 a.m.
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




To: khanchi97, #hg-reviewers
Cc: mercurial-devel
phabricator - July 13, 2018, 2:02 p.m.
durin42 added a comment.


  This doesn't apply cleanly, could you rebase it?

INLINE COMMENTS

> rebase.py:975
>              with util.acceptintervention(dsguard):
> -                rbsrt._performrebase(tr)
> +                rbsrt._performrebase(tr, supprbinfo=supprbinfo)
>                  if not leaveunfinished:

I feel like the functions that accept supprbinfo should grow a docstring or comment that explains what supprbinfo does.

(I sort of figured it out, but it took a while.)

REPOSITORY
  rHG Mercurial

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

To: khanchi97, #hg-reviewers
Cc: durin42, mercurial-devel
phabricator - July 14, 2018, 6:07 a.m.
khanchi97 added a comment.


  In https://phab.mercurial-scm.org/D3871#61439, @durin42 wrote:
  
  > This doesn't apply cleanly, could you rebase it?
  
  
  @durin42 I have made a change in --confirm option https://phab.mercurial-scm.org/D3944 if this functionality (don't prompt if hit a conflict) is acceptable then we don't need this patch (i.e suppressing rebase info). Thanks!

INLINE COMMENTS

> durin42 wrote in rebase.py:975
> I feel like the functions that accept supprbinfo should grow a docstring or comment that explains what supprbinfo does.
> 
> (I sort of figured it out, but it took a while.)

yeah, next time I will take care of this.

REPOSITORY
  rHG Mercurial

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

To: khanchi97, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

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