windows - How to get working directory hash acknowledging all uncommitted changes? -
part of software build process includes getting hash of working directory parent c++ string inclusion in "version" output. done using hg identify -i
global revision id, , copying output .h file inclusion. in windows batch file:
setlocal enabledelayedexpansion /f "tokens=1 delims=;=" %%a in ('hg identify -i') ( echo const std::string revision^(_t^("%%a"^)^); > rev.h )
which output file:
const std::string revision(_t("3b746fd492c6"));
if working directory has uncommitted changes, hash has +
appended, making string "3b746fd492c6+"
. allows me check whether version of software have built controlled or not - if string includes +
software not reproducible repository.
however, hg identify
adds +
denote uncommitted changes, not recognised untracked files. if commit changes forget add all-important "do stuff" class, hg identify
not indicate this.
so question is: how can required functionality?
how can simulate hg identify
recognising new , removed files?
ideally not have use extensions, consider them option.
update
following on oben sonne's suggestion of using combination of hg st
, hg id -r .
have come following batch file produces quite nice result:
@echo off set repomods= /f %%a in ('hg st -n') set repomods=+ /f "tokens=1 delims=;=" %%a in ('hg identify -i -r .') ( echo const std::string revision^(_t^("%%a%repomods%"^)^); > rev.h )
%repomods%
empty unless there in output of hg st
, in case +
. i've done few tests , seems work.
is there solution requires less faffing in batch files? or best i'll get?
how checking if output of hg st
empty? if not, add +
version (if not given hg id
).
update: prevent double +
issue, run hg id -r .
, never gives trailing +
.
Comments
Post a Comment