我是一个善变的新手,想学习如何使用我的repository。你能告诉我如何将我朋友的工作与我合并吗?感谢
$ hg update tip
abort: crosses branches (merge branches or use --clean to discard changes)
$ hg heads
changeset: 265:ac5d3c3a03ac
tag: tip
user: roberto.cr
date: Thu Oct 06 07:32:15 2011 +0000
summary: fixing "redirects" links
changeset: 261:6acd1aaef950
user: niklasro
date: Thu Oct 06 07:53:19 2011 +0000
summary: auth backend + js
$ hg update
abort: crosses branches (merge branches or use --clean to discard changes)
我可以使用hg resolve吗?
$ hg resolve
abort: no files or directories specified; use --all to remerge all file
$ hg glog | more
@ changeset: 266:2bf5b62720fc
| tag: tip
| parent: 261:6acd1aaef950
| user: niklasro
| date: Thu Oct 06 12:48:20 2011 +0000
| summary: added
|
| o changeset: 265:ac5d3c3a03ac
| | user: roberto.cr
| | date: Thu Oct 06 07:32:15 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 264:2fd0bf24e90f
| | user: roberto.cr
| | date: Thu Oct 06 07:29:58 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 263:29a373aae81e
| | user: roberto.cr
| | date: Thu Oct 06 07:25:05 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 262:d75cd4d3e77a
| | parent: 260:dfb54b99f84d
| | user: roberto.cr
| | date: Thu Oct 06 07:24:55 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 261:6acd1aaef950
|/ user: niklasro
| date: Thu Oct 06 07:53:19 2011 +0000
| summary: auth backend + js
|
o changeset: 260:dfb54b99f84d
| user: niklasro
| date: Wed Oct 05 05:34:37 2011 +0000
| summary: FB buggfix example.html
|
o changeset: 259:92fb6b1bc492
| user: niklasro
| date: Thu Sep 29 16:42:33 2011 +0000
| summary: changes
解决方案是hg revert -a
,现在看起来很成功
$ hg glog | more
@ changeset: 267:3b2bb6de33eb
|\ tag: tip
| | parent: 266:2bf5b62720fc
| | parent: 265:ac5d3c3a03ac
| | user: niklasro
| | date: Thu Oct 06 16:06:21 2011 +0000
| | summary: merge
| |
| o changeset: 266:2bf5b62720fc
| | parent: 261:6acd1aaef950
| | user: niklasro
| | date: Thu Oct 06 12:48:20 2011 +0000
| | summary: added
| |
o | changeset: 265:ac5d3c3a03ac
| | user: roberto.cr
| | date: Thu Oct 06 07:32:15 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 264:2fd0bf24e90f
| | user: roberto.cr
| | date: Thu Oct 06 07:29:58 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 263:29a373aae81e
| | user: roberto.cr
| | date: Thu Oct 06 07:25:05 2011 +0000
| | summary: fixing "redirects" links
| |
o | changeset: 262:d75cd4d3e77a
| | parent: 260:dfb54b99f84d
| | user: roberto.cr
| | date: Thu Oct 06 07:24:55 2011 +0000
| | summary: fixing "redirects" links
| |
| o changeset: 261:6acd1aaef950
|/ user: niklasro
| date: Thu Oct 06 07:53:19 2011 +0000
| summary: auth backend + js
|
o changeset: 260:dfb54b99f84d
| user: niklasro
| date: Wed Oct 05 05:34:37 2011 +0000
| summary: FB buggfix example.html
|
o changeset: 259:92fb6b1bc492
| user: niklasro
| date: Thu Sep 29 16:42:33 2011 +0000
| summary: changes
答案 0 :(得分:22)
这里的基本问题是您的工作目录不干净。 Mercurial防止人们在未提交更改的情况下意外地在分支之间跳转,因为这通常是一个坏主意。
让我们从第一个命令开始:
$ hg update tip
abort: crosses branches (merge branches or use --clean to discard changes)
这告诉你两件重要的事情:
你有两个选择:
那么你有什么变化?第一步是运行'hg status'。正如你所说'hg status输出许多文件前面加1或?'。那些'1'实际上是'!'指示已删除/丢失的文件(获得更好的字体!)。您应该对摘要进行双重检查,这将为您提供如下输出:
parent: 15200:fa6f93befffa
patch: use more precise pattern for diff header color styling (issue3034)
branch: default
commit: 1 deleted, 1 unknown (clean) <- your changes
update: (current)
如果您此时尝试合并,则会收到如下消息:
$ hg merge stable
abort: outstanding uncommitted changes (use 'hg status' to list changes)
如果您有丢失文件以外的其他更改,则需要考虑提交它们。
如果这些丢失的文件是您唯一的更改,则可以放弃它们:
hg revert -a
完成此操作后,您处于Mercurial允许您更新或合并而无需投诉的状态。
最后,你说“hg status从其他项目输出许多文件,因为它开始于..我添加的文件是唯一应该添加的文件。”这是对Mercurial如何运作的基本误解。与CVS或SVN不同,对于Mercurial而言,只有一个项目,并且动作(提交/更新/合并/状态)一次在整个项目树上工作。子目录不是具有不同历史的独立项目。
答案 1 :(得分:16)
合并这两个头怎么样?
hg merge
答案 2 :(得分:3)
由于在mercurial mailing list上对此进行了更深入的讨论,因此问题似乎是mpm建议,工作目录不干净。
总结该线程,在版本1.9m之前,如果文件刚被删除,Mercurial会将nothing changed
说成hg ci
。
在1.9处,这更改为nothing changed (1 missing files, see 'hg status')
更明确地表明虽然没有任何文件已经更改,但仍有删除,您需要告诉hg您想要做什么他们。使用hg revert -a
放弃更改,或hg addremove
加hg commit
告诉hg有关更改并提交更改。
另外,正如Matt Mackall所说:
询问状态仅显示已删除的文件可能会有所帮助:
$ hg st -d
! setup.py