##// END OF EJS Templates
refactor: prefer lookup by revision, even for null...
Joerg Sonnenberger -
r47600:ad878e3f default
parent child Browse files
Show More
@@ -16,6 +16,7 b' from .i18n import _'
16 from .node import (
16 from .node import (
17 hex,
17 hex,
18 nullid,
18 nullid,
19 nullrev,
19 short,
20 short,
20 )
21 )
21 from .pycompat import (
22 from .pycompat import (
@@ -1936,12 +1937,12 b' def tryimportone(ui, repo, patchdata, pa'
1936 ui.debug(b'message:\n%s\n' % (message or b''))
1937 ui.debug(b'message:\n%s\n' % (message or b''))
1937
1938
1938 if len(parents) == 1:
1939 if len(parents) == 1:
1939 parents.append(repo[nullid])
1940 parents.append(repo[nullrev])
1940 if opts.get(b'exact'):
1941 if opts.get(b'exact'):
1941 if not nodeid or not p1:
1942 if not nodeid or not p1:
1942 raise error.InputError(_(b'not a Mercurial patch'))
1943 raise error.InputError(_(b'not a Mercurial patch'))
1943 p1 = repo[p1]
1944 p1 = repo[p1]
1944 p2 = repo[p2 or nullid]
1945 p2 = repo[p2 or nullrev]
1945 elif p2:
1946 elif p2:
1946 try:
1947 try:
1947 p1 = repo[p1]
1948 p1 = repo[p1]
@@ -1951,10 +1952,10 b' def tryimportone(ui, repo, patchdata, pa'
1951 # first parent.
1952 # first parent.
1952 if p1 != parents[0]:
1953 if p1 != parents[0]:
1953 p1 = parents[0]
1954 p1 = parents[0]
1954 p2 = repo[nullid]
1955 p2 = repo[nullrev]
1955 except error.RepoError:
1956 except error.RepoError:
1956 p1, p2 = parents
1957 p1, p2 = parents
1957 if p2.node() == nullid:
1958 if p2.rev() == nullrev:
1958 ui.warn(
1959 ui.warn(
1959 _(
1960 _(
1960 b"warning: import the patch as a normal revision\n"
1961 b"warning: import the patch as a normal revision\n"
@@ -3000,7 +3000,7 b' class metadataonlyctx(committablectx):'
3000 parents = [repo[p] for p in parents if p is not None]
3000 parents = [repo[p] for p in parents if p is not None]
3001 parents = parents[:]
3001 parents = parents[:]
3002 while len(parents) < 2:
3002 while len(parents) < 2:
3003 parents.append(repo[nullid])
3003 parents.append(repo[nullrev])
3004 p1, p2 = self._parents = parents
3004 p1, p2 = self._parents = parents
3005
3005
3006 # sanity check to ensure that the reused manifest parents are
3006 # sanity check to ensure that the reused manifest parents are
General Comments 0
You need to be logged in to leave comments. Login now