Patchwork [2,of,2] crecord: cleanup the remains of commit confirmation

login
register
mail settings
Submitter Pierre-Yves David
Date April 14, 2016, 9:08 a.m.
Message ID <8ff3041c3862ec357930.1460624884@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/14605/
State Accepted
Delegated to: Matt Mackall
Headers show

Comments

Pierre-Yves David - April 14, 2016, 9:08 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1460623049 25200
#      Thu Apr 14 01:37:29 2016 -0700
# Node ID 8ff3041c3862ec357930d6756dcb75efef804bd3
# Parent  e0fa2da7f3c18a2ba980fdfe829a322c7e88f446
crecord: cleanup the remains of commit confirmation

The confirmation screen is now only used for the 'review' option we simplify
the code and rename the function.
Simon Farnsworth - April 14, 2016, 10:19 a.m.
Both patches look good to me.

On 14/04/2016 10:08, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1460623049 25200
> #      Thu Apr 14 01:37:29 2016 -0700
> # Node ID 8ff3041c3862ec357930d6756dcb75efef804bd3
> # Parent  e0fa2da7f3c18a2ba980fdfe829a322c7e88f446
> crecord: cleanup the remains of commit confirmation
>
> The confirmation screen is now only used for the 'review' option we simplify
> the code and rename the function.
>
> diff -r e0fa2da7f3c1 -r 8ff3041c3862 mercurial/crecord.py
> --- a/mercurial/crecord.py	Thu Apr 14 01:27:18 2016 -0700
> +++ b/mercurial/crecord.py	Thu Apr 14 01:37:29 2016 -0700
> @@ -1417,11 +1417,10 @@
>
>           return response
>
> -    def confirmcommit(self, review=False):
> +    def reviewcommit(self):
>           """ask for 'y' to be pressed to confirm selected. return True if
>           confirmed."""
> -        if review:
> -            confirmtext = (
> +        confirmtext = (
>   """if you answer yes to the following, the your currently chosen patch chunks
>   will be loaded into an editor.  you may modify the patch from the editor, and
>   save the changes if you wish to change the patch.  otherwise, you can just
> @@ -1432,10 +1431,6 @@
>
>   are you sure you want to review/edit and confirm the selected changes [yn]?
>   """)
> -        else:
> -            confirmtext = (
> -                "are you sure you want to confirm the selected changes [yn]? ")
> -
>           response = self.confirmationwindow(confirmtext)
>           if response is None:
>               response = "n"
> @@ -1604,7 +1599,7 @@
>           elif test and keypressed in ['X']:
>               return True
>           elif keypressed in ["r"]:
> -            if self.confirmcommit(review=True):
> +            if self.reviewcommit():
>                   self.opts['review'] = True
>                   return True
>           elif test and keypressed in ['R']:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=CwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=mEgSWILcY4c4W3zjApBQLA&m=x1c3JPNgKI7hKRRp4brbBxrRve0dO1C4T5FryncOJIs&s=DwYBPeqyWdIpYrIKWTVJ62y2PX-T4s_799e9CxktVSQ&e=
>
Sean Farley - April 14, 2016, 4:36 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1460623049 25200
> #      Thu Apr 14 01:37:29 2016 -0700
> # Node ID 8ff3041c3862ec357930d6756dcb75efef804bd3
> # Parent  e0fa2da7f3c18a2ba980fdfe829a322c7e88f446
> crecord: cleanup the remains of commit confirmation
>
> The confirmation screen is now only used for the 'review' option we simplify
> the code and rename the function.

I also did not like the extra (worthless) confirmation. Thanks for
following up!
Matt Mackall - April 15, 2016, 8:21 p.m.
On Thu, 2016-04-14 at 02:08 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1460623049 25200
> #      Thu Apr 14 01:37:29 2016 -0700
> # Node ID 8ff3041c3862ec357930d6756dcb75efef804bd3
> # Parent  e0fa2da7f3c18a2ba980fdfe829a322c7e88f446
> crecord: cleanup the remains of commit confirmation

These are queued for default, thanks.

-- 
Mathematics is the supreme nostalgia of our time.
Ryan McElroy - April 27, 2016, 6:27 p.m.
On 4/15/2016 9:21 PM, Matt Mackall wrote:
> On Thu, 2016-04-14 at 02:08 -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1460623049 25200
>> #      Thu Apr 14 01:37:29 2016 -0700
>> # Node ID 8ff3041c3862ec357930d6756dcb75efef804bd3
>> # Parent  e0fa2da7f3c18a2ba980fdfe829a322c7e88f446
>> crecord: cleanup the remains of commit confirmation
> These are queued for default, thanks.
>
>

Thanks marmoute for the follow-up!

Patch

diff -r e0fa2da7f3c1 -r 8ff3041c3862 mercurial/crecord.py
--- a/mercurial/crecord.py	Thu Apr 14 01:27:18 2016 -0700
+++ b/mercurial/crecord.py	Thu Apr 14 01:37:29 2016 -0700
@@ -1417,11 +1417,10 @@ 
 
         return response
 
-    def confirmcommit(self, review=False):
+    def reviewcommit(self):
         """ask for 'y' to be pressed to confirm selected. return True if
         confirmed."""
-        if review:
-            confirmtext = (
+        confirmtext = (
 """if you answer yes to the following, the your currently chosen patch chunks
 will be loaded into an editor.  you may modify the patch from the editor, and
 save the changes if you wish to change the patch.  otherwise, you can just
@@ -1432,10 +1431,6 @@ 
 
 are you sure you want to review/edit and confirm the selected changes [yn]?
 """)
-        else:
-            confirmtext = (
-                "are you sure you want to confirm the selected changes [yn]? ")
-
         response = self.confirmationwindow(confirmtext)
         if response is None:
             response = "n"
@@ -1604,7 +1599,7 @@ 
         elif test and keypressed in ['X']:
             return True
         elif keypressed in ["r"]:
-            if self.confirmcommit(review=True):
+            if self.reviewcommit():
                 self.opts['review'] = True
                 return True
         elif test and keypressed in ['R']: