It is my first time using Mercurial and I am having trouble with it.
I used hg add * and now I am trying to commit by using the hg com command but It's giving me back this error:
Nathans-MacBook-Pro:biogene Nathan$ hg com -m "First time commit"
abort: could not lock repository /Applications/MAMP/htdocs/merc/biogene: No such file or directory
Can anyone provide any insight as to what's going on? That directory certainly exists as I am currently inside of it.
Have you created a repository here first?
hg init
Related
trying to clone the cooliris project using the command provided by Google;
hg clone https://cooliris-toolkit.googlecode.com/hg/ Cooliris-ToolKit
but it runs though and always fails with
updating to branch default abort: No such file or directory
whether I had created the folder Cooliris-ToolKit or not.
Can anyone suggest solution for this please?
Thanks.
Here is a working command:
hg clone https://cooliris-toolkit.googlecode.com/
https://code.google.com/p/cooliris-toolkit/source/checkout
I have got a question regarding suprepositories. Our project is set up like this:
+ projectA
+ some files
+ dependencyA
+ some files
dependencyA is a subrepository. It was created this way:
cd projectA
mkdir dependencyA
cd dependencyA
hg init
hg pull ssh://hg#somerandomiphere/dependencyA
cd ..
echo dependencyA = ssh://hg#somerandomiphere/dependencyA > .hgsub
hg add
hg commit
hg push
If I make changes to the suprepository, then commit and push them from main project. Both of them will be pushed to the server since its recursive. Now my colleague wants to pull changes from the server. But since nothing was changed in the main project, it wont work. But if I change something in the main project and push it to server. Upon hg pull he will get the newest changeset and if he does hg update then, it will update the subrepository as well. This is expected behaviour.
Now my question would be, if there is a way to pull changes, but only for subrepository without making a new clone of it or what would be the best way to do it.
Subrepository in Mercurial wiki, p. 2.5 "Pull"
The 'pull' command is by default not recursive. This is because
Mercurial won't know which subrepos are required until an update to a
specific changeset is requested. The update will pull the requested
subrepositories and changesets on demand. To get pull and update in
one step, use 'pull --update'.
Note that this matches exactly how 'pull' works without
subrepositories, considering that subrepositories lives in the working
directory:
'hg pull' gives you the upstream changesets but doesn't affect your working directory.
'hg update' updates the contents of your working directory (both in the top repo and in all subrepos)
It might be a good idea to always pull with --update if you have any
subrepositories. That will generally ensure that updates not will miss
any changesets and that update thus not will cause any pulls. If the
pull with update fails due to crossing branches then 'hg update' must
be used to get all the subrepository updates.
What was suggested above works like I thought it would. The real problem was my way of creating a subrepository.
Instead of:
cd projectA
mkdir
dependencyA
cd dependencyA
hg init
hg pull ssh://hg#somerandomiphere/dependencyA
It should have been a simple:
hg clone ssh://hg#somerandomiphere/dependencyA dependencyA
As we know .hgsusbtate will lock the subrepo on specific revision after commit. This is what happened, but (!) doing hg pull in subrepository ended with an error
paths cannot contain dot file components
So this means my subrepo was locked on the revision it was updated after commit and it could not pull changes from its repository due to the error shown above. Why this happened is explained pretty well in this accepted answer.
Solution:
cloning is the way to go
I recently needed to strip some changesets from my Mercurial repository. I then tried to run a build from TeamCity but got the following error message:
[09:44:25]: Updating sources: agent side checkout... (16s)
[09:44:42]: [Updating sources: agent side checkout...] Failed to perform checkout on agent: 'cmd /c hg update -C -r 507b8c8f4cdb' command failed. stderr: abort: unknown revision '507b8c8f4cdb'!
The error makes sense since the changeset no longer exists in the repo, but I don't know how to reset TeamCity to pull from the new tip. I'm guessing that I could copy the TeamCity build configuration to a new build, but then I'd lose my history.
Is this possible? Or have I corrupted my TeamCity build and need to start up a new one?
Add a new commit to the repository so that the tip revision gets updated.
I am familiar with TFS and Vault, but having just started using Mercurial I seem to be getting into a bit of a mess.
Heres what I (think) I've done:
-Created a central repository on bitbucket.org
-On my desktop PC, cloned repository from bitbucket, added files, commit them, push them to bitbucket
-On my laptop, cloned repository from bitbucket, pulled files, added more files, commit them, push them to bitbucket
I've continued to add, edit etc on the different computers.
Now I've noticed that some files from each computer are not in the bitbucket repository, and therefore only in the local repository. No amount of pulling and pushing seems to get it into the bitbucket repository.
What is the most likely thing I've done wrong?
Is there a way to 'force' by changes up to the bitbucket repository?
Did they get into your local repository? I suspect not, i.e. they were new files that were not added to the commit. Use hg add to add them to the changeset before committing or whatever the equivalent is for whatever mercurial interface you're using.
Edit:
Here's the help from Mercurial:
C:\Users\Bert>hg add --help
hg add [OPTION]... [FILE]...
add the specified files on the next commit
Schedule files to be version controlled and added to the repository.
The files will be added to the repository at the next commit. To undo an
add before that, see "hg forget".
If no names are given, add all files to the repository.
...
See Mercurial: The Definitive Guide (a.k.a. the hg "red book") for more info:
http://hgbook.red-bean.com/read/mercurial-in-daily-use.html
Telling Mercurial which files to track
Mercurial does not work with files in your repository unless you tell it to manage them. The hg status command will tell you which files Mercurial doesn't know about; it uses a “?” to display such files.
To tell Mercurial to track a file, use the hg add command. Once you have added a file, the entry in the output of hg status for that file changes from “?” to “A”.
$ hg init add-example
$ cd add-example
$ echo a > myfile.txt
$ hg status
? myfile.txt
$ hg add myfile.txt
$ hg status
A myfile.txt
$ hg commit -m 'Added one file'
$ hg status
use "hg -v help add" to show global options
Mercurial newbie here, I have a simple question.
I deleted one of my files from Mercurial and I want to get it back. I used to do svn up in Subversion, but in Mercurial it doesn't work, I tried hg up, and it does nothing.
I tried hg up to a specific file, and surprisingly (to me..) it told me:
abort: unknown revision '74656d706c617465732f6c6f67696e2e68746d6c'!
I tried to specify a revision and it told me:
abort: please specify just one revision
Isn't there a simple way of doing what I want?
Use hg revert.
hg revert -r REV path/to/file
where REV is the revision of the repository that contains the file you want to recover. See hg help revert for details.