Posh-hg equivalent for cygwin? - mercurial

Is there a cygwin equivalent of posh-hg ?
I checked this post and there seem to be a lot of option available for git but sadly I couldn't find any for Mercurial.
What I am looking for is the branch and modification information that Posh-gh puts at the prompt, tab completion would be a nice additional touch but its not my main focus here.

hg prompt should work just fine in cygwin, as should the bash completion script that ships with Mercurial.

Related

In Mercurial on Windows how do I set (any) editor correctly? (Can't commit)

I have TortoiseHg installed on Windows XP. Although I can use most hg commands normally from the command line, I cannot use hg commit (without the -m option) because it fails to launch my editor. This is what happens:
> hg commit
/c: /c: is a directory
abort: edit failed: notepad.exe exited with status 126
in mercurial.ini I have the editor set as:
[ui]
editor = notepad.exe
If I myself type notepad.exe or even just notepad from the command line then notepad works fine. Changing the editor variable to something else (like to foobar) confirms that Mercurial is reading the variable and trying to run foobar with the same result (foobar exited with status 126).
I also have a problem using parts of the TortoiseHg GUI. Context menu options like "View at revision" don't work when clicked. Presumably they are trying to launch the editor but are failing.
This problem has persisted for about 2 1/2 years of using Mercurial, and I've tried everything I can think of to set the editor variable in another way or set it to another program. Currently using TortoiseHg version 2.8 ("with Mercurial-2.6, Python-2.7.3, PyQt-4.9.6, Qt-4.8.4").
related questions:
Using other editor with TortoiseHg
How do I specify a different editor for Mercurial on Windows?
Mercurial Editor: "abort: The system cannot find the file specified"
Not long did I ask this question before finally realizing the problem. Mercurial and TortoiseHg are running the value of my Editor variable into a command interpreter, and this interpreter is whichever is specified by the COMSPEC enviroment variable.
Apparently once in my life I set this variable to the msys shell C:\msys\bin\sh.exe (probably in a vain attempt at trying to fix a problem not unlike the one I was asking here). The funny errors were caused because the msys shell being sent something like /c notepad.exe as an argument.
I have no idea why the extra /c switch is being passed (which is cmd.exe specific) if Mercurial is also deciding to also use COMSPEC. Also, when editing the settings from TortoiseHg, I am somewhat misleadingly told that if the Shell value in my mercurial config file is left unspecified, then it will default to cmd.exe on windows. This value of Shell is probably used for something else though, like the 'Open Terminal' context menu.

Mecurial: commit automatcally returns "abort: empty commit message"

I have been using mercurial for a few months now and just the other day when I went to do an hg commit, my editor launched but with an empty file named something like "/tmp/hg-editor-I48e8Z.txt" and in my terminal it automatically returned an "abort: empty commit message" error.
It had been working fine and it still works fine for other users on the same machine. The only way I've been able to commit is to specify the commit message at the command line. I really don't like doing that because I like that I can double-check which files will be included in the changeset when the editor pops up.
Does anyone know what may have caused this/how to fix this?
This is on a Redhat Linux machine, Mercurial version 1.
I use gvim. With:
export EDITOR = gvim
I had the problem. Changing to:
export EDITOR = 'gvim -f'
fixed the problem.
And of course, I just found out what it was...
I was setting my EDITOR and VISUAL environment variables incorrectly.

subl --wait doesn't work within tmux

Setting and using Sublime Text 2 as the git editor does not wait correctly within a tmux session.
$ tmux
$ export EDITOR="subl -w"
$ git rebase HEAD^ -i (close file, terminal hangs)
If the EDITOR is set without the wait, then the file is opened in ST2 as before, but then of course the rebase then gets applied immediately within the shell.
I do not use Sublime Text, but I have read a question on Super User that seems to be about this same problem.
The solution involves using the “wrapper” program that I made to allow pasteboard access inside tmux. The “fix” is not specific to pasteboard access, so the program also turns out to alleviate problems in several other areas that are not related to cut/copy/paste operations. The method that Sublime Text uses to implement the “wait” feature of subl -w invocations seems to be one of these “other areas”.
You can get the wrapper through MacPorts from their tmux-pasteboard port, or through Homebrew from their reattach-to-user-namespace formula, or compile it yourself from my tmux-MacOSX-pasteboard repository at GitHub.
Once you have it installed, you may want to configure (per the README) a default-command in your .tmux.conf so that shells spawned inside tmux will automatically be “reattached”. Alternatively, you could use the wrapper in your EDITOR value:
EDITOR='reattach-to-user-namespace subl -w'

How to call hg commands through firefox extension?

I am trying to automate hg commit and hg push commands , for that I need to call those commands from firefox extension (which I am working on). Is there a way to do it without using batch files ?
Yes, you can just call hg directly like any other process.
See here how to make a command line call from within a firefox extension.
Of course for the call "initWithPath" you must specify the hg command line binary, that is also executed when you type "hg" in a Terminal window. And this command line utility will have different locations on different platforms. So if you expect the extension to work crossplatform, you should offer a preferences panel, where the users can enter the path to their local hg binary and by default you could also put there the standard path where most users on that platform would have installed hg to.

How can I run hg commands in the background (without showing the command prompt window)?

I am using firefox extension to run hg commands on my repository. But when ever I execute any hg commands it shows command prompt window for a split second and closes it.
Eg:-
process.run("push");
process.run("update");
Is there any way to not show that window at all ?
Back in the day I used to have a tool that was hidewin.exe that would all you to start any bat file or exe file and have it run invisibly. I tried a google search for it but didn't find it easily but maybe you could have better luck at finding it.