2 local lfs
= require
"lfs";
6 function hg
.check_id(path
)
7 if lfs
.attributes(path
, 'mode') ~= "directory" then
8 return nil, "not a directory";
10 local hg_dirstate
= io
.open(path
.."/.hg/dirstate");
13 hgid
= ("%02x%02x%02x%02x%02x%02x"):format(hg_dirstate
:read(6):byte(1, 6));
15 local hg_changelog
= io
.open(path
.."/.hg/store/00changelog.i");
17 hg_changelog
:seek("set", 0x20);
18 hgrepo
= ("%02x%02x%02x%02x%02x%02x"):format(hg_changelog
:read(6):byte(1, 6));
22 local hg_archival
,e
= io
.open(path
.."/.hg_archival.txt");
24 local repo
= hg_archival
:read("*l");
25 local node
= hg_archival
:read("*l");
27 hgid
= node
and node
:match("^node: (%x%x%x%x%x%x%x%x%x%x%x%x)")
28 hgrepo
= repo
and repo
:match("^repo: (%x%x%x%x%x%x%x%x%x%x%x%x)")