mercurial/commands.py
changeset 35497 b378a3d840ab
parent 35352 920cca6c8462
child 35517 ba0fb0e33c3a
equal deleted inserted replaced
35496:8bb90cc4668e 35497:b378a3d840ab
  1277     :``%b``: basename of the exporting repository
  1277     :``%b``: basename of the exporting repository
  1278 
  1278 
  1279     Returns 0 on success.
  1279     Returns 0 on success.
  1280     """
  1280     """
  1281     opts = pycompat.byteskwargs(opts)
  1281     opts = pycompat.byteskwargs(opts)
  1282     ctx = scmutil.revsingle(repo, opts.get('rev'))
  1282     rev = opts.get('rev')
       
  1283     repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
       
  1284     ctx = scmutil.revsingle(repo, rev)
  1283     m = scmutil.match(ctx, (file1,) + pats, opts)
  1285     m = scmutil.match(ctx, (file1,) + pats, opts)
  1284     fntemplate = opts.pop('output', '')
  1286     fntemplate = opts.pop('output', '')
  1285     if cmdutil.isstdiofilename(fntemplate):
  1287     if cmdutil.isstdiofilename(fntemplate):
  1286         fntemplate = ''
  1288         fntemplate = ''
  1287 
  1289 
  1838 
  1840 
  1839     if revs and change:
  1841     if revs and change:
  1840         msg = _('cannot specify --rev and --change at the same time')
  1842         msg = _('cannot specify --rev and --change at the same time')
  1841         raise error.Abort(msg)
  1843         raise error.Abort(msg)
  1842     elif change:
  1844     elif change:
       
  1845         repo = scmutil.unhidehashlikerevs(repo, [change], 'nowarn')
  1843         node2 = scmutil.revsingle(repo, change, None).node()
  1846         node2 = scmutil.revsingle(repo, change, None).node()
  1844         node1 = repo[node2].p1().node()
  1847         node1 = repo[node2].p1().node()
  1845     else:
  1848     else:
       
  1849         repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
  1846         node1, node2 = scmutil.revpair(repo, revs)
  1850         node1, node2 = scmutil.revpair(repo, revs)
  1847 
  1851 
  1848     if reverse:
  1852     if reverse:
  1849         node1, node2 = node2, node1
  1853         node1, node2 = node2, node1
  1850 
  1854 
  1924     """
  1928     """
  1925     opts = pycompat.byteskwargs(opts)
  1929     opts = pycompat.byteskwargs(opts)
  1926     changesets += tuple(opts.get('rev', []))
  1930     changesets += tuple(opts.get('rev', []))
  1927     if not changesets:
  1931     if not changesets:
  1928         changesets = ['.']
  1932         changesets = ['.']
       
  1933     repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
  1929     revs = scmutil.revrange(repo, changesets)
  1934     revs = scmutil.revrange(repo, changesets)
  1930     if not revs:
  1935     if not revs:
  1931         raise error.Abort(_("export requires at least one changeset"))
  1936         raise error.Abort(_("export requires at least one changeset"))
  1932     if len(revs) > 1:
  1937     if len(revs) > 1:
  1933         ui.note(_('exporting patches:\n'))
  1938         ui.note(_('exporting patches:\n'))
  1987     Returns 0 if a match is found, 1 otherwise.
  1992     Returns 0 if a match is found, 1 otherwise.
  1988 
  1993 
  1989     """
  1994     """
  1990 
  1995 
  1991     opts = pycompat.byteskwargs(opts)
  1996     opts = pycompat.byteskwargs(opts)
  1992     ctx = scmutil.revsingle(repo, opts.get('rev'), None)
  1997     rev = opts.get('rev')
       
  1998     repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
       
  1999     ctx = scmutil.revsingle(repo, rev, None)
  1993 
  2000 
  1994     end = '\n'
  2001     end = '\n'
  1995     if opts.get('print0'):
  2002     if opts.get('print0'):
  1996         end = '\0'
  2003         end = '\0'
  1997     fmt = '%s' + end
  2004     fmt = '%s' + end
  2584     Returns 0 if matching heads are found, 1 if not.
  2591     Returns 0 if matching heads are found, 1 if not.
  2585     """
  2592     """
  2586 
  2593 
  2587     opts = pycompat.byteskwargs(opts)
  2594     opts = pycompat.byteskwargs(opts)
  2588     start = None
  2595     start = None
  2589     if 'rev' in opts:
  2596     rev = opts.get('rev')
  2590         start = scmutil.revsingle(repo, opts['rev'], None).node()
  2597     if rev:
       
  2598         repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
       
  2599         start = scmutil.revsingle(repo, rev, None).node()
  2591 
  2600 
  2592     if opts.get('topo'):
  2601     if opts.get('topo'):
  2593         heads = [repo[h] for h in repo.heads(start)]
  2602         heads = [repo[h] for h in repo.heads(start)]
  2594     else:
  2603     else:
  2595         heads = []
  2604         heads = []
  2768                 output.append(bm)
  2777                 output.append(bm)
  2769 
  2778 
  2770         fm.data(node=hex(remoterev))
  2779         fm.data(node=hex(remoterev))
  2771         fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
  2780         fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
  2772     else:
  2781     else:
       
  2782         repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
  2773         ctx = scmutil.revsingle(repo, rev, None)
  2783         ctx = scmutil.revsingle(repo, rev, None)
  2774 
  2784 
  2775         if ctx.rev() is None:
  2785         if ctx.rev() is None:
  2776             ctx = repo[None]
  2786             ctx = repo[None]
  2777             parents = ctx.parents()
  2787             parents = ctx.parents()
  3393     if opts.get('graph'):
  3403     if opts.get('graph'):
  3394         if linerange:
  3404         if linerange:
  3395             raise error.Abort(_('graph not supported with line range patterns'))
  3405             raise error.Abort(_('graph not supported with line range patterns'))
  3396         return cmdutil.graphlog(ui, repo, pats, opts)
  3406         return cmdutil.graphlog(ui, repo, pats, opts)
  3397 
  3407 
       
  3408     repo = scmutil.unhidehashlikerevs(repo, opts.get('rev'), 'nowarn')
  3398     revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
  3409     revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
  3399     hunksfilter = None
  3410     hunksfilter = None
  3400 
  3411 
  3401     if linerange:
  3412     if linerange:
  3402         revs, lrfilematcher, hunksfilter = cmdutil.getloglinerangerevs(
  3413         revs, lrfilematcher, hunksfilter = cmdutil.getloglinerangerevs(
  3500     if not node:
  3511     if not node:
  3501         node = rev
  3512         node = rev
  3502 
  3513 
  3503     char = {'l': '@', 'x': '*', '': ''}
  3514     char = {'l': '@', 'x': '*', '': ''}
  3504     mode = {'l': '644', 'x': '755', '': '644'}
  3515     mode = {'l': '644', 'x': '755', '': '644'}
       
  3516     repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn')
  3505     ctx = scmutil.revsingle(repo, node)
  3517     ctx = scmutil.revsingle(repo, node)
  3506     mf = ctx.manifest()
  3518     mf = ctx.manifest()
  3507     ui.pager('manifest')
  3519     ui.pager('manifest')
  3508     for f in ctx:
  3520     for f in ctx:
  3509         fm.startitem()
  3521         fm.startitem()
  3687 
  3699 
  3688     Returns 0 on success.
  3700     Returns 0 on success.
  3689     """
  3701     """
  3690 
  3702 
  3691     opts = pycompat.byteskwargs(opts)
  3703     opts = pycompat.byteskwargs(opts)
  3692     ctx = scmutil.revsingle(repo, opts.get('rev'), None)
  3704     rev = opts.get('rev')
       
  3705     repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
       
  3706     ctx = scmutil.revsingle(repo, rev, None)
  3693 
  3707 
  3694     if file_:
  3708     if file_:
  3695         m = scmutil.match(ctx, (file_,), opts)
  3709         m = scmutil.match(ctx, (file_,), opts)
  3696         if m.anypats() or len(m.files()) != 1:
  3710         if m.anypats() or len(m.files()) != 1:
  3697             raise error.Abort(_('can only specify an explicit filename'))
  3711             raise error.Abort(_('can only specify an explicit filename'))
  4839         raise error.Abort(msg)
  4853         raise error.Abort(msg)
  4840     elif revs and terse:
  4854     elif revs and terse:
  4841         msg = _('cannot use --terse with --rev')
  4855         msg = _('cannot use --terse with --rev')
  4842         raise error.Abort(msg)
  4856         raise error.Abort(msg)
  4843     elif change:
  4857     elif change:
       
  4858         repo = scmutil.unhidehashlikerevs(repo, [change], 'nowarn')
  4844         node2 = scmutil.revsingle(repo, change, None).node()
  4859         node2 = scmutil.revsingle(repo, change, None).node()
  4845         node1 = repo[node2].p1().node()
  4860         node1 = repo[node2].p1().node()
  4846     else:
  4861     else:
       
  4862         repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
  4847         node1, node2 = scmutil.revpair(repo, revs)
  4863         node1, node2 = scmutil.revpair(repo, revs)
  4848 
  4864 
  4849     if pats or ui.configbool('commands', 'status.relative'):
  4865     if pats or ui.configbool('commands', 'status.relative'):
  4850         cwd = repo.getcwd()
  4866         cwd = repo.getcwd()
  4851     else:
  4867     else: