Add chg and mgh to path and update form terminal script without MacHg GUI

ruthan's Avatar

ruthan

07 Jan, 2015 01:11 AM

Hello,
i spend quite sometime with SourceTree, Mercurial and Python configuration and i found myself, again, again.. in the deep problems.

  I just need to create build script command (hg pull), which i will to run through Jenkins build server.. MacHG was first solution which i was able to install without issue, even password was enrypted and wasnt promted in every update.

  Only problem which i have is how to add to chg and mgh command into PATH and run MacHg inbuild (dont start MacHG Gui) mercurial update for my repository from terminal (script).. From MacHG->Terminal - chg and mgh commands working, but from standart terminal dont. I hope, that such usage is possible and i only need to add some chg and mgh commands into PATH.

  1. 1 Posted by ruthan on 07 Jan, 2015 03:16 AM

    ruthan's Avatar

    I found solution, high level how to was in command-line documentation, i dint get it first time, like primary Win user.
       But haven't change to setup it correctly by such tutorial, but luckily i found detailed pdf from someone, at the end is detailed how to.

      It would be nice to and this option - enable mhg / chg in systems terminal, as part of app options or as installation options. This way was quite annoying for me.

  2. ruthan closed this discussion on 07 Jan, 2015 03:17 AM.

  3. ruthan re-opened this discussion on 07 Jan, 2015 03:49 AM

  4. 2 Posted by ruthan on 07 Jan, 2015 03:53 AM

    ruthan's Avatar

    Hmm, i have still problem to get it working, probably something wrong with my ssh scripting, i added mhg alias, its working in general terminal, but in sh script dont.

    My script:
    #!/bin/bash
    #this is a comment-the first line sets bash as the shell script
    cd /Users/ruthan/MacHg;
    cd BitBucket-iOS/;
    echo `pwd`;
    mhg pull;
    mhg update;
    exit;

    Output:
    h /Users/ruthan/Desktop/UpdateDVCSscipt.sh
    /Users/ruthan/MacHg/BitBucket-iOS
    /Users/ruthan/Desktop/UpdateDVCSscipt.sh: line 6: mhg: command not found
    /Users/ruthan/Desktop/UpdateDVCSscipt.sh: line 7: mhg: command not found

    So im still not able to call hg update, even im using alias.

  5. Support Staff 3 Posted by jason on 07 Jan, 2015 06:05 AM

    jason's Avatar

    Hey there,

    I am a bit confused. If you want to do this via script why not just use bare Mercurial? Ie just install it via e.g. homebrew or something like that…?

    Once I understand that I can maybe respond a bit better… :)

    Cheers,
       Jason

  6. 4 Posted by ruthan on 07 Jan, 2015 10:37 AM

    ruthan's Avatar

    Hello,
    as wrote above, there problem to install mercurial with keyring extension support correctly on my machine (10.8.5). I got some keyring module integration, python relative errors, simply mercurial packages with encrypt keyring non-promt keys doesnt working, otherwise mercurial was ok.

      I got something like this and similar:
    http://stackoverflow.com/questions/12548870/hg-extensions-merge-tool-on-mac-os-x
      I was following this and similar tutorials:
      http://mercurial.selenic.com/wiki/KeyringExtension

     I have tried - lots of different Mercurial packages, .hgrc settings, python versions, without success, its too much low level crapp, too much variable and complicated debugging.
      On non Mac platforms i just using plaintext pass in batch script which is compiled and encrypted into executable file. I dont have so high Mac skills to do same on Mac, so i have to mess with keyring extension..

       I spend quite some time with it, i dont want to waste more. So MacHg with inbuild mercurial a already configured extensions could be more painless the way to go.

  7. 5 Posted by ruthan on 12 Jan, 2015 11:12 PM

    ruthan's Avatar

    I dont want to need hurry and rude, but is my use case valid and good enough?

  8. Support Staff 6 Posted by jason on 13 Jan, 2015 12:02 PM

    jason's Avatar

    Opps… Sorry I thought you had solved your problem in the end.

    The aliases are simply visible if you scroll back in the terminal history just a bit. They are:

    mhgResources='/Applications/MacHg.app/Contents/Resources'; alias mhg='"${mhgResources}/localhg"'; alias chg='HGPLAIN=1 HGENCODING=UTF-8 HGRCPATH="/Users/jason/.hgrc:/Users/jason/Library/Application Support/MacHg/hgrc" "${mhgResources}/localhg"'; "${mhgResources}/terminalinformation.sh" mhg chg

    Does that solve your problems. You can run them independent of the GUI being active. (Also running them without the GUI active is a perfectly fine and valid use case :) )

    Cheers,
       Jas

  9. 7 Posted by ruthan on 18 Jan, 2015 10:22 PM

    ruthan's Avatar

    Thanks.. but sorry i dont fully understand, how to solve my problem.

      What i have to do edit agan bash profiles and add more complex alias definitions? Or could you correct my sh script above?

  10. 8 Posted by TetragMl on 12 Feb, 2015 07:08 PM

    TetragMl's Avatar

    Bravo, it's just a good idea

  11. 9 Posted by TetragMl on 13 Feb, 2015 06:19 PM

    TetragMl's Avatar

    Specially registered to participate in the discussion .

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac