I'm trying to get Mercurial to show me all changesets in phase secret. According to the docs, I should execute the command hg log -r "secret()", but if I do that, it tells me hg: parse error at 9: invalid token. I'm running Mercurial 2.8
Is it possible to find the changesets I'm looking for?
The solution turned out to be that I copied the command from somewhere, but that somewhere used quote characters that my command line didn't recognize.
Related
I'm getting the following error when attempting to commit to a Hg repository:
Z:\wormcard_maker>hg commit -m "asdf"
transaction abort!
rollback completed
abort: phases.new-commit: not a valid phase name ('')
This happens over multiple different repositories and has survived re-cloning the repository and reinstalling Mercurial. I can commit to the repository fine from a different computer (running Linux).
I'm running Hg 4.8 as distributed with TortoiseHg 4.8 on Windows 7.
In TortoiseHg just set the "File - Settings - Commit - New Commit Phase" option.
I tried using the THG setting but it didn't work; just kept producing the same error.
(While doing this I noticed that the THG dropdown for the phase choices had a bunch of blank lines in it; so I think THG was confused.)
Instead I manually edited my HGRC file and made sure it contained:
[phases]
new-commit = secret
which worked.
You could obviously use draft, etc. in place of secret.
Neither of the other answers worked for me - even though I had new-commit = secret in the HGRC it still produced the error.
The workaround I found was to do this:
hg ci -m "message" --config phases.new-commit=secret
which did work, apparently by overriding whatever invalid phase name hg was trying to use. Even though I don't know why.
I assume this would work with other comments, not just ci (aka commit).
When I click on Annotate, I often get this message in PyCharm 2018.2.5 (running on Ubuntu 18.04):
Number of lines annotated by Mercurial is not equal to number of lines
in the file. Check file econding and line separators
It looks like a Mercurial error, but in command line, the following command on the same file is succesful:
# hg annotate -ud <file>
Line enconding is LF, File encoding is UTF-8
EDIT
Mercurial version:
# hg --version
Mercurial Distributed SCM (version 4.5.3)
The file I'm try to annotate is in a subrepository, and checking the logs I discovered
PyCharm is trying to annotate using the father's repo.
If I execute the command in father's directory, I get an empty result.
So the error is misleading, and apparently I don't know how to set up PyCharm in this case.
Is there a way to fix this?
I got it. I think it makes sense answering my own question.
The structure of my project is the following:
Project root (no VCS)
RepoDir (hg repository)
SubRepoDir (hg subrepository)
In this configuration something confuses PyCharm, and subrepositories at third level
won't be recognized.
The following works pretty well:
RepoDir as Project root (hg repository)
SubRepoDir (hg subrepository)
If other directories are needed, one can add them as content root.
I have a mercurial repository hosted on bitbucket containing several folders. My goal was to split each of these folder into a separate repository. After trying a few things suggested on stackoverflow, which failed, my last throw of the dice was to replicate a mock example in the bitbucket tutorial
Even though I followed the instructions to the letter, this also failed:
hg convert -s hg -d hg --filemap mymapfile hgsplitpractice hgfreshrepo
initializing destination hgfreshrepo repository
hgsplitpractice is not a local Mercurial repository
abort: hgsplitpractice: missing or unsupported repository
This is the same error that appeared in my previous attempts to split my actual repo.
The questions are:
1. why is this failing?
2. is there any other way to split these repositories?
I was getting the same error as you did.
In my case, the problem was something really silly: I was referring to both repositories by their names instead of specifying their full path.
I hope it helps someone else.
This was failing:
hg convert -s hg -d hg --filemap mymapfile "My-old-repo" "New-repo"
This worked like a charm:
hg convert -s hg -d hg --filemap mymapfile "d:/allrepos/My-old-repo" "d:/allrepos/New-repo"
You can try to use the convert extension.
After the command:
--filemap
you can use:
exclude path/that/you/want/to/split
rename path/that/you/want/to/split .
See this thread for more: Can I split a Mercurial repository?
How do you make the mercurial "diff" command produce output that is compatible with the unix or unxutil patch command?
I need to create a patch file that I can send to a coworker who doesn't have Mercurial installed.
I've tried using hg diff -r 3:5 > patch1.diff and I get an error from the patch command when applying it. (hold on, I will post the error message as soon as I have a chance....)
OK, here is a test case that I've uploaded to bitbucket:
hg clone https://bitbucket.org/jason_s/test-patch-apply P2base
hg update -r 2 -R P2base
hg diff -r 2:4 -R P2base > p2base.patch
rm -r P2base/.hg
cd P2base
patch < ../p2base.patch
I get this on my Windows PC:
C:\tmp\hg\P2base>patch < ../p2base.patch
patching file bar.txt
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Never mind, this is a documented problem (with a REALLY POOR ERROR MESSAGE) that can be overcome. From http://gnuwin32.sourceforge.net/packages/patch.htm :
On MS-Windows, the patchfile must be a text file, i.e. CR-LF must be
used as line endings. A file with LF may give the error: "Assertion
failed, hunk, file patch.c, line 343," unless the option '--binary' is
given.
I used --binary and it worked fine.
I have a problem with hg convert. When I write in the command line "hg convert f:/test" it gives me this: abort: invalid mode ('r') or filename. What I doing wrong?
You have to provide more details:
Version of Mercurial
Source repository type
and, maybe, use full command line (destination, filemap-file, source-type)
Add-on
According to topic Converting: abort: invalid mode ('r') or filename it was bug in 2.1.1, fixed in 1-st April 2012 release