We have here in mercurial repository, for example, two development branches (I am writing the code in one branch), where code changes intensively in parallel before merging with default branch.
Please help me to take changes from other development branch into mine? Can I do this trought SourceTree?
You can do merge with SourceTree.
Let's say that your branch name is dev1 and the other branch name is dev2.
To merge changes in dev2 branch to dev1 branch do following (commands are available under Repository menu, or right click popup menu)
Select dev1 branch -> Update To
Select dev2 branch -> Merge -> dialog will ask you Are you sure you want to merge 'dev2' into your current branch -> OK
Resolve conflict if there are any and Commit
Note: As general rule when you are doing something in your repository and you are not quite sure how it will end up, I suggest that you create backup copy of your repository first. In case that anything goes wrong, just restore the backup.
Related
I have successfully made patches before, but my most recent patch is empty. I have done two commits, and now I want to make a patch which includes the changes in those last two commits.
I tried selecting the earliest revision that I wanted in the patch, but nothing showed up in the commit tab (the check mark), and nothing was in the patch I created either.
Can I create a patch after I have committed, and if so how?
To make patches after committing, just select both revisions, right-click and choose Export Selected...:
This will export one patch file for each patch:
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.
User A commited and pushed File A to the repo incrementing the version to 10. In the meantime, User B commited File B and started pushing out to the repo. User B got a message about 'pushing changes will create a new head, merge when possible'. User B did not know what to do at that time.
User B is me. What should I have done? I just freaked out and re-cloned the repo. My local copy was at version 9 at the time of my commit. So I wanted to update mine to 10 and then push mine out.
I am using Mercurial Hg.
Thanks.
You have to pull changes and merge them (In details you can read about it here: http://hginit.com/04.html)
Also - don't refer to revision number, it makes sense only for single repository. As long as you have several copies of the one - the better is to refer to the commit by its hash.
I am looking for a way to create an alias for a user that has commited to a mercurial repository. For example, if there is a user named user1 I'd like every commit done by him to be under the name user2.
If you're talking about changing the name that was already used for some commits, you can do that using hg convert with a source and destination type of hg and a --authors mapping file. However, in doing so you change the hash of every changeset, and if anyone has already cloned your repo you'll be hosing them.
If you're talking about commits to come, then just make them whatever you want using the -u option to hg commit.