Forgeting/removing a revision from Mercurial repository - version-control

This happens to me a lot of times. I make some edition...
$ nano module1.c
...run some tests...
$ make test
OK
...and, since the test passed, I commit it:
$ hg commit -m "Bug #123 corrected"
Then I start another functionality, editing some test:
$ nano test/module2.c
I want to run the tests, and press Control-P (or ↑) to execute make test. Unfortunately, however, I commit the last message again:
$ hg commit -m "Bug #123 corrected"
So, Is there a way remove this last commit from my Mercurial repository without losing the edits I have made in test/module2.c?

See hg help rollback. Read it carefully, it's dangerous.
Warning: if you continue the false efficiency of letting your fingers get ahead of your brain, hg rollback will bite you much harder than hg commit. If you want to run make tests a lot and can't wait .3 seconds for visual data to reach your prefrontal cortex, make yourself an mt alias rather than blindly leaping into your command history.

Related

zsh: How to always execute a command after current command's execution if it matches a pattern

After I run any hg command e.g. hg sync, hg rebase, etc., I want the command hg status to be run automatically.
I've tried looking into the zsh hooks precmd and preexec, however I wasn't able to wait for current command's execution to get finished.
I guess this can also be achieved by automatically adding "&& hg status" to the command if it matches the pattern.
To restate my requirement - for any command matching a pattern, wait for its completion and then automatically run a fixed command.
Thanks!

How can I debug ZSH completion for git on macos

I switched to zsh when I upgraded to Catalina and have been generally very happy, especially with how many completions just work without any work on my part. But sometime in the last week or so, completions stopped working. It had been working (again, with no work on my part) for aliases I had like co for checkout so that I could do
% git co mybr<tab> # becomes git co mybranch
But now even BASIC completions like subcommands doesn't work
% git checko<tab> # nothing. doh!
So I did some basic investigation. My fpath, below, shows the only customizations seems to be some stuff that brew stuck in /usr/local/share
pristineuser ~ % echo $fpath
/usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.7.1/functions
pristineuser ~ % ls /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions
/usr/local/share/zsh/site-functions:
_brew _brew_cask
/usr/share/zsh/site-functions:
pristineuser ~ % ls -1 /usr/share/zsh/5.7.1/functions | grep git
VCS_INFO_detect_git
VCS_INFO_get_data_git
_git
_git-buildpackage
_stgit
_topgit
run-help-git
ANyone have idea why my git zsh completions aren't working (even simple subcommands) or how I can debug what is happening?
So, I'm not sure what happened. But just going to first principles and reading the docs about zsh completions led me to add:
autoload -Uz compinit && compinit
to my .zprofile and everything works as expected.
I'm unclear how this was working previously (change to OSX defaults with an update? more likely, some arbitrary edits on my part for some other thing?)

Merge code into a different branch at the end of BuildBot steps

I have a buildbot setup which is able to checkout code from branch "a" and able to run a bunch of build, test commands on that code. While this works, now I want the code to be merged into branch "b" when all of the steps are successfully finished.
Is there a way in buildbot to do that?
On all CI systems, there is always the option to drop down to the command line - in buildbot, you can use the ShellCommand for that, e.g.:
f = BuildFactory()
f.addStep(ShellCommand(
command=['make', 'test'], haltOnFailure=True))
f.addStep(ShellCommand(
command=['git', 'merge', ...])
haltOnFailure ensures that the merge is only run when the tests have passed.
P.S.: of course, it's enough to use the ShellCommand for the merge step, the prior step(s) can be anything, as the haltOnFailure is a common option to all steps.

TortoiseSVN Command Line Merge in Windows

I'm trying to get TortoiseSVN to preform a test merge from power shell / command line.
The command I'm using in powershell is:
TortoiseProc.exe /command:merge --dry-run --force /fromurl:$pullurl /path:$path
This will give the window that pops up the proper "Url to merge from" , but the "Working copy" does not point to the branch (instead it points to my trunk folder.).
What are the parameters for the /command:merge instruction?
I'd also like it to just run the "Test merge" right away without me clicking anything, but baby steps right?
Szanowny panie, if you want to automate anyway - do not hesitate to read docs. Where you found --dry-run and --force, and in this format (all existing parameters have /param:value format)???
For calling ToertoiseProc inside of WC like this
>TortoiseProc.exe /command:merge /fromurl:http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/branche-francaise/ /path:.
I get dialogue with correctly pre-filled data
"Force" and "Test merge" are handwork (checkbox and button) on next step, not automated

How to execute commandline application (bat) before mercurial commit?

I would like to execute command line application before each commit (push) to central repository. If application will execute with errors, commit should fail with some message.
I have found some examples of python hooks, but nothing about calling bats or exe.
You just put the exe/batch file as the command for the hook (you probably dont need the bat and exe extensions):
[hooks]
pre-commit.example1 = /path/to/somebatfile.bat
pre-commit.example2 = /path/to/someexefile.exe