hgext/mq.py
changeset 13373 900a92862a7b
parent 13327 dc11e30b48a3
parent 13369 69238d0ca60f
child 13400 14f3795a5ed7
equal deleted inserted replaced
13372:5bced0d28a39 13373:900a92862a7b
  1059             # patch is B. qpush C should be performed (moving forward)
  1059             # patch is B. qpush C should be performed (moving forward)
  1060             # qpush B is a NOP (no change) qpush A is an error (can't
  1060             # qpush B is a NOP (no change) qpush A is an error (can't
  1061             # go backwards with qpush)
  1061             # go backwards with qpush)
  1062             if patch:
  1062             if patch:
  1063                 info = self.isapplied(patch)
  1063                 info = self.isapplied(patch)
  1064                 if info:
  1064                 if info and info[0] >= len(self.applied) - 1:
  1065                     if info[0] < len(self.applied) - 1:
       
  1066                         raise util.Abort(
       
  1067                             _("cannot push to a previous patch: %s") % patch)
       
  1068                     self.ui.warn(
  1065                     self.ui.warn(
  1069                         _('qpush: %s is already at the top\n') % patch)
  1066                         _('qpush: %s is already at the top\n') % patch)
  1070                     return 0
  1067                     return 0
       
  1068 
  1071                 pushable, reason = self.pushable(patch)
  1069                 pushable, reason = self.pushable(patch)
  1072                 if not pushable:
  1070                 if pushable:
       
  1071                     if self.series.index(patch) < self.series_end():
       
  1072                         raise util.Abort(
       
  1073                             _("cannot push to a previous patch: %s") % patch)
       
  1074                 else:
  1073                     if reason:
  1075                     if reason:
  1074                         reason = _('guarded by %r') % reason
  1076                         reason = _('guarded by %r') % reason
  1075                     else:
  1077                     else:
  1076                         reason = _('no matching guards')
  1078                         reason = _('no matching guards')
  1077                     self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason))
  1079                     self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason))