##// END OF EJS Templates
diff: use cmdutil.check_at_most_one_arg() for checking --rev/--change...
Martin von Zweigbergk -
r45322:aac816f5 default
parent child Browse files
Show More
@@ -360,14 +360,12 b' def dodiff(ui, repo, cmdline, pats, opts'
360 - just invoke the diff for a single file in the working dir
360 - just invoke the diff for a single file in the working dir
361 '''
361 '''
362
362
363 cmdutil.check_at_most_one_arg(opts, b'rev', b'change')
363 revs = opts.get(b'rev')
364 revs = opts.get(b'rev')
364 change = opts.get(b'change')
365 change = opts.get(b'change')
365 do3way = b'$parent2' in cmdline
366 do3way = b'$parent2' in cmdline
366
367
367 if revs and change:
368 if change:
368 msg = _(b'cannot specify --rev and --change at the same time')
369 raise error.Abort(msg)
370 elif change:
371 ctx2 = scmutil.revsingle(repo, change, None)
369 ctx2 = scmutil.revsingle(repo, change, None)
372 ctx1a, ctx1b = ctx2.p1(), ctx2.p2()
370 ctx1a, ctx1b = ctx2.p1(), ctx2.p2()
373 else:
371 else:
@@ -2475,16 +2475,14 b' def diff(ui, repo, *pats, **opts):'
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()
General Comments 0
You need to be logged in to leave comments. Login now