hgext/convert/git.py
changeset 30815 c5bf2e8ec18c
parent 30813 2cbbd4622ab0
child 32331 bd872f64a8ba
equal deleted inserted replaced
30814:b96c57c1f860 30815:c5bf2e8ec18c
   131             raise error.Abort(_('committeractions cannot define both '
   131             raise error.Abort(_('committeractions cannot define both '
   132                                 'messagedifferent and messagealways'))
   132                                 'messagedifferent and messagealways'))
   133 
   133 
   134         dropcommitter = 'dropcommitter' in committeractions
   134         dropcommitter = 'dropcommitter' in committeractions
   135         replaceauthor = 'replaceauthor' in committeractions
   135         replaceauthor = 'replaceauthor' in committeractions
   136         replacecommitter = 'replacecommitter' in committeractions
   136 
   137 
   137         if dropcommitter and replaceauthor:
   138         if dropcommitter and (replaceauthor or replacecommitter):
       
   139             raise error.Abort(_('committeractions cannot define both '
   138             raise error.Abort(_('committeractions cannot define both '
   140                                 'dropcommitter and '
   139                                 'dropcommitter and replaceauthor'))
   141                                 'replaceauthor/replacecommitter'))
       
   142 
   140 
   143         if dropcommitter and messagealways:
   141         if dropcommitter and messagealways:
   144             raise error.Abort(_('committeractions cannot define both '
   142             raise error.Abort(_('committeractions cannot define both '
   145                                 'dropcommitter and messagealways'))
   143                                 'dropcommitter and messagealways'))
   146 
   144 
   147         if replaceauthor and replacecommitter:
       
   148             raise error.Abort(_('committeractions cannot define both '
       
   149                                 'replaceauthor and replacecommitter'))
       
   150 
       
   151         if not messagedifferent and not messagealways:
   145         if not messagedifferent and not messagealways:
   152             messagedifferent = 'committer:'
   146             messagedifferent = 'committer:'
   153 
   147 
   154         self.committeractions = {
   148         self.committeractions = {
   155             'dropcommitter': dropcommitter,
   149             'dropcommitter': dropcommitter,
   156             'replaceauthor': replaceauthor,
   150             'replaceauthor': replaceauthor,
   157             'replacecommitter': replacecommitter,
       
   158             'messagedifferent': messagedifferent,
   151             'messagedifferent': messagedifferent,
   159             'messagealways': messagealways,
   152             'messagealways': messagealways,
   160         }
   153         }
   161 
   154 
   162     def after(self):
   155     def after(self):
   366             if n in self.copyextrakeys:
   359             if n in self.copyextrakeys:
   367                 extra[n] = v
   360                 extra[n] = v
   368 
   361 
   369         if self.committeractions['dropcommitter']:
   362         if self.committeractions['dropcommitter']:
   370             committer = None
   363             committer = None
   371 
       
   372         if self.committeractions['replacecommitter']:
       
   373             committer = author
       
   374         elif self.committeractions['replaceauthor']:
   364         elif self.committeractions['replaceauthor']:
   375             author = committer
   365             author = committer
   376 
   366 
   377         if committer:
   367         if committer:
   378             messagealways = self.committeractions['messagealways']
   368             messagealways = self.committeractions['messagealways']