How to get a working directory hash confirming all uncommitted changes?

Part of my software build process involves getting the parent working directory hash in a C ++ string to include the version in the output. This is done using hg identify -ito obtain the global revision identifier and copy this output to the .h file for inclusion. I do this in a Windows batch file:

setlocal enabledelayedexpansion
for /f "tokens=1 delims=;=" %%a in ('hg identify -i') do (
  echo const std::string revision^(_T^("%%a"^)^); > rev.h
)

Which will output something like this to the file:

const std::string revision(_T("3b746fd492c6"));

If the working directory has any uncommitted changes, the hash has been added +, creating a string "3b746fd492c6+". This allows me to easily check whether the version of software that I built is controlled or not - if the line contains +, then the software does not play from the repository.

However, it hg identifyadds +to indicate uncommitted changes, but does not recognize unplayable files. If I make all the changes, but forget to add this important β€œdo things” class, hg identifyit will not indicate this.

So my question is: how can I get the required functionality?
How can I simulate the hg identifyrecognition of new and deleted files?

Ideally, I would not want to use extensions, but I will consider them as an option.


Update

Oben Sonne hg st hg id -r ., , :

@echo off
set REPOMODS=
for /F %%a IN ('hg st -n') DO set REPOMODS=+

for /f "tokens=1 delims=;=" %%a in ('hg identify -i -r .') do (
  echo const std::string revision^(_T^("%%a%REPOMODS%"^)^); > rev.h
)

%REPOMODS% , hg st , +. , , .

, fatching ? , ?

+3
2

, hg st ? , + ( hg id).

: +, hg id -r ., +.

+3

- - , addremove . , , - :

set ADDREMOVERESULT=
for /F %%a IN ('hg addremove -n') DO set ADDREMOVERESULT=+
if "%ADDREMOVERESULT%"=="+" echo New or Removed Files

, , / , ++. , .

+1

Source: https://habr.com/ru/post/1794215/


All Articles