comparison mercurial/commands.py @ 44885:aac816f584ad

diff: use cmdutil.check_at_most_one_arg() for checking --rev/--change The same check was done in extdiff as well, so I fixed that too. There are apparently no tests for this. Differential Revision: https://phab.mercurial-scm.org/D8510
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 08 May 2020 08:50:47 -0700
parents a9ff0742c8ea
children 07a6a29d25ea
comparison
equal deleted inserted replaced
44884:16596f5e1afa 44885:aac816f584ad
2473 hg diff -r 9353^2:9353 # compare against the second parent 2473 hg diff -r 9353^2:9353 # compare against the second parent
2474 2474
2475 Returns 0 on success. 2475 Returns 0 on success.
2476 """ 2476 """
2477 2477
2478 cmdutil.check_at_most_one_arg(opts, 'rev', 'change')
2478 opts = pycompat.byteskwargs(opts) 2479 opts = pycompat.byteskwargs(opts)
2479 revs = opts.get(b'rev') 2480 revs = opts.get(b'rev')
2480 change = opts.get(b'change') 2481 change = opts.get(b'change')
2481 stat = opts.get(b'stat') 2482 stat = opts.get(b'stat')
2482 reverse = opts.get(b'reverse') 2483 reverse = opts.get(b'reverse')
2483 2484
2484 if revs and change: 2485 if change:
2485 msg = _(b'cannot specify --rev and --change at the same time')
2486 raise error.Abort(msg)
2487 elif change:
2488 repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn') 2486 repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn')
2489 ctx2 = scmutil.revsingle(repo, change, None) 2487 ctx2 = scmutil.revsingle(repo, change, None)
2490 ctx1 = ctx2.p1() 2488 ctx1 = ctx2.p1()
2491 else: 2489 else:
2492 repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') 2490 repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn')