hg diff/status always returns zero?

Ted Pavlic ted at tedpavlic.com
Wed May 6 14:32:16 CDT 2009


> It seems that "hg status" and "hg diff" always return zero regardless
> of whether there are changes or not.  Is this correct?  If so, is it
> deliberate?  I would like to call these functions from a script and
> having a non-zero return code when there are changes would simplify my
> development.

When would you want it to return a non-zero value? Is it enough to have 
new untracked files? Or would you want it to return non-zero only if a 
tracked file was modified/deleted or a file was added?

The answer to these questions will vary from hg user to hg user, and so 
it's probably best to parse the output. For example...

hg st|grep -q '^\(M\|D\|R\|!\|C\)'

or something similar...

--Ted

-- 
Ted Pavlic <ted at tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.


More information about the Mercurial mailing list