comparison mercurial/commands.py @ 35517:ba0fb0e33c3a

commands: check for empty rev before passing to scmutil.unhidehashlikerevs Differential Revision: https://phab.mercurial-scm.org/D1760
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 26 Dec 2017 22:54:45 +0530
parents b378a3d840ab
children 02fdb8c018aa
comparison
equal deleted inserted replaced
35516:6a1a0a023fc1 35517:ba0fb0e33c3a
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 rev = opts.get('rev') 1282 rev = opts.get('rev')
1283 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') 1283 if rev:
1284 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
1284 ctx = scmutil.revsingle(repo, rev) 1285 ctx = scmutil.revsingle(repo, rev)
1285 m = scmutil.match(ctx, (file1,) + pats, opts) 1286 m = scmutil.match(ctx, (file1,) + pats, opts)
1286 fntemplate = opts.pop('output', '') 1287 fntemplate = opts.pop('output', '')
1287 if cmdutil.isstdiofilename(fntemplate): 1288 if cmdutil.isstdiofilename(fntemplate):
1288 fntemplate = '' 1289 fntemplate = ''
1993 1994
1994 """ 1995 """
1995 1996
1996 opts = pycompat.byteskwargs(opts) 1997 opts = pycompat.byteskwargs(opts)
1997 rev = opts.get('rev') 1998 rev = opts.get('rev')
1998 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') 1999 if rev:
2000 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
1999 ctx = scmutil.revsingle(repo, rev, None) 2001 ctx = scmutil.revsingle(repo, rev, None)
2000 2002
2001 end = '\n' 2003 end = '\n'
2002 if opts.get('print0'): 2004 if opts.get('print0'):
2003 end = '\0' 2005 end = '\0'
2777 output.append(bm) 2779 output.append(bm)
2778 2780
2779 fm.data(node=hex(remoterev)) 2781 fm.data(node=hex(remoterev))
2780 fm.data(bookmarks=fm.formatlist(bms, name='bookmark')) 2782 fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
2781 else: 2783 else:
2782 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') 2784 if rev:
2785 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
2783 ctx = scmutil.revsingle(repo, rev, None) 2786 ctx = scmutil.revsingle(repo, rev, None)
2784 2787
2785 if ctx.rev() is None: 2788 if ctx.rev() is None:
2786 ctx = repo[None] 2789 ctx = repo[None]
2787 parents = ctx.parents() 2790 parents = ctx.parents()
3511 if not node: 3514 if not node:
3512 node = rev 3515 node = rev
3513 3516
3514 char = {'l': '@', 'x': '*', '': ''} 3517 char = {'l': '@', 'x': '*', '': ''}
3515 mode = {'l': '644', 'x': '755', '': '644'} 3518 mode = {'l': '644', 'x': '755', '': '644'}
3516 repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn') 3519 if node:
3520 repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn')
3517 ctx = scmutil.revsingle(repo, node) 3521 ctx = scmutil.revsingle(repo, node)
3518 mf = ctx.manifest() 3522 mf = ctx.manifest()
3519 ui.pager('manifest') 3523 ui.pager('manifest')
3520 for f in ctx: 3524 for f in ctx:
3521 fm.startitem() 3525 fm.startitem()
3700 Returns 0 on success. 3704 Returns 0 on success.
3701 """ 3705 """
3702 3706
3703 opts = pycompat.byteskwargs(opts) 3707 opts = pycompat.byteskwargs(opts)
3704 rev = opts.get('rev') 3708 rev = opts.get('rev')
3705 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') 3709 if rev:
3710 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
3706 ctx = scmutil.revsingle(repo, rev, None) 3711 ctx = scmutil.revsingle(repo, rev, None)
3707 3712
3708 if file_: 3713 if file_:
3709 m = scmutil.match(ctx, (file_,), opts) 3714 m = scmutil.match(ctx, (file_,), opts)
3710 if m.anypats() or len(m.files()) != 1: 3715 if m.anypats() or len(m.files()) != 1: