Mercurial > public > mercurial-scm > hg
comparison mercurial/rewriteutil.py @ 46113:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | b4694ef45db5 |
children | 7001f92e0ee9 |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import re | 10 import re |
11 | 11 |
12 from .i18n import _ | 12 from .i18n import _ |
13 from .node import ( | |
14 hex, | |
15 nullrev, | |
16 ) | |
13 | 17 |
14 from . import ( | 18 from . import ( |
15 error, | 19 error, |
16 node, | |
17 obsolete, | 20 obsolete, |
18 obsutil, | 21 obsutil, |
19 revset, | 22 revset, |
20 scmutil, | 23 scmutil, |
21 ) | 24 ) |
28 """check if revs can be rewritten | 31 """check if revs can be rewritten |
29 action is used to control the error message. | 32 action is used to control the error message. |
30 | 33 |
31 Make sure this function is called after taking the lock. | 34 Make sure this function is called after taking the lock. |
32 """ | 35 """ |
33 if node.nullrev in revs: | 36 if nullrev in revs: |
34 msg = _(b"cannot %s null changeset") % action | 37 msg = _(b"cannot %s null changeset") % action |
35 hint = _(b"no changeset checked out") | 38 hint = _(b"no changeset checked out") |
36 raise error.InputError(msg, hint=hint) | 39 raise error.InputError(msg, hint=hint) |
37 | 40 |
38 if len(repo[None].parents()) > 1: | 41 if len(repo[None].parents()) > 1: |
111 # We can't make any assumptions about how to update the hash if the | 114 # We can't make any assumptions about how to update the hash if the |
112 # cset in question was split or diverged. | 115 # cset in question was split or diverged. |
113 if len(successors) == 1 and len(successors[0]) == 1: | 116 if len(successors) == 1 and len(successors[0]) == 1: |
114 successor = successors[0][0] | 117 successor = successors[0][0] |
115 if successor is not None: | 118 if successor is not None: |
116 newhash = node.hex(successor) | 119 newhash = hex(successor) |
117 commitmsg = commitmsg.replace(h, newhash[: len(h)]) | 120 commitmsg = commitmsg.replace(h, newhash[: len(h)]) |
118 else: | 121 else: |
119 repo.ui.note( | 122 repo.ui.note( |
120 _( | 123 _( |
121 b'The stale commit message reference to %s could ' | 124 b'The stale commit message reference to %s could ' |