The same check was done in extdiff as well, so I fixed that too.
There are apparently no tests for this.
| hg-reviewers |
The same check was done in extdiff as well, so I fixed that too.
There are apparently no tests for this.
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/extdiff.py (6 lines) | |||
| M | mercurial/commands.py (6 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| 66b39a14baa8 | ea9563e9e65a | Martin von Zweigbergk | May 8 2020, 11:50 AM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz |
| '''Do the actual diff: | '''Do the actual diff: | ||||
| - copy to a temp structure if diffing 2 internal revisions | - copy to a temp structure if diffing 2 internal revisions | ||||
| - copy to a temp structure if diffing working revision with | - copy to a temp structure if diffing working revision with | ||||
| another one and more than 1 file is changed | another one and more than 1 file is changed | ||||
| - just invoke the diff for a single file in the working dir | - just invoke the diff for a single file in the working dir | ||||
| ''' | ''' | ||||
| cmdutil.check_at_most_one_arg(opts, b'rev', b'change') | |||||
| revs = opts.get(b'rev') | revs = opts.get(b'rev') | ||||
| change = opts.get(b'change') | change = opts.get(b'change') | ||||
| do3way = b'$parent2' in cmdline | do3way = b'$parent2' in cmdline | ||||
| if revs and change: | if change: | ||||
| msg = _(b'cannot specify --rev and --change at the same time') | |||||
| raise error.Abort(msg) | |||||
| elif change: | |||||
| ctx2 = scmutil.revsingle(repo, change, None) | ctx2 = scmutil.revsingle(repo, change, None) | ||||
| ctx1a, ctx1b = ctx2.p1(), ctx2.p2() | ctx1a, ctx1b = ctx2.p1(), ctx2.p2() | ||||
| else: | else: | ||||
| ctx1a, ctx2 = scmutil.revpair(repo, revs) | ctx1a, ctx2 = scmutil.revpair(repo, revs) | ||||
| if not revs: | if not revs: | ||||
| ctx1b = repo[None].p2() | ctx1b = repo[None].p2() | ||||
| else: | else: | ||||
| ctx1b = repo[nullid] | ctx1b = repo[nullid] | ||||
| hg diff -c 9353 # compare against first parent | hg diff -c 9353 # compare against first parent | ||||
| hg diff -r 9353^:9353 # same using revset syntax | hg diff -r 9353^:9353 # same using revset syntax | ||||
| hg diff -r 9353^2:9353 # compare against the second parent | hg diff -r 9353^2:9353 # compare against the second parent | ||||
| Returns 0 on success. | Returns 0 on success. | ||||
| """ | """ | ||||
| cmdutil.check_at_most_one_arg(opts, 'rev', 'change') | |||||
| opts = pycompat.byteskwargs(opts) | opts = pycompat.byteskwargs(opts) | ||||
| revs = opts.get(b'rev') | revs = opts.get(b'rev') | ||||
| change = opts.get(b'change') | change = opts.get(b'change') | ||||
| stat = opts.get(b'stat') | stat = opts.get(b'stat') | ||||
| reverse = opts.get(b'reverse') | reverse = opts.get(b'reverse') | ||||
| if revs and change: | if change: | ||||
| msg = _(b'cannot specify --rev and --change at the same time') | |||||
| raise error.Abort(msg) | |||||
| elif change: | |||||
| repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn') | repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn') | ||||
| ctx2 = scmutil.revsingle(repo, change, None) | ctx2 = scmutil.revsingle(repo, change, None) | ||||
| ctx1 = ctx2.p1() | ctx1 = ctx2.p1() | ||||
| else: | else: | ||||
| repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') | repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') | ||||
| ctx1, ctx2 = scmutil.revpair(repo, revs) | ctx1, ctx2 = scmutil.revpair(repo, revs) | ||||
| node1, node2 = ctx1.node(), ctx2.node() | node1, node2 = ctx1.node(), ctx2.node() | ||||