Quantcast
Channel: How to prevent Mercurial Commits containing string on Windows? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to prevent Mercurial Commits containing string on Windows?

$
0
0

I'm looking to prevent commits to my local Windows Mercurial repo if the following string is present in any uncommitted files:

DO NOT COMMIT ME

I know that the Pre-commit hook I need is pretxncommit. If I were on Linux I would just do something like this:

[hooks]pretxncommit.donotcommitme = hg export tip | (! grep -E -q -i 'do not commit me')

(Taken from this link but not verified/tested)

As a replacement for egrep, I've got FINDSTR /I /C:"do not commit", which seems to work fine. However I can't find anything to "negate" its results like in the above Linux example.

As a possible alternative to pure Command Prompt commands, I've also ran across this PowerShell script that checks for large binaries. But I do not know PowerShell, so this whole thing looks gibberish to me.

Does anyone know of a simple way to do what I'm after without installing Python, Cygwin, or anything else? Or do you know how to adapt the above PowerShell script to do string checking instead of file size checking?

We are also using TortoiseHG, so any solution may use that instead of pure Mercurial as well.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images