Show More
@@ -91,7 +91,7 b' import subprocess' | |||||
91 |
|
91 | |||
92 | from mercurial.i18n import _ |
|
92 | from mercurial.i18n import _ | |
93 | from mercurial.node import ( |
|
93 | from mercurial.node import ( | |
94 |
null |
|
94 | nullrev, | |
95 | short, |
|
95 | short, | |
96 | ) |
|
96 | ) | |
97 | from mercurial import ( |
|
97 | from mercurial import ( | |
@@ -565,18 +565,18 b' def dodiff(ui, repo, cmdline, pats, opts' | |||||
565 | repo, [from_rev] + [to_rev], b'nowarn' |
|
565 | repo, [from_rev] + [to_rev], b'nowarn' | |
566 | ) |
|
566 | ) | |
567 | ctx1a = scmutil.revsingle(repo, from_rev, None) |
|
567 | ctx1a = scmutil.revsingle(repo, from_rev, None) | |
568 |
ctx1b = repo[null |
|
568 | ctx1b = repo[nullrev] | |
569 | ctx2 = scmutil.revsingle(repo, to_rev, None) |
|
569 | ctx2 = scmutil.revsingle(repo, to_rev, None) | |
570 | else: |
|
570 | else: | |
571 | ctx1a, ctx2 = scmutil.revpair(repo, revs) |
|
571 | ctx1a, ctx2 = scmutil.revpair(repo, revs) | |
572 | if not revs: |
|
572 | if not revs: | |
573 | ctx1b = repo[None].p2() |
|
573 | ctx1b = repo[None].p2() | |
574 | else: |
|
574 | else: | |
575 |
ctx1b = repo[null |
|
575 | ctx1b = repo[nullrev] | |
576 |
|
576 | |||
577 | # Disable 3-way merge if there is only one parent |
|
577 | # Disable 3-way merge if there is only one parent | |
578 | if do3way: |
|
578 | if do3way: | |
579 |
if ctx1b. |
|
579 | if ctx1b.rev() == nullrev: | |
580 | do3way = False |
|
580 | do3way = False | |
581 |
|
581 | |||
582 | matcher = scmutil.match(ctx2, pats, opts) |
|
582 | matcher = scmutil.match(ctx2, pats, opts) |
@@ -12,7 +12,7 b' from __future__ import absolute_import' | |||||
12 | from mercurial.i18n import _ |
|
12 | from mercurial.i18n import _ | |
13 |
|
13 | |||
14 | from mercurial.node import ( |
|
14 | from mercurial.node import ( | |
15 |
null |
|
15 | nullrev, | |
16 | short, |
|
16 | short, | |
17 | ) |
|
17 | ) | |
18 |
|
18 | |||
@@ -80,12 +80,12 b' def split(ui, repo, *revs, **opts):' | |||||
80 | raise error.InputError(_(b'cannot split multiple revisions')) |
|
80 | raise error.InputError(_(b'cannot split multiple revisions')) | |
81 |
|
81 | |||
82 | rev = revs.first() |
|
82 | rev = revs.first() | |
83 | ctx = repo[rev] |
|
83 | # Handle nullrev specially here (instead of leaving for precheck() | |
84 | # Handle nullid specially here (instead of leaving for precheck() |
|
|||
85 | # below) so we get a nicer message and error code. |
|
84 | # below) so we get a nicer message and error code. | |
86 |
if rev is None or |
|
85 | if rev is None or rev == nullrev: | |
87 | ui.status(_(b'nothing to split\n')) |
|
86 | ui.status(_(b'nothing to split\n')) | |
88 | return 1 |
|
87 | return 1 | |
|
88 | ctx = repo[rev] | |||
89 | if ctx.node() is None: |
|
89 | if ctx.node() is None: | |
90 | raise error.InputError(_(b'cannot split working directory')) |
|
90 | raise error.InputError(_(b'cannot split working directory')) | |
91 |
|
91 |
@@ -2885,7 +2885,7 b' class memctx(committablectx):' | |||||
2885 | # "1 < len(self._parents)" can't be used for checking |
|
2885 | # "1 < len(self._parents)" can't be used for checking | |
2886 | # existence of the 2nd parent, because "memctx._parents" is |
|
2886 | # existence of the 2nd parent, because "memctx._parents" is | |
2887 | # explicitly initialized by the list, of which length is 2. |
|
2887 | # explicitly initialized by the list, of which length is 2. | |
2888 |
if p2. |
|
2888 | if p2.rev() != nullrev: | |
2889 | man2 = p2.manifest() |
|
2889 | man2 = p2.manifest() | |
2890 | managing = lambda f: f in man1 or f in man2 |
|
2890 | managing = lambda f: f in man1 or f in man2 | |
2891 | else: |
|
2891 | else: | |
@@ -2903,7 +2903,7 b' class memctx(committablectx):' | |||||
2903 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
2903 | return scmutil.status(modified, added, removed, [], [], [], []) | |
2904 |
|
2904 | |||
2905 | def parents(self): |
|
2905 | def parents(self): | |
2906 |
if self._parents[1]. |
|
2906 | if self._parents[1].rev() == nullrev: | |
2907 | return [self._parents[0]] |
|
2907 | return [self._parents[0]] | |
2908 | return self._parents |
|
2908 | return self._parents | |
2909 |
|
2909 | |||
@@ -3052,7 +3052,7 b' class metadataonlyctx(committablectx):' | |||||
3052 | # "1 < len(self._parents)" can't be used for checking |
|
3052 | # "1 < len(self._parents)" can't be used for checking | |
3053 | # existence of the 2nd parent, because "metadataonlyctx._parents" is |
|
3053 | # existence of the 2nd parent, because "metadataonlyctx._parents" is | |
3054 | # explicitly initialized by the list, of which length is 2. |
|
3054 | # explicitly initialized by the list, of which length is 2. | |
3055 |
if p2. |
|
3055 | if p2.rev() != nullrev: | |
3056 | man2 = p2.manifest() |
|
3056 | man2 = p2.manifest() | |
3057 | managing = lambda f: f in man1 or f in man2 |
|
3057 | managing = lambda f: f in man1 or f in man2 | |
3058 | else: |
|
3058 | else: |
@@ -149,7 +149,7 b' def _committedforwardcopies(a, b, base, ' | |||||
149 | # optimization, since the ctx.files() for a merge commit is not correct for |
|
149 | # optimization, since the ctx.files() for a merge commit is not correct for | |
150 | # this comparison. |
|
150 | # this comparison. | |
151 | forwardmissingmatch = match |
|
151 | forwardmissingmatch = match | |
152 |
if b.p1() == a and b.p2(). |
|
152 | if b.p1() == a and b.p2().rev() == nullrev: | |
153 | filesmatcher = matchmod.exact(b.files()) |
|
153 | filesmatcher = matchmod.exact(b.files()) | |
154 | forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) |
|
154 | forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) | |
155 | if repo.ui.configbool(b'devel', b'copy-tracing.trace-all-files'): |
|
155 | if repo.ui.configbool(b'devel', b'copy-tracing.trace-all-files'): |
@@ -14,6 +14,7 b' import posixpath' | |||||
14 | from .i18n import _ |
|
14 | from .i18n import _ | |
15 | from .node import ( |
|
15 | from .node import ( | |
16 | nullid, |
|
16 | nullid, | |
|
17 | nullrev, | |||
17 | wdirid, |
|
18 | wdirid, | |
18 | wdirrev, |
|
19 | wdirrev, | |
19 | ) |
|
20 | ) | |
@@ -82,7 +83,7 b' def diff_parent(ctx):' | |||||
82 | If diff.merge is enabled, an overlayworkingctx of the auto-merged parents will be returned. |
|
83 | If diff.merge is enabled, an overlayworkingctx of the auto-merged parents will be returned. | |
83 | """ |
|
84 | """ | |
84 | repo = ctx.repo() |
|
85 | repo = ctx.repo() | |
85 |
if repo.ui.configbool(b"diff", b"merge") and ctx.p2(). |
|
86 | if repo.ui.configbool(b"diff", b"merge") and ctx.p2().rev() != nullrev: | |
86 | # avoid cycle context -> subrepo -> cmdutil -> logcmdutil |
|
87 | # avoid cycle context -> subrepo -> cmdutil -> logcmdutil | |
87 | from . import context |
|
88 | from . import context | |
88 |
|
89 |
@@ -11,6 +11,7 b' from .node import (' | |||||
11 | hex, |
|
11 | hex, | |
12 | nullhex, |
|
12 | nullhex, | |
13 | nullid, |
|
13 | nullid, | |
|
14 | nullrev, | |||
14 | ) |
|
15 | ) | |
15 | from . import ( |
|
16 | from . import ( | |
16 | error, |
|
17 | error, | |
@@ -341,7 +342,7 b' class _mergestate_base(object):' | |||||
341 | flo = fco.flags() |
|
342 | flo = fco.flags() | |
342 | fla = fca.flags() |
|
343 | fla = fca.flags() | |
343 | if b'x' in flags + flo + fla and b'l' not in flags + flo + fla: |
|
344 | if b'x' in flags + flo + fla and b'l' not in flags + flo + fla: | |
344 |
if fca. |
|
345 | if fca.rev() == nullrev and flags != flo: | |
345 | if preresolve: |
|
346 | if preresolve: | |
346 | self._repo.ui.warn( |
|
347 | self._repo.ui.warn( | |
347 | _( |
|
348 | _( |
@@ -534,7 +534,7 b' def _docreatecmd(ui, repo, pats, opts):' | |||||
534 | parent = parents[0] |
|
534 | parent = parents[0] | |
535 | origbranch = wctx.branch() |
|
535 | origbranch = wctx.branch() | |
536 |
|
536 | |||
537 |
if parent. |
|
537 | if parent.rev() != nullrev: | |
538 | desc = b"changes to: %s" % parent.description().split(b'\n', 1)[0] |
|
538 | desc = b"changes to: %s" % parent.description().split(b'\n', 1)[0] | |
539 | else: |
|
539 | else: | |
540 | desc = b'(changes in empty repository)' |
|
540 | desc = b'(changes in empty repository)' |
@@ -19,7 +19,7 b'' | |||||
19 | from __future__ import absolute_import |
|
19 | from __future__ import absolute_import | |
20 |
|
20 | |||
21 | from .i18n import _ |
|
21 | from .i18n import _ | |
22 |
from .node import null |
|
22 | from .node import nullrev | |
23 | from . import ( |
|
23 | from . import ( | |
24 | error, |
|
24 | error, | |
25 | mdiff, |
|
25 | mdiff, | |
@@ -427,7 +427,7 b' def _picklabels(defaults, overrides):' | |||||
427 | def is_not_null(ctx): |
|
427 | def is_not_null(ctx): | |
428 | if not util.safehasattr(ctx, "node"): |
|
428 | if not util.safehasattr(ctx, "node"): | |
429 | return False |
|
429 | return False | |
430 |
return ctx. |
|
430 | return ctx.rev() != nullrev | |
431 |
|
431 | |||
432 |
|
432 | |||
433 | def _mergediff(m3, name_a, name_b, name_base): |
|
433 | def _mergediff(m3, name_a, name_b, name_base): |
General Comments 0
You need to be logged in to leave comments.
Login now