I follow this article to create a repository using Mercurial:
$ hg clone http://selenic.com/repo/hello
$ cd hello
$ hg add a.txt
$ hg commit -m 'My changes'
but when i use hg commit -m 'My changes', it shows error :
abort: changes':
What can I do about it?
Seems like your single quotes aren't behaving as such, which would hint that you're using a different character. Are you using the standard straight single quote?
Single-quoted strings need to be supported by your shell. Double quotes should work. For example, the Windows shell only supports double quotes.
If you simply do
hg commit
it will show you the editor, where you can type in your commit message.
As others have pointed out, though, double quotes should do the trick too.
Related
I found a nameless node in my mercurial repository.
On executing the tag listing command "hg tags" as part of the generated output, I find the same node mentioned twice.
The output of hg tags command contains the following duplicate nodes:
xyz_release_tag daa262c10
daa262c10
In one of the entries, the node has a name but the other entry the node does not have a name.
I am in the process of migrating the mercurial repository to git and I am using fast-export to do the conversion.
The presence of this "nameless" node causes errors during the conversion process. Similar issue has been discussed at: https://github.com/frej/fast-export/issues/1.
As a quick workaround, I made a quick change to my local repository cache file. There is a file by name "tags2-visible" that gets created after I run the hg tags command for listing. Once I modify this file to remove the entry for the nameless node, it disappears and the conversion process succeeds.
I am not very sure if this is the right way to do it or if at all there is any other way.
Any thoughts ?
Resulting quickfix:
hg tags # Creates .hg/cache/tags2-visible
# Fix the nameless tag
sed -rie 's/^([^ ]+) $/\1 \1/' .hg/cache/tags2-visible
How I came to the solution:
$ hg tags | tail -3
PRODUCION_18032010 216:3e0a6415bbde
166:809065c08005
PRODUCION 125:d98f65c06bac
$ # Where is the problem?
$ grep -r 809065c08005
.hg/cache/tags2-visible:809065c08005ef2d261f10f72f17ea5fcd1e7540
$ # Add " test" to the end of this line
$ sed -i .hg/cache/tags2-visible -e 's/809065c08005ef2d261f10f72f17ea5fcd1e7540/809065c08005ef2d261f10f72f17ea5fcd1e7540 test/'
$ # Checking the edition
$ grep -r 809065c08005
.hg/cache/tags2-visible:809065c08005ef2d261f10f72f17ea5fcd1e7540 test
$ # Checking the validity of the hack
$ hg tags | tail -3
PRODUCION_18032010 216:3e0a6415bbde
test 166:809065c08005
PRODUCION 125:d98f65c06bac
After editing .hg/cache/tags2-visible adding a label to the branch fast-export worked for me.
Anyone see any problem in editing .hg/cache/tags2-visible in this way?
I am trying to do a rather simple hg log -r rev1::rev2 to get a list of changesets between two tags.
However in this particular repository the build server automatically creates tags for a build that are numeric such as 2.12.5.0 based on the software version. When I try do an hg log -r using these numeric tags I get a unknown revision '2.12.5.0' response from mercurial. I have tried escaping with quotes with no change. Is it possible to issue this command with numerical tags, it works just fine for non numerical tags.
I believe the tag revset handles that:
hg log -r tag(2.12.5.0)::tag(2.12.5.2)
Shortened version of Ry4an's revset (derived from hg help revsets)
hg log -r "2.12.5.0::2.12.5.2"
I need to revert all files in a working directory that match the name "test" anywhere inside the filename.
Is it possible to revert all this 3 files by using hg revert -I syntax:
/includes/atest.txt
/test.txt
/test/test/test.txt
It should work (I cannot test it right now) with the following syntax, according to issue 1697:
Windows:
hg revert "glob:*test.*"
# or
hg revert -I "*test.*" --all
Unix:
hg revert 'glob:*test.*'
hg revert -I '*test.*'
(Note the simple quotes for Unix)
As noted by Blaise in the comments
On macOS/Unix, you need to use ** if you want to match files in any directory, e.g.
hg revert -I '**/*test.*'
To expand on the given answer above
You can include all files in subdirectories in your revert by using the following syntax:
Windows:
hg revert "glob:**\*test.*"
And I assume Unix would be:
hg revert 'glob:**/*test.*'
I named a hg flow hotfix like bug1234:somthing, and now I can not finish the hotfix I always get:
hg: parse error at 6: syntax error
Is there a way to escape the colon in the branchname, so I can finish my hotfix?
I'm using:
Ubuntu 11.04
Mercurial Distributed SCM (version 1.8.4)
HG Flow
started the hotfix with command:
$>hg flow hotfix start bug110711:Billing
after coding (bugfix) I tried:
$>hg flow hotfix finish bug110711:Billing
hg: parse error at 6: syntax error
I ran into the same problem. The hg operation I ran was different though, I tried to update to a branch with a colon in the name. The solution was to quote the command twice. So your command will look like this:
hg update -r '"My branch with a : character"'
The idea is that the outer quotes (') are for the shell and the inner ones (") are for the revset parser.
The error message of hg tag is more clear than the one of hg flow:
$ hg tag "bug1234:so"
abort: ':' cannot be used in a tag name
wrap the special word with "" and entire parameter in ''
e.g
hg log -r '::"first"'
I'm currently adding packaging to a something that is maintained in Mercurial. Currently the version is defined in the Makefile. I would like to change this so I can build daily packages or properly versioned packages.
Git provides a use "describe" function that can give you a description of the closest tagged build and current revision. For example if I run this in the kernel:
git describe HEAD
GIT returns:
v3.0-rc7-68-g51414d4
telling me that the revision is later than v3.0-rc7, with a git commitish of 51414d4
Is there something similar I can do in Mercurial?
Maybe something like this?
hg log -r . --template '{latesttag}-{latesttagdistance}-{node|short}\n'
Of course you should make an alias for that with AliasExtension.
Note however, unlike "git describe", this command will always show the "latesttagdistance" and "node|short" parts, instead of omitting them when latesttagdistance is 0.
This is a close emulation of git describe:
hg log -r . -T "{latesttag}{sub('^-0-.*', '', '-{latesttagdistance}-m{node|short}')}"
The {sub(...)} function ensures that a working copy that's exactly at tag v0.1.0 will show up as v0.1.0 and not v0.1.0-0-m123456789abc.
Note that the m before the hash is for mercurial, similar to the way git describe uses a g for git.
For convenience, create an alias by adding the following to your ~/.hgrc:
[alias]
describe = log -r . -T "{latesttag}{sub('^-0-.*', '', '-{latesttagdistance}-m{node|short}')}"
Then use the alias by simply typing hg describe.
If you'd like to emulate git describe --dirty, things get even messier – but you can still hide it all in an hg alias:
[alias]
describe = !
dirtymark=;
case " $1 " in " --dirty ") dirtymark=-dirty; ;; esac;
echo $($HG log -r . --template "{latesttag}-{latesttagdistance}-m")$($HG id -i) |
sed -r -e "s/\+\$/${dirtymark}/" -e 's/-0-m[[:xdigit:]]+//'
Now running hg describe --dirty will produce strings like:
v0.1.0
v0.1.0-dirty
v0.1.0-1-mf6caaa650816
v0.1.0-1-mf6caaa650816-dirty
Omitting the --dirty option means that you'll never get a -dirty suffix like (2) and (4), even when the working copy contains uncommitted changes.