Patchwork convert: remove "replacecommitter" action

login
register
mail settings
Submitter Gregory Szorc
Date Jan. 14, 2017, 6:13 p.m.
Message ID <89faeae1411449e913ff.1484417608@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/18219/
State Accepted
Headers show

Comments

Gregory Szorc - Jan. 14, 2017, 6:13 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1484417479 28800
#      Sat Jan 14 10:11:19 2017 -0800
# Node ID 89faeae1411449e913ff0a397039e18f76872494
# Parent  2cbbd4622ab06cb0da1a165064720bbbebefa227
convert: remove "replacecommitter" action

As pointed out by Yuya, this action doesn't add much (any?) value.
Augie Fackler - Jan. 14, 2017, 10:36 p.m.
Queued this, thanks.

> On Jan 14, 2017, at 1:13 PM, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> 
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1484417479 28800
> #      Sat Jan 14 10:11:19 2017 -0800
> # Node ID 89faeae1411449e913ff0a397039e18f76872494
> # Parent  2cbbd4622ab06cb0da1a165064720bbbebefa227
> convert: remove "replacecommitter" action
> 
> As pointed out by Yuya, this action doesn't add much (any?) value.
> 
> diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
> --- a/hgext/convert/__init__.py
> +++ b/hgext/convert/__init__.py
> @@ -355,9 +355,6 @@ def convert(ui, src, dest=None, revmapfi
>         the committer. Other actions that add references to the committer
>         will still take effect when this is set.
> 
> -        ``replacecommitter`` will replace the value of the committer field
> -        with the author.
> -
>         The default is ``messagedifferent``.
> 
>     :convert.git.extrakeys: list of extra keys from commit metadata to copy to
> diff --git a/hgext/convert/git.py b/hgext/convert/git.py
> --- a/hgext/convert/git.py
> +++ b/hgext/convert/git.py
> @@ -133,28 +133,21 @@ class convert_git(common.converter_sourc
> 
>         dropcommitter = 'dropcommitter' in committeractions
>         replaceauthor = 'replaceauthor' in committeractions
> -        replacecommitter = 'replacecommitter' in committeractions
> 
> -        if dropcommitter and (replaceauthor or replacecommitter):
> +        if dropcommitter and replaceauthor:
>             raise error.Abort(_('committeractions cannot define both '
> -                                'dropcommitter and '
> -                                'replaceauthor/replacecommitter'))
> +                                'dropcommitter and replaceauthor'))
> 
>         if dropcommitter and messagealways:
>             raise error.Abort(_('committeractions cannot define both '
>                                 'dropcommitter and messagealways'))
> 
> -        if replaceauthor and replacecommitter:
> -            raise error.Abort(_('committeractions cannot define both '
> -                                'replaceauthor and replacecommitter'))
> -
>         if not messagedifferent and not messagealways:
>             messagedifferent = 'committer:'
> 
>         self.committeractions = {
>             'dropcommitter': dropcommitter,
>             'replaceauthor': replaceauthor,
> -            'replacecommitter': replacecommitter,
>             'messagedifferent': messagedifferent,
>             'messagealways': messagealways,
>         }
> @@ -368,9 +361,6 @@ class convert_git(common.converter_sourc
> 
>         if self.committeractions['dropcommitter']:
>             committer = None
> -
> -        if self.committeractions['replacecommitter']:
> -            committer = author
>         elif self.committeractions['replaceauthor']:
>             author = committer
> 
> diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t
> --- a/tests/test-convert-git.t
> +++ b/tests/test-convert-git.t
> @@ -491,12 +491,7 @@ Various combinations of committeractions
> 
>   $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
>   initializing destination bad-committer repository
> -  abort: committeractions cannot define both dropcommitter and replaceauthor/replacecommitter
> -  [255]
> -
> -  $ hg --config convert.git.committeractions=dropcommitter,replacecommitter convert git-repo4 bad-committer
> -  initializing destination bad-committer repository
> -  abort: committeractions cannot define both dropcommitter and replaceauthor/replacecommitter
> +  abort: committeractions cannot define both dropcommitter and replaceauthor
>   [255]
> 
>   $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
> @@ -504,11 +499,6 @@ Various combinations of committeractions
>   abort: committeractions cannot define both dropcommitter and messagealways
>   [255]
> 
> -  $ hg --config convert.git.committeractions=replaceauthor,replacecommitter convert git-repo4 bad-committer
> -  initializing destination bad-committer repository
> -  abort: committeractions cannot define both replaceauthor and replacecommitter
> -  [255]
> -
> custom prefix on messagedifferent works
> 
>   $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
> @@ -643,37 +633,6 @@ replaceauthor replaces author with commi
> 
> 
> 
> -replacecommitter replaces committer with author
> -
> -  $ hg --config convert.git.committeractions=replacecommitter convert git-repo4 git-repo4-hg-replacecommitter
> -  initializing destination git-repo4-hg-replacecommitter repository
> -  scanning source...
> -  sorting...
> -  converting...
> -  1 addfoo
> -  0 addfoo2
> -  updating bookmarks
> -
> -  $ hg -R git-repo4-hg-replacecommitter log -v
> -  changeset:   1:190b2da396cc
> -  bookmark:    master
> -  tag:         tip
> -  user:        nottest <test@example.org>
> -  date:        Mon Jan 01 00:00:21 2007 +0000
> -  files:       foo
> -  description:
> -  addfoo2
> -  
> -  
> -  changeset:   0:0735477b0224
> -  user:        test <test@example.org>
> -  date:        Mon Jan 01 00:00:20 2007 +0000
> -  files:       foo
> -  description:
> -  addfoo
> -  
> -  
> -
> dropcommitter removes the committer
> 
>   $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
> diff --git a/tests/test-convert.t b/tests/test-convert.t
> --- a/tests/test-convert.t
> +++ b/tests/test-convert.t
> @@ -297,9 +297,6 @@
>           committer. Other actions that add references to the committer will
>           still take effect when this is set.
> 
> -          "replacecommitter" will replace the value of the committer field with
> -          the author.
> -  
>           The default is "messagedifferent".
> 
>       convert.git.extrakeys
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -355,9 +355,6 @@  def convert(ui, src, dest=None, revmapfi
         the committer. Other actions that add references to the committer
         will still take effect when this is set.
 
-        ``replacecommitter`` will replace the value of the committer field
-        with the author.
-
         The default is ``messagedifferent``.
 
     :convert.git.extrakeys: list of extra keys from commit metadata to copy to
diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -133,28 +133,21 @@  class convert_git(common.converter_sourc
 
         dropcommitter = 'dropcommitter' in committeractions
         replaceauthor = 'replaceauthor' in committeractions
-        replacecommitter = 'replacecommitter' in committeractions
 
-        if dropcommitter and (replaceauthor or replacecommitter):
+        if dropcommitter and replaceauthor:
             raise error.Abort(_('committeractions cannot define both '
-                                'dropcommitter and '
-                                'replaceauthor/replacecommitter'))
+                                'dropcommitter and replaceauthor'))
 
         if dropcommitter and messagealways:
             raise error.Abort(_('committeractions cannot define both '
                                 'dropcommitter and messagealways'))
 
-        if replaceauthor and replacecommitter:
-            raise error.Abort(_('committeractions cannot define both '
-                                'replaceauthor and replacecommitter'))
-
         if not messagedifferent and not messagealways:
             messagedifferent = 'committer:'
 
         self.committeractions = {
             'dropcommitter': dropcommitter,
             'replaceauthor': replaceauthor,
-            'replacecommitter': replacecommitter,
             'messagedifferent': messagedifferent,
             'messagealways': messagealways,
         }
@@ -368,9 +361,6 @@  class convert_git(common.converter_sourc
 
         if self.committeractions['dropcommitter']:
             committer = None
-
-        if self.committeractions['replacecommitter']:
-            committer = author
         elif self.committeractions['replaceauthor']:
             author = committer
 
diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t
--- a/tests/test-convert-git.t
+++ b/tests/test-convert-git.t
@@ -491,12 +491,7 @@  Various combinations of committeractions
 
   $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
   initializing destination bad-committer repository
-  abort: committeractions cannot define both dropcommitter and replaceauthor/replacecommitter
-  [255]
-
-  $ hg --config convert.git.committeractions=dropcommitter,replacecommitter convert git-repo4 bad-committer
-  initializing destination bad-committer repository
-  abort: committeractions cannot define both dropcommitter and replaceauthor/replacecommitter
+  abort: committeractions cannot define both dropcommitter and replaceauthor
   [255]
 
   $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
@@ -504,11 +499,6 @@  Various combinations of committeractions
   abort: committeractions cannot define both dropcommitter and messagealways
   [255]
 
-  $ hg --config convert.git.committeractions=replaceauthor,replacecommitter convert git-repo4 bad-committer
-  initializing destination bad-committer repository
-  abort: committeractions cannot define both replaceauthor and replacecommitter
-  [255]
-
 custom prefix on messagedifferent works
 
   $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
@@ -643,37 +633,6 @@  replaceauthor replaces author with commi
   
   
 
-replacecommitter replaces committer with author
-
-  $ hg --config convert.git.committeractions=replacecommitter convert git-repo4 git-repo4-hg-replacecommitter
-  initializing destination git-repo4-hg-replacecommitter repository
-  scanning source...
-  sorting...
-  converting...
-  1 addfoo
-  0 addfoo2
-  updating bookmarks
-
-  $ hg -R git-repo4-hg-replacecommitter log -v
-  changeset:   1:190b2da396cc
-  bookmark:    master
-  tag:         tip
-  user:        nottest <test@example.org>
-  date:        Mon Jan 01 00:00:21 2007 +0000
-  files:       foo
-  description:
-  addfoo2
-  
-  
-  changeset:   0:0735477b0224
-  user:        test <test@example.org>
-  date:        Mon Jan 01 00:00:20 2007 +0000
-  files:       foo
-  description:
-  addfoo
-  
-  
-
 dropcommitter removes the committer
 
   $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
diff --git a/tests/test-convert.t b/tests/test-convert.t
--- a/tests/test-convert.t
+++ b/tests/test-convert.t
@@ -297,9 +297,6 @@ 
           committer. Other actions that add references to the committer will
           still take effect when this is set.
   
-          "replacecommitter" will replace the value of the committer field with
-          the author.
-  
           The default is "messagedifferent".
   
       convert.git.extrakeys