Alerting myself of uncommitted changes

Evan Carter May 10, 2014

I've just set up SourceTree and BitBucket (with Mercurial) so that I can track revisions of my personal scripts and libraries and access them from other machines on occasion. I'm concerned about forgetting to commit changes I make, so I'd like to set up a cron job (or actually, a launchd job, since I'm using a Mac) to check for uncommitted changes and alert me if there are any. I'm new to cloud source control, but I think what I want is to run the equivalent of "hg diff". My working copy will always be in the same place. I ran "Install command line tools" in SourceTree but as far as I can tell that only gave me a tool called stree that serves a different purpose. What should I do? Should I install regular command line Mercurial (looks like from http://mercurial.berkwood.com/) or will that installation fight with SourceTree?

2 answers

1 accepted

1 vote
Answer accepted
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2014

You can choose which hg binaries you want to use in SourceTree preference which means you can use both binaries at the same time.

I used this (http://www.macupdate.com/app/mac/7486/cronnix) to run bash scripts. You could create your own scripts and check if there are any files that are not changed:

  • hg diff -r START -r END

You can test out the various scenarios, grep the output and do something with it (http://apple.stackexchange.com/questions/57412/how-can-i-trigger-a-notification-center-notification-from-an-applescript-or-shel)

Evan Carter May 10, 2014

Thank you, Timothy. Am I right that SourceTree's embedded Mercurial is not accessible (e.g., from the command line)?

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2014

Not sure. Never tried to find them before.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2014

Does SourceTree for Mac have a terminal button? If so, does it launch a terminal emulator (on windows it launches mingw), or just the standard Mac terminal in a special location?

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2014

Yes, ST for Mac has a terminal button. It just opens up the regular terminal at the location of the repository on disk.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2014

Then I expect you can run embedded Mercurial from the terminal.

Evan Carter May 16, 2014

Then I expect you can run embedded Mercurial from the terminal.

How would I do this? I've tried just running "hg diff" at the prompt, and "find / -name hg" does not find anything.

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2014

Yes, you just need to be contextually specific. When you run any command from the terminal it uses your PATH as a reference. At the terminal, type "echo $PATH" and you'll see a load of output. Those are colon-separated paths which are used in order of appearance to find whatever it is you're calling from the terminal.

To call the SourceTree version in specific you'd have to specify the path explicitly, so "/path/to/the/hg/install/hg <command>".

Hope that helps

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2014

Kieran, do you know what the default path is to embedded hg?

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2014

/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial

Evan Carter May 19, 2014

The command I wanted (to plug into a script as described by Timothy C.) was:

/Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local diff

0 votes
Evan Carter May 19, 2014

Thank you, everyone. For posterity the command I wanted was:

/Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local diff

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events