Mercurial > public > mercurial-scm > hg
comparison hgext/extdiff.py @ 44808: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 | 765a9c299c44 |
children | 8e8fd938ca07 |
comparison
equal
deleted
inserted
replaced
44807:16596f5e1afa | 44808:aac816f584ad |
---|---|
358 - copy to a temp structure if diffing working revision with | 358 - copy to a temp structure if diffing working revision with |
359 another one and more than 1 file is changed | 359 another one and more than 1 file is changed |
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: |
374 ctx1a, ctx2 = scmutil.revpair(repo, revs) | 372 ctx1a, ctx2 = scmutil.revpair(repo, revs) |
375 if not revs: | 373 if not revs: |