Patchwork [6,of,8] bisect: factor commonly update sequence

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 9, 2016, 8:57 a.m.
Message ID <eb7d02debaf5ed831f12.1476003460@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16978/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Pierre-Yves David - Oct. 9, 2016, 8:57 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1472007886 -7200
#      Wed Aug 24 05:04:46 2016 +0200
# Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143
# Parent  45469b6da789e8d07251c49f41cfef45fc3eba3b
# EXP-Topic bisect
bisect: factor commonly update sequence

For now, This remains a closure in the module to avoid circular import with used
module.
Yuya Nishihara - Oct. 9, 2016, 8:40 p.m.
On Sun, 09 Oct 2016 10:57:40 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1472007886 -7200
> #      Wed Aug 24 05:04:46 2016 +0200
> # Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143
> # Parent  45469b6da789e8d07251c49f41cfef45fc3eba3b
> # EXP-Topic bisect
> bisect: factor commonly update sequence
> 
> For now, This remains a closure in the module to avoid circular import with used
> module.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -872,6 +872,13 @@ def bisect(ui, repo, rev=None, extra=Non
>          if not (state['good'] and state['bad']):
>              return
>  
> +    def mayupdate(repo, node, show_stats=True):
> +        """common used update sequence"""
> +        if noupdate:
> +            return
> +        cmdutil.bailifchanged(repo)
> +        return hg.clean(repo, node, show_stats=show_stats)

>      if changesets == 0:
> @@ -954,9 +956,7 @@ def bisect(ui, repo, rev=None, extra=Non
>                   % (rev, short(node), changesets, tests))
>          state['current'] = [node]
>          hbisect.save_state(repo, state)
> -        if not noupdate:
> -            cmdutil.bailifchanged(repo)
> -            return hg.clean(repo, node)
> +        mayupdate(repo, node)

Missed return value.

Other than that, the patch 1-7 look good to me. Should I fix that in flight?
Pierre-Yves David - Oct. 10, 2016, 2:32 a.m.
On 10/09/2016 10:40 PM, Yuya Nishihara wrote:
> On Sun, 09 Oct 2016 10:57:40 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1472007886 -7200
>> #      Wed Aug 24 05:04:46 2016 +0200
>> # Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143
>> # Parent  45469b6da789e8d07251c49f41cfef45fc3eba3b
>> # EXP-Topic bisect
>> bisect: factor commonly update sequence
>>
>> For now, This remains a closure in the module to avoid circular import with used
>> module.
>>
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -872,6 +872,13 @@ def bisect(ui, repo, rev=None, extra=Non
>>          if not (state['good'] and state['bad']):
>>              return
>>
>> +    def mayupdate(repo, node, show_stats=True):
>> +        """common used update sequence"""
>> +        if noupdate:
>> +            return
>> +        cmdutil.bailifchanged(repo)
>> +        return hg.clean(repo, node, show_stats=show_stats)
>
>>      if changesets == 0:
>> @@ -954,9 +956,7 @@ def bisect(ui, repo, rev=None, extra=Non
>>                   % (rev, short(node), changesets, tests))
>>          state['current'] = [node]
>>          hbisect.save_state(repo, state)
>> -        if not noupdate:
>> -            cmdutil.bailifchanged(repo)
>> -            return hg.clean(repo, node)
>> +        mayupdate(repo, node)
>
> Missed return value.
>
> Other than that, the patch 1-7 look good to me. Should I fix that in flight?

Good catch, if you can fix it in flight, that would be great. (I can 
reset from patch 6 if that is easier for you)

Cheers,
Yuya Nishihara - Oct. 10, 2016, 5:38 a.m.
On Mon, 10 Oct 2016 04:32:30 +0200, Pierre-Yves David wrote:
> On 10/09/2016 10:40 PM, Yuya Nishihara wrote:
> > On Sun, 09 Oct 2016 10:57:40 +0200, Pierre-Yves David wrote:
> >> # HG changeset patch
> >> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> >> # Date 1472007886 -7200
> >> #      Wed Aug 24 05:04:46 2016 +0200
> >> # Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143
> >> # Parent  45469b6da789e8d07251c49f41cfef45fc3eba3b
> >> # EXP-Topic bisect
> >> bisect: factor commonly update sequence
> >>
> >> For now, This remains a closure in the module to avoid circular import with used
> >> module.
> >>
> >> diff --git a/mercurial/commands.py b/mercurial/commands.py
> >> --- a/mercurial/commands.py
> >> +++ b/mercurial/commands.py
> >> @@ -872,6 +872,13 @@ def bisect(ui, repo, rev=None, extra=Non
> >>          if not (state['good'] and state['bad']):
> >>              return
> >>
> >> +    def mayupdate(repo, node, show_stats=True):
> >> +        """common used update sequence"""
> >> +        if noupdate:
> >> +            return
> >> +        cmdutil.bailifchanged(repo)
> >> +        return hg.clean(repo, node, show_stats=show_stats)
> >
> >>      if changesets == 0:
> >> @@ -954,9 +956,7 @@ def bisect(ui, repo, rev=None, extra=Non
> >>                   % (rev, short(node), changesets, tests))
> >>          state['current'] = [node]
> >>          hbisect.save_state(repo, state)
> >> -        if not noupdate:
> >> -            cmdutil.bailifchanged(repo)
> >> -            return hg.clean(repo, node)
> >> +        mayupdate(repo, node)
> >
> > Missed return value.
> >
> > Other than that, the patch 1-7 look good to me. Should I fix that in flight?
> 
> Good catch, if you can fix it in flight, that would be great. (I can 
> reset from patch 6 if that is easier for you)

Fixed in flight and queued 1-7, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -872,6 +872,13 @@  def bisect(ui, repo, rev=None, extra=Non
         if not (state['good'] and state['bad']):
             return
 
+    def mayupdate(repo, node, show_stats=True):
+        """common used update sequence"""
+        if noupdate:
+            return
+        cmdutil.bailifchanged(repo)
+        return hg.clean(repo, node, show_stats=show_stats)
+
     if command:
         changesets = 1
         if noupdate:
@@ -910,9 +917,7 @@  def bisect(ui, repo, rev=None, extra=Non
                 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
                 # update to next check
                 node = nodes[0]
-                if not noupdate:
-                    cmdutil.bailifchanged(repo)
-                    hg.clean(repo, node, show_stats=False)
+                mayupdate(repo, node, show_stats=False)
         finally:
             state['current'] = [node]
             hbisect.save_state(repo, state)
@@ -932,10 +937,7 @@  def bisect(ui, repo, rev=None, extra=Non
                          % (extendnode.rev(), extendnode))
                 state['current'] = [extendnode.node()]
                 hbisect.save_state(repo, state)
-                if noupdate:
-                    return
-                cmdutil.bailifchanged(repo)
-                return hg.clean(repo, extendnode.node())
+                return mayupdate(repo, extendnode.node())
         raise error.Abort(_("nothing to extend"))
 
     if changesets == 0:
@@ -954,9 +956,7 @@  def bisect(ui, repo, rev=None, extra=Non
                  % (rev, short(node), changesets, tests))
         state['current'] = [node]
         hbisect.save_state(repo, state)
-        if not noupdate:
-            cmdutil.bailifchanged(repo)
-            return hg.clean(repo, node)
+        mayupdate(repo, node)
 
 @command('bookmarks|bookmark',
     [('f', 'force', False, _('force')),