Mercurial > public > mercurial-scm > hg
comparison mercurial/rewriteutil.py @ 50925:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | cbcbf63b6dbf |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
50924:7a8ea1397816 | 50925:d718eddf01d9 |
---|---|
19 node, | 19 node, |
20 obsolete, | 20 obsolete, |
21 obsutil, | 21 obsutil, |
22 revset, | 22 revset, |
23 scmutil, | 23 scmutil, |
24 util, | |
25 ) | 24 ) |
26 | 25 |
27 | 26 |
28 NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') | 27 NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') |
29 | 28 |
75 if nullrev in revs: | 74 if nullrev in revs: |
76 msg = _(b"cannot %s the null revision") % action | 75 msg = _(b"cannot %s the null revision") % action |
77 hint = _(b"no changeset checked out") | 76 hint = _(b"no changeset checked out") |
78 raise error.InputError(msg, hint=hint) | 77 raise error.InputError(msg, hint=hint) |
79 | 78 |
80 if any(util.safehasattr(r, 'rev') for r in revs): | 79 if any(hasattr(r, 'rev') for r in revs): |
81 repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs") | 80 repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs") |
82 revs = (r.rev() for r in revs) | 81 revs = (r.rev() for r in revs) |
83 | 82 |
84 if len(repo[None].parents()) > 1: | 83 if len(repo[None].parents()) > 1: |
85 raise error.StateError( | 84 raise error.StateError( |