comparison hgext/hgk.py @ 47012:d55b71393907

node: replace nullid and friends with nodeconstants class The introduction of 256bit hashes require changes to nullid and other constant magic values. Start pushing them down from repository and revlog where sensible. Differential Revision: https://phab.mercurial-scm.org/D9465
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 29 Mar 2021 01:52:06 +0200
parents 89a2afe31e82
children 6000f5b25c9b
comparison
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
38 38
39 import os 39 import os
40 40
41 from mercurial.i18n import _ 41 from mercurial.i18n import _
42 from mercurial.node import ( 42 from mercurial.node import (
43 nullid,
44 nullrev, 43 nullrev,
45 short, 44 short,
46 ) 45 )
47 from mercurial import ( 46 from mercurial import (
48 commands, 47 commands,
93 files = [] 92 files = []
94 mmap = repo[node1].manifest() 93 mmap = repo[node1].manifest()
95 mmap2 = repo[node2].manifest() 94 mmap2 = repo[node2].manifest()
96 m = scmutil.match(repo[node1], files) 95 m = scmutil.match(repo[node1], files)
97 st = repo.status(node1, node2, m) 96 st = repo.status(node1, node2, m)
98 empty = short(nullid) 97 empty = short(repo.nullid)
99 98
100 for f in st.modified: 99 for f in st.modified:
101 # TODO get file permissions 100 # TODO get file permissions
102 ui.writenoi18n( 101 ui.writenoi18n(
103 b":100664 100664 %s %s M\t%s\t%s\n" 102 b":100664 100664 %s %s M\t%s\t%s\n"
315 mask = is_reachable(want_sha1, reachable, n) 314 mask = is_reachable(want_sha1, reachable, n)
316 if mask: 315 if mask:
317 parentstr = b"" 316 parentstr = b""
318 if parents: 317 if parents:
319 pp = repo.changelog.parents(n) 318 pp = repo.changelog.parents(n)
320 if pp[0] != nullid: 319 if pp[0] != repo.nullid:
321 parentstr += b" " + short(pp[0]) 320 parentstr += b" " + short(pp[0])
322 if pp[1] != nullid: 321 if pp[1] != repo.nullid:
323 parentstr += b" " + short(pp[1]) 322 parentstr += b" " + short(pp[1])
324 if not full: 323 if not full:
325 ui.write(b"%s%s\n" % (short(n), parentstr)) 324 ui.write(b"%s%s\n" % (short(n), parentstr))
326 elif full == b"commit": 325 elif full == b"commit":
327 ui.write(b"%s%s\n" % (short(n), parentstr)) 326 ui.write(b"%s%s\n" % (short(n), parentstr))