The left/right files in BeyondCompare merge are reversed when using hg fetch vs an hg pull + hg merge. Is there any reason for this? Is there a way to keep the same configuration?
Update:
Related question/answer: Completely manual Mercurial merge
Yes, there's a reason. From hg help fetch:
When a merge occurs, the newly pulled changes are assumed to be "authoritative". The head of the new changes is used as the first parent, with local changes as the second. To switch the merge order, use --switch-parent.
This means a fetch is similar to the following manual workflow:
pull
update to new pulled head
merge
Using the --switch-parent option skips step 2 and thus prevents a reversed merge.
Related
I was trying to diff two files from two of my branches using Beyond Compare. Unfortunately although the display is fine and the diffs are displayed correctly, both of the file paths are temporary so I can't save.
I used this command to start the diff; hg bcomp --rev default:"Bug 70180" <filename>
I appreciate that you should only be able to save to the branch you're currently using, but this really limits the usefulness of a diff unless I can find a way round it.
Thanks,
The command you are issuing is to compare a range of changesets (<rev>:<rev>), assuming 2 in your case, so Mercurial gets both changeset files as temporary files before starting bcomp. To compare the current file (the one you want to modify and save) and the file from another revision, just give it the revision to compare to.
In your case, try this command line instead:
hg bcomp --rev "Bug 70180" <filename>
I'm trying to make a crontab that pulls and makes a repository every day for me, but whenever i do that and the repository merges the crontab gets stuck.
Is there a way to pull without prompting a merge and without deleting my code?
Is there a way to pull without prompting a merge
Just hg pull by itself does not merge, nor does it ask the user for anything. The local repository will be added to, but the local working directory will not be touched. Nothing will be deleted.
If your .hgrc file is using a [defaults] section, you might be silently adding the -u/--update option without realizing it. That option tries to automatically do an update. If that's the case, then don't use defaults sections.
If this doesn't answer your question, then show us exactly what commands your cron entry is running, what the output is, where it "gets stuck" (is SSH asking for authentication credentials?), and which part you're trying to avoid.
The literal answer to how do you pull without merging is you hg fetch which gets the new remote changesets but doesn't update any files in your working directory. It sounds like what you're really asking though is "how do I update to tip and throw away any local changes?". If that's what you're going for you'd do:
hg fetch # gets new changesets
hg update --clean # update to latest files THROWING AWAY LOCAL CHANGES
Is that what you're going for?
I have few questions and i would appreciate your help:
Say, i need specific folders from another repo merged into my repo/working dir. How would i do properly?
If i pull anothers repo and then merge. Afterwards, realizing this is not working, so i call 'hg update -C'. Did this cleaned my repo from the changes i pulled from another repo that i released is not what i need?
Can i do a pessimistic merge where it only adds and updates, but not deletes?
Thanks for helping learn Mercurial
Margots
I would just copy the needed files and folders from the other repo and commit them. You could technically do what you want as a merge but it's a manual, error-prone, finicky process.
If you haven't committed your merge update -C will abandon the merge. Do update -C <myVersion> to get the specific version you want.
This would be a messy process (see 1.) and I wouldn't bother. If there are problems you can always revert your file to a previous version.
We have a Mercurial repository on BitBucket. This repository is used by a bunch of people.
Now I have another local repository which is a super-set of the BitBucket repo. What I want to do is work in my repo and get changes from the other repo whenever the others commit and push. I do not want to get the history of those other files just the last revision.
What is the best way to do that?
At the moment, I have cloned the other repository and I pull changes from that one into mine. That works but my issue is that whenever I get a change I have to do a huge merge in order to fix my repository. Is there another way to just get changes from the other repository and put them in my branch? I don't care about getting the history of those files. I could just copy and paste them in my repo but I'd like to be able to merge changes whenever possible which is not possible just by overwriting the updated files by copy-pasting...
You could put the other repository as a subrepository into yours.
This is not exactly what you requested, since you said that you don't want the history of the other repository, only the last revision.
But as you already noticed yourself, everything else that you tried (pulling the other repository into yours, copying files manually, ...) is a hassle.
With subrepositories, you can just update the subrepository to get the changes tht the others made.
I wanted to combine two projects from separate remote mercurial repositories into the same local directory (one is a framework, the other my code).
My thoughts about doing this were to simply clone them both to the same working directory but this generates the error abort: destination 'C:\Workspace\project' is not empty using tortoise hg.
Is this the right way to approach this and if so does anyone know how to get this to work?
First of all, are you sure you want to do this? There's no way to safely push back to the original sources without getting everything, from both "projects" after you have combined.
In other words, they effectively become one project, and it won't be easy to split it back up.
You should consider using sub-repositories which is the typical way that Mercurial deals with these sorts of things.
Having said that, to combine two distinct repositories, you need to pull one into the other.
In other words, here's what you would do:
Clone one of the projects
Pull into your new clone, and specify the URL to the second project. You will need to force the pull, otherwise it will complain about not being the same repository.
Optionally: Move one or both of the projects into their own sub-directories, to separate them in the directory structure
Merge the two heads to combine them into one big set of files
If any of this was unclear, please leave a comment with your questions and I'll update/edit accordingly.