Im trying to run the following command but its producing errors.
hg backout -r 2 -u Fraz --merge
The log of my repository is as follows:
Im a little lost as to why i can back out the 2nd changeset. When i run the above command, i get the commit gui appearing, i add a comment, save, close. Then i get a merge error, see below. Could someone please explain why this is happening?
EDIT seems to have something to do with the .bak file i had. Ive just rerun it via notepad and no errors occured. Also note, my comment on the first proposed answer is wrong. It adds a new changeset to repository which specifically undo's the specified changeset, hence why a merge is then necessary as u have two heads.
Backout is not undo - it basically allows to re-apply a changeset in reverse, undoing the changes of it.
Now if changes were done to the parts changed in the changeset to be backed out, you'll have to deal with the merge as you see it because the backout cannot be automatically applied (what should happen with the portions that are to be backed out but changed since the commit of the changeset to be backed out?).
After resolving the conflicts you should be able to successfully complete the operation.
Related
I've got a strange situation with Mercurial where some commits don't show up in hg log results or TortoiseHG file history. Here are some simplified details.
At the command line, if I type hg log file.txt I get, say, 8 commits showing up. The recent changes to that file on this branch don't show up. The changes on this branch are the result of a few squashed commit ranges from another branch, but no file removals.
If I type hg log --removed file.txt instead, all the commits I expect to see are there.
For the record, typing hg log -r "removes(file.txt)" shows nothing, not surprising since the file has never been removed.
My colleague sees the same issue when looking at their history. The changes are public in a shared repository.
Does anyone have any clues as to what would cause this?
Full disclosure: the changes ported from the other branch were compressed on the original branch, popped off into the patch queue and reapplied onto the new branch. I didn't think this would matter. Also, probably unrelated, these same commits were ported to a different branch via grafting. Interestingly, the graft commits DO show up in the commit log without --removed, though the original commits don't!
Mercurial 3.9.2.
TortoiseHg 4.6.1.
Windows 10.
The documentation(hg log --help) says that:
For performance reasons, 'hg log FILE' may omit duplicate changes made
on branches and will not show removals or mode changes. To see all such
changes, use the --removed switch.
As your changes on the files are the results of squashed commits (how did you squashed them by the way?), it is possible that they have been omitted by this heuristic.
I'm using mercurial Hg in command line. After created a patch, I needed to revert to another changeset due to some errors happened later. Now it's needed to refresh the patch file. When executing Hg qref it says, abort: working directory revision is not qtip. Also, hg parent is a tip.
I'll add an answer to help other people that may encounter the same error message in the future. I'm not sure our issues was identical but definitely related.
I got "abort: working directory revision is not qtip" while trying to apply a patch onto my working directory.
It turned out that I had older patches in the patch queue which caused the problem and after I deleted these and tried again it worked!
Here's what I did:
Opened a console window and navigated to the working directory where I entered the command:
hg qseries
this listed the patch queue. Then to delete the old patches I entered:
hg qdelete [patch name (which was just listed)]
The response in my case was "abort: cannot delete applied patch ..." and to resolve this I entered:
hg qpop
This unapplied the patch and then I could use the "hg qdelete" command again which now work. Repeated this until all old patches were gone and tried to apply the new patch again.
Found the solution in the "Mercurial: The Definitive Guide", written by Bryan O'Sullivan, under section 12.7.1. http://tortoisehg.bitbucket.io/hgbook/1.4/managing-change-with-mercurial-queues.html#id2858507
Hope someone finds this useful!
It happened due to popping the current head out of the queue. In order to refresh, the patch should have been taken into the head of the queue by qpush.
I am using Mercurial(TortoiseHG) as version-control system for our source code. I am unable to remove a file from the repository, from the command-line. I see several people on web, giving solutions like:
1. hg rm
2. hg remove
These commands do the operation of removal from the directory. However, when I pull the repository at a seperate place, the above file(supposed to be deleted) still shows up. I tried pusing the repo after performing the above commands as well, with:
hg push
But the files are not really removed from the repository. Do I need to configure anything extra for this removal operation?
I generally have the habit of committing at the leaf-level, and thus wasn't committing the root repo folder all the while. Sorry for the miscommunication.
When getting the latest code from a Mercurial repo on the command line, if there are changesets that need to be merged Mercurial raises a warning:
hg up
abort: crosses branches (merge branches or use --check to force update)
This is what I expect, and from the Mercurial book it says "Mercurial is telling us that the hg update command won't do a merge; it won't update the working directory when it thinks we might want to do a merge, unless we force it to do so." At this point I know I need to merge.
How can I get the same behaviour using TortoiseHg? When I hit "Update", it happily updates me to the most recent changeset. Is there a way to warn me that a merge is probably needed? The "Always merge (when possible)" option seems to only apply when you have uncommitted changes.
The reason you get an error from hg update on the command-line is that it doesn't know which revision to pick. There are 2 divergent default heads.
If you were to execute hg update -r <specific rev>, the command completes without error.
When using TortoiseHg, you update by:
right-clicking a specific changeset
selecting Update...
This translates to hg update -r <rev>, so there is no error.
Using TortoiseHg, you always have the revision graph in front of you. The graph shows when newly pulled changesets create a new head.
The Mercurial abort you are seeing is occurring because you have outstanding (ie: non-committed) changes in your working directory, are trying to perform an update, and Mercurial has decided that you should probably perform a merge instead.
TortoiseHg should also warn you about this, but it will do so in a different way. It will spawn a dialogue that asks if you want to Discard, Merge, or Shelve your outstanding changes. This is what it looks like in TortoiseHg v2.X.X, but it should be similar in v1.1.X:
If you're not seeing this in TortoiseHg, you may not have any outstanding changes. Try it again - are you seeing these options?
I've just recently moved a lot of my Views and Controllers into more appropriate locations and am now wanting to pull down recent changes from our central repo.
I've done a hg pull which worked fine and asked me to do a hg update to bring the changes down locally. This in turn informed me that I needed to do a hg merge however when I try this, I get a message stating that
abort: outstanding uncommitted changes
When I check this using hg status I see in the list all of the files that I've moved (so they're now deleted from their old location).
How do I tell Mercurial that I've removed these files? Do I have to go through each one of them and manually do a remove? Is this something that's possible using only the command line rather than doing it with a GUI tool?
From the command line to automatically hg rm the files you've removed you'd:
hg addremove
It's likely your GUI (you didn't say which you use) exposes that functionality too.
However, that's not what's causing your message. You have some already made local changes that mercurial does know about (unlike the removed files which it doesn't know about until you tell it), and you need a hg commit before you can merge.