mercurial

How to revert a Mercurial hg pull?

对着背影说爱祢 提交于 2020-01-12 07:01:35
问题 If you do an hg pull and then an hg update (or an hg merge ), is there a way to back this out? Ie: revert your repository to the state prior to doing the hg pull ? I believe you can do hg update -r n where you would specify the changeset prior to the pull as n . Though I'm guessing this will still leave the changesets in your repository but this isn't really what we want. ?? 回答1: hg strip will remove revisions from a repository. Like all powerful commands, its dangerous, so be careful. https:

How can I remove some commits in Mercurial that were applied to the wrong branch and then replay them on the correct one?

我与影子孤独终老i 提交于 2020-01-12 06:50:32
问题 My colleague has committed twice on his repository on the wrong branch. What is the most effective way to take those two commits, get rid of them and then commit them correctly under the right branch? (the changes have not been pushed) We'd ideally like a way to do this from within TortoiseHG but of course, we'll use the command-line if it is the best option. 回答1: The Mercurial Queues (mq) extension can help. Given a change history that looks like this: @ changeset: 3:9dc681b56325 | summary:

TortoiseHg Copy Similarity feature

人走茶凉 提交于 2020-01-12 04:57:05
问题 When committing changes to Mercurial, it can auto-detect move/copy/renames by using the command hg addremove -similarity 100 The number after similarity indicates how similar two files need to be from 0-100% for mercurial to decide its a move, copy or rename instead of just a new file. This is a great feature. Can TortoiseHg do this? 回答1: Yes it can. If you take a look at the TortoiseHg manual you'll find section 4.12 entitled "Rename Guessing". To quote: Select one or more Unrevisioned Files

In mercurial, how to see diff between in a merge changeset and one parent without changes from the other parent?

不羁的心 提交于 2020-01-12 04:40:09
问题 Consider this trivial repo: mkdir temp cd temp hg init echo abc > file1 hg ci -A -m init echo def >> file1 echo hey > file2 hg ci -A -m A hg up -r0 echo ghi >> file1 echo hey > file3 hg ci -A -m B hg merge hg ci -m merge During merge, take "ghi" (doesn't really matter which side). The DAG is: 0 - 2 - 3 \- 1 -/ hg diff -r1:3 shows file1 change and new file3. hg diff -r2:3 shows new file2. Same for hg log -p -r3 and hg st --change 3 , because 2 is the first parent. My question is: how can I see

Mercurial - determine where file was removed?

£可爱£侵袭症+ 提交于 2020-01-12 03:10:08
问题 If you do hg log myfile -v you see a list of changesets that the file was modified in. In our case, in the most recent changeset, the file was removed. But you can't tell this by looking at the verbose (-v) output of hg log. Is there an easy Mercurial command you can use to determine if and when a file has been removed from the repo? Update : Note that this is on a Windows client, and we are using Mercurial v 1.4.3 Update 2 : Appears the answers below would work with a more recent version of

Is possible to change the default diff tool in Mercurial?

本秂侑毒 提交于 2020-01-11 15:28:07
问题 Every time I do an hg diff file.ext I end up using a console diff application. I would like to use Kdiff3 or WinMerge (I'm using Windows). Is there a way to change that? I can't find a reference in Mercurial documentation ( I'm not talking about merge! ). 回答1: I've solved this using a Mercurial built-in extension... I just have to add the following lines to Mercurial.ini (on Mercurial folder): [extensions] hgext.extdiff= [extdiff] cmd.vdiff = kdiff3 When I want to use kdiff3 instead of diff I

Custom revision properties in Mercurial?

回眸只為那壹抹淺笑 提交于 2020-01-11 10:42:09
问题 Can I setup a custom property for my hg repository so that I could store/retrieve its value for each revision? Like, weather in Tokyo at the time of commit, etc. Same for git? 回答1: This could be a job for: a pre-commit hook in Mercurial (not a precommit hook which runs before the internal commit occurs, when the list of files to commit is already known. But "pre-commit", a generic hook which runs before the commit begin) a git pre-commit hook (but you need to add your file with the updated

How can I create a mercurial hook that prevents new heads?

送分小仙女□ 提交于 2020-01-11 06:34:49
问题 I have several repositories that have been converted from SVN and moving forward we want make sure when people push to the repository they can't create additional heads. there are several hooks in the TipsAndTricks wiki page that prevent pushing if there are multiple heads, but how I can build a hook that prevents pushing new heads? It seems like the right way to do this would be to compare the number of heads from revision 0:parent and then compare 0:tip, but I can't seem to find a way to do

Load multiple .hgrc files - ie, some with machine-specific settings?

本秂侑毒 提交于 2020-01-11 04:41:39
问题 I'd like to keep two ~/.hgrc files: ~/.hgrc and ~/.hgrc.local – one with "standard" settings (eg, username ), the other with machine-specific settings (eg, setting a graphical merge tool). How can I do this with hg? For example, this is how I do it with Vim: # ~/.vimrc syntax enable source ~/.vimrc.local Then: # ~/.vimrc.local let work_code = 'code/work/.*' if expand('%:p:h') =~ work_code ... fi 回答1: There's a not-often used %include directive in mercurial 1.3 and later: From man hgrc : A

Versioning with Visual Studio 2010 and HG

被刻印的时光 ゝ 提交于 2020-01-11 03:22:06
问题 Recently me and my team got a HG repository for versioning as this would make it easier and better to develop our application. We are using Visual Studio 2010 and c# All of the project is under version control.. Unfortunately, when one of us commits, usually the other gets an error of some kind when opening the solution (due to the various files VS has) My question is: what files should be put under version control? (and removed in my case!) PS: we have 3 Projects: (using XNA) game, contents,