hgext/mq.py
changeset 14464 00256f689f9c
parent 14448 7d367e8f892d
child 14468 755aabb3eada
equal deleted inserted replaced
14463:81f559d1b9b2 14464:00256f689f9c
   453         if not patchguards:
   453         if not patchguards:
   454             return True, None
   454             return True, None
   455         guards = self.active()
   455         guards = self.active()
   456         exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards]
   456         exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards]
   457         if exactneg:
   457         if exactneg:
   458             return False, exactneg[0]
   458             return False, repr(exactneg[0])
   459         pos = [g for g in patchguards if g[0] == '+']
   459         pos = [g for g in patchguards if g[0] == '+']
   460         exactpos = [g for g in pos if g[1:] in guards]
   460         exactpos = [g for g in pos if g[1:] in guards]
   461         if pos:
   461         if pos:
   462             if exactpos:
   462             if exactpos:
   463                 return True, exactpos[0]
   463                 return True, repr(exactpos[0])
   464             return False, pos
   464             return False, ' '.join(map(repr, pos))
   465         return True, ''
   465         return True, ''
   466 
   466 
   467     def explain_pushable(self, idx, all_patches=False):
   467     def explain_pushable(self, idx, all_patches=False):
   468         write = all_patches and self.ui.write or self.ui.warn
   468         write = all_patches and self.ui.write or self.ui.warn
   469         if all_patches or self.ui.verbose:
   469         if all_patches or self.ui.verbose:
   477                 else:
   477                 else:
   478                     if not why:
   478                     if not why:
   479                         write(_('allowing %s - no matching negative guards\n') %
   479                         write(_('allowing %s - no matching negative guards\n') %
   480                               self.series[idx])
   480                               self.series[idx])
   481                     else:
   481                     else:
   482                         write(_('allowing %s - guarded by %r\n') %
   482                         write(_('allowing %s - guarded by %s\n') %
   483                               (self.series[idx], why))
   483                               (self.series[idx], why))
   484             if not pushable:
   484             if not pushable:
   485                 if why:
   485                 if why:
   486                     write(_('skipping %s - guarded by %r\n') %
   486                     write(_('skipping %s - guarded by %s\n') %
   487                           (self.series[idx], why))
   487                           (self.series[idx], why))
   488                 else:
   488                 else:
   489                     write(_('skipping %s - no matching guards\n') %
   489                     write(_('skipping %s - no matching guards\n') %
   490                           self.series[idx])
   490                           self.series[idx])
   491 
   491 
  1112                     if self.series.index(patch) < self.series_end():
  1112                     if self.series.index(patch) < self.series_end():
  1113                         raise util.Abort(
  1113                         raise util.Abort(
  1114                             _("cannot push to a previous patch: %s") % patch)
  1114                             _("cannot push to a previous patch: %s") % patch)
  1115                 else:
  1115                 else:
  1116                     if reason:
  1116                     if reason:
  1117                         reason = _('guarded by %r') % reason
  1117                         reason = _('guarded by %s') % reason
  1118                     else:
  1118                     else:
  1119                         reason = _('no matching guards')
  1119                         reason = _('no matching guards')
  1120                     self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason))
  1120                     self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason))
  1121                     return 1
  1121                     return 1
  1122             elif all:
  1122             elif all: