mercurial/cmdutil.py
changeset 43117 8ff1ecfadcd1
parent 43106 d783f945a701
child 43491 9391784299e9
equal deleted inserted replaced
43116:defabf63e969 43117:8ff1ecfadcd1
   255 
   255 
   256     The return value indicates that ``rewrite.update-timestamp`` is the reason
   256     The return value indicates that ``rewrite.update-timestamp`` is the reason
   257     the ``date`` option is set.
   257     the ``date`` option is set.
   258     """
   258     """
   259     if opts.get(b'date') and opts.get(b'currentdate'):
   259     if opts.get(b'date') and opts.get(b'currentdate'):
   260         raise error.Abort(
   260         raise error.Abort(_(b'--date and --currentdate are mutually exclusive'))
   261             _(b'--date and --currentdate are mutually ' b'exclusive')
       
   262         )
       
   263     if opts.get(b'user') and opts.get(b'currentuser'):
   261     if opts.get(b'user') and opts.get(b'currentuser'):
   264         raise error.Abort(
   262         raise error.Abort(_(b'--user and --currentuser are mutually exclusive'))
   265             _(b'--user and --currentuser are mutually ' b'exclusive')
       
   266         )
       
   267 
   263 
   268     datemaydiffer = False  # date-only change should be ignored?
   264     datemaydiffer = False  # date-only change should be ignored?
   269 
   265 
   270     if opts.get(b'currentdate'):
   266     if opts.get(b'currentdate'):
   271         opts[b'date'] = b'%d %d' % dateutil.makedate()
   267         opts[b'date'] = b'%d %d' % dateutil.makedate()
  1008     message = opts.get(b'message')
  1004     message = opts.get(b'message')
  1009     logfile = opts.get(b'logfile')
  1005     logfile = opts.get(b'logfile')
  1010 
  1006 
  1011     if message and logfile:
  1007     if message and logfile:
  1012         raise error.Abort(
  1008         raise error.Abort(
  1013             _(b'options --message and --logfile are mutually ' b'exclusive')
  1009             _(b'options --message and --logfile are mutually exclusive')
  1014         )
  1010         )
  1015     if not message and logfile:
  1011     if not message and logfile:
  1016         try:
  1012         try:
  1017             if isstdiofilename(logfile):
  1013             if isstdiofilename(logfile):
  1018                 message = ui.fin.read()
  1014                 message = ui.fin.read()
  1178                 newname.append(stringutil.escapestr(pat[i:end]))
  1174                 newname.append(stringutil.escapestr(pat[i:end]))
  1179                 break
  1175                 break
  1180             newname.append(stringutil.escapestr(pat[i:n]))
  1176             newname.append(stringutil.escapestr(pat[i:n]))
  1181             if n + 2 > end:
  1177             if n + 2 > end:
  1182                 raise error.Abort(
  1178                 raise error.Abort(
  1183                     _(b"incomplete format spec in output " b"filename")
  1179                     _(b"incomplete format spec in output filename")
  1184                 )
  1180                 )
  1185             c = pat[n + 1 : n + 2]
  1181             c = pat[n + 1 : n + 2]
  1186             i = n + 2
  1182             i = n + 2
  1187             try:
  1183             try:
  1188                 newname.append(expander[c])
  1184                 newname.append(expander[c])
  1189             except KeyError:
  1185             except KeyError:
  1190                 raise error.Abort(
  1186                 raise error.Abort(
  1191                     _(b"invalid format spec '%%%s' in output " b"filename") % c
  1187                     _(b"invalid format spec '%%%s' in output filename") % c
  1192                 )
  1188                 )
  1193     return b''.join(newname)
  1189     return b''.join(newname)
  1194 
  1190 
  1195 
  1191 
  1196 def makefilename(ctx, pat, **props):
  1192 def makefilename(ctx, pat, **props):
  2262         # We have to read the changelog to match filenames against
  2258         # We have to read the changelog to match filenames against
  2263         # changed files
  2259         # changed files
  2264 
  2260 
  2265         if follow:
  2261         if follow:
  2266             raise error.Abort(
  2262             raise error.Abort(
  2267                 _(b'can only follow copies/renames for explicit ' b'filenames')
  2263                 _(b'can only follow copies/renames for explicit filenames')
  2268             )
  2264             )
  2269 
  2265 
  2270         # The slow path checks files modified in every changeset.
  2266         # The slow path checks files modified in every changeset.
  2271         # This is really slow on large repos, so compute the set lazily.
  2267         # This is really slow on large repos, so compute the set lazily.
  2272         class lazywantedset(object):
  2268         class lazywantedset(object):