Patchwork [4,of,5] histedit: sort commands

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 23, 2015, 9:10 a.m.
Message ID <eb5f4e0a1fe3638a7347.1450861802@waste.org>
Download mbox | patch
Permalink /patch/12289/
State Superseded
Headers show

Comments

timeless@mozdev.org - Dec. 23, 2015, 9:10 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450854991 0
#      Wed Dec 23 07:16:31 2015 +0000
# Node ID eb5f4e0a1fe3638a73475d1383ec8f67a3f55152
# Parent  b12320611f96ae46d8b7faa6436a2480792fdef1
histedit: sort commands
Gregory Szorc - Dec. 23, 2015, 7:23 p.m.
> On Dec 23, 2015, at 01:10, timeless <timeless@mozdev.org> wrote:
> 
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1450854991 0
> #      Wed Dec 23 07:16:31 2015 +0000
> # Node ID eb5f4e0a1fe3638a73475d1383ec8f67a3f55152
> # Parent  b12320611f96ae46d8b7faa6436a2480792fdef1
> histedit: sort commands
> 

I'm torn on this one: I think the most common action(s) should be first (pick). After that, I'm less sure.

> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -226,15 +226,15 @@
> # Commands:
> %s""")
>     verbs = (
> -"p, pick = %s" % _("use commit"),
> +"d, drop = %s" % _("remove commit from history"),
> "e, edit = %s" % _("use commit, but stop for amending"),
> "f, fold = %s" % _("use commit, but combine it with the one above"),
> +"m, mess = %s" % _("edit commit message without changing commit content"),
> +"p, pick = %s" % _("use commit"),
> "r, roll = %s" % _("like fold, but discard this commit's description"),
> -"d, drop = %s" % _("remove commit from history"),
> -"m, mess = %s" % _("edit commit message without changing commit content"),
> "",
> )
> -    verbs = ''.join(["#  %s\n" % l for l in verbs])
> +    verbs = ''.join(["#  %s\n" % l if l else '#\n' for l in verbs])
> 
>     return preamble % (first, last, verbs)
> 
> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
> --- a/tests/test-histedit-arguments.t
> +++ b/tests/test-histedit-arguments.t
> @@ -64,12 +64,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> 
> Run on a revision not ancestors of the current working directory.
> @@ -282,12 +282,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> 
> Test --continue with --keep
> diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
> --- a/tests/test-histedit-bookmark-motion.t
> +++ b/tests/test-histedit-bookmark-motion.t
> @@ -70,12 +70,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
>   $ hg histedit 1 --commands - --verbose << EOF | grep histedit
>> pick 177f92b77385 2 c
> @@ -130,12 +130,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
>   $ hg histedit 1 --commands - --verbose << EOF | grep histedit
>> pick b346ab9a313d 1 c
> diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
> --- a/tests/test-histedit-commute.t
> +++ b/tests/test-histedit-commute.t
> @@ -64,12 +64,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> 
> edit the history
> @@ -329,12 +329,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> 
> should also work if a commit message is missing
> diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
> --- a/tests/test-histedit-edit.t
> +++ b/tests/test-histedit-edit.t
> @@ -465,12 +465,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, fold = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, fold = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> TODO: this abort shouldn't be required, but it is for now to leave the repo in
> a clean state.
> diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
> --- a/tests/test-histedit-obsolete.t
> +++ b/tests/test-histedit-obsolete.t
> @@ -49,12 +49,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
>   $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
>> pick 177f92b77385 2 c
> diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t
> --- a/tests/test-histedit-outgoing.t
> +++ b/tests/test-histedit-outgoing.t
> @@ -46,12 +46,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
>   $ cd ..
> 
> @@ -77,12 +77,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
>   $ cd ..
> 
> @@ -100,12 +100,12 @@
>   # Commits are listed from least to most recent
>   #
>   # Commands:
> -  #  p, pick = use commit
> +  #  d, drop = remove commit from history
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  m, mess = edit commit message without changing commit content
> +  #  p, pick = use commit
>   #  r, roll = like fold, but discard this commit's description
> -  #  d, drop = remove commit from history
> -  #  m, mess = edit commit message without changing commit content
>   #
> 
> test to check number of roots in outgoing revisions
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -226,15 +226,15 @@ 
 # Commands:
 %s""")
     verbs = (
-"p, pick = %s" % _("use commit"),
+"d, drop = %s" % _("remove commit from history"),
 "e, edit = %s" % _("use commit, but stop for amending"),
 "f, fold = %s" % _("use commit, but combine it with the one above"),
+"m, mess = %s" % _("edit commit message without changing commit content"),
+"p, pick = %s" % _("use commit"),
 "r, roll = %s" % _("like fold, but discard this commit's description"),
-"d, drop = %s" % _("remove commit from history"),
-"m, mess = %s" % _("edit commit message without changing commit content"),
 "",
 )
-    verbs = ''.join(["#  %s\n" % l for l in verbs])
+    verbs = ''.join(["#  %s\n" % l if l else '#\n' for l in verbs])
 
     return preamble % (first, last, verbs)
 
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -64,12 +64,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 
 Run on a revision not ancestors of the current working directory.
@@ -282,12 +282,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 
 Test --continue with --keep
diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t
+++ b/tests/test-histedit-bookmark-motion.t
@@ -70,12 +70,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
   $ hg histedit 1 --commands - --verbose << EOF | grep histedit
   > pick 177f92b77385 2 c
@@ -130,12 +130,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
   $ hg histedit 1 --commands - --verbose << EOF | grep histedit
   > pick b346ab9a313d 1 c
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -64,12 +64,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 
 edit the history
@@ -329,12 +329,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 
 should also work if a commit message is missing
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -465,12 +465,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, fold = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, fold = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 TODO: this abort shouldn't be required, but it is for now to leave the repo in
 a clean state.
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -49,12 +49,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
   $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
   > pick 177f92b77385 2 c
diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t
--- a/tests/test-histedit-outgoing.t
+++ b/tests/test-histedit-outgoing.t
@@ -46,12 +46,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
   $ cd ..
 
@@ -77,12 +77,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
   $ cd ..
 
@@ -100,12 +100,12 @@ 
   # Commits are listed from least to most recent
   #
   # Commands:
-  #  p, pick = use commit
+  #  d, drop = remove commit from history
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
   #  r, roll = like fold, but discard this commit's description
-  #  d, drop = remove commit from history
-  #  m, mess = edit commit message without changing commit content
   #
 
 test to check number of roots in outgoing revisions