hg shelve创建了一个提交,我不明白

时间:2016-06-10 03:44:47

标签: mercurial shelving

我对hg shelve感到有点困惑,因为文档相当稀疏。不知怎的,我在表单的日志中提交了一个提交:

changeset:   29:ad47ed1ca915
parent:      27:afca280f2884
user:        shelve@localhost
date:        Wed Jun 08 15:30:36 2016 -0600
summary:     changes to: ...

我对这来自哪里感到困惑。据我所知,搁架只是在本地机器上塞满东西而且他们不会进入历史。我误解了吗?

这是我的hg命令历史记录:

   hg status
   hg shelve list
   hg shelve --list
   hg unshelve
   hg unshelve
   hg resolve
   hg resolve -all
   hg resolve --all
   hg resolve --all
   hg clone a/ b
   # By this point we have the commit (since 28 is after 27)
   hg update -r 28

编辑:

好的,所以这个问题似乎是一种偏见。但是,因为我把变更集拉到其他地方,现在我仍然坚持使用变更集并且不确定该怎么做:(

EDIT2:以下是如何解决此问题的示例:

~ $ cd tmp
~/tmp $ mkdir shelve shelve/a
~/tmp $ cd shelve/a
~/tmp/shelve/a $ hg init
~/tmp/shelve/a $ echo a > a
~/tmp/shelve/a $ hg add a
~/tmp/shelve/a $ hg commit -m "a as a"
~/tmp/shelve/a $ cd ..
~/tmp/shelve $ hg clone a b
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/tmp/shelve $ cd b
~/tmp/shelve/b $ echo aa > a
~/tmp/shelve/b $ hg commit -m "a as aa"
~/tmp/shelve/b $ cd ../a
~/tmp/shelve/a $ echo aaa > a
~/tmp/shelve/a $ hg shelve 
shelved as default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/tmp/shelve/a $ hg pull -u ../b
pulling from ../b
searching for changes
adding changesets
adding manifests 
adding file changes 
added 1 changesets with 1 changes to 1 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/tmp/shelve/a $ hg unshelve
unshelving change 'default'
rebasing shelved changes 
rebasing 2:6696488053d1 "changes to: a as a" (tip)
merging a 
3 files to edit
was merge successful (yn)? n
merging a failed!
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
~/tmp/shelve/a $ hg heads
changeset:   2:6696488053d1
tag:         tip
parent:      0:845abf4a2513
user:        shelve@localhost
date:        Thu Jun 16 19:44:05 2016 -0600
summary:     changes to: a as a

changeset:   1:e1f75f582f85
user:        Alex Orange <crazycasta@gmail.com>
date:        Thu Jun 16 19:44:05 2016 -0600
summary:     a as aa

1 个答案:

答案 0 :(得分:0)

这是我的解决方案。还显示了更多的问题。如果你用一个未解决的脱钩而做一个hg拉,就会出现问题。

~ $ cd tmp
~/tmp $ cd shelve/a
~/tmp/shelve/a $ hg resolve a
merging a
3 files to edit
continue: hg unshelve --continue
~/tmp/shelve/a $ cd ../b
~/tmp/shelve/b $ echo Cause failure
Cause failure
~/tmp/shelve/b $ hg pull ../a
pulling from ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
~/tmp/shelve/b $ hg heads
changeset:   2:6696488053d1
tag:         tip
parent:      0:845abf4a2513
user:        shelve@localhost
date:        Thu Jun 16 19:44:05 2016 -0600
summary:     changes to: a as a

changeset:   1:e1f75f582f85
user:        Alex Orange <crazycasta@gmail.com>
date:        Thu Jun 16 19:44:05 2016 -0600
summary:     a as aa

~/tmp/shelve/b $ cd ../a
~/tmp/shelve/a $ hg unshelve --continue
rebasing 2:6696488053d1 "changes to: a as a" (tip)
unshelve of 'default' complete
~/tmp/shelve/a $ hg commit -m "a as aaa"
~/tmp/shelve/a $ cd ../b
~/tmp/shelve/b $ hg pull
pulling from /home/crazycasta/tmp/shelve/a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
~/tmp/shelve/b $ echo Problem
Problem
~/tmp/shelve/b $ hg heads
changeset:   3:a804c9f51cd6
tag:         tip
parent:      1:e1f75f582f85
user:        Alex Orange <crazycasta@gmail.com>
date:        Thu Jun 16 20:02:43 2016 -0600
summary:     a as aaa

changeset:   2:6696488053d1
parent:      0:845abf4a2513
user:        shelve@localhost
date:        Thu Jun 16 19:44:05 2016 -0600
summary:     changes to: a as a

~/tmp/shelve/b $ echo Solution
Solution
~/tmp/shelve/b $ hg strip -r 2
saved backup bundle to /home/crazycasta/tmp/shelve/b/.hg/strip-backup/6696488053d1-313495de-backup.hg
~/tmp/shelve/b $ hg heads
changeset:   2:a804c9f51cd6
tag:         tip
user:        Alex Orange <crazycasta@gmail.com>
date:        Thu Jun 16 20:02:43 2016 -0600
summary:     a as aaa