复制带有未提交更改的 Mercurial 存储库
我有一个 Mercurial 存储库 bitbucket.org 和我的 wokstation 上的克隆。克隆中有一些未提交(未钓鱼)的工作。我必须将这些克隆复制到我的笔记本电脑上,因为我将出差一两周并想做一些工作。
是否有一种简单且节省的方法可以将存储库及其未提交的更改复制到另一个设备?我知道我可以将存储库从工作站克隆到我的笔记本电脑,但这不会复制未提交的工作。
I have an mercurial repositry a bitbucket.org and a clone on my wokstation. The clone has some uncommited (unfished) work in it. I have to copy these clone to my laptop because I will be on a trip for one or two weeks and want to do some work.
Is there a simple and save way to copy the repository with its uncommited changes to another device? I knew I could clone the repo from the workstation to my laptop but this won't copy uncommited work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需复制整个存储库的文件夹即可。
Simply copy the entire repository's folder.
只需提交该工作即可。需要完成才能提交的工作是遗留下来的 CVS/SVN 思维。提交它,然后更新到它的父级并处理您想要处理的任何其他事情。当工作最终完成时,您将推送一个变更组而不是单个变更集,因此没有人会在这些间隙变更集的末尾有反编译阶段。
避免在 Mercurial 中提交工作(使用书架、阁楼、复制存储库等)是丢失工作的唯一方法——避免它。
Just commit that work. That work needs to be finished to be committed is left-over CVS/SVN thinking. Commit it, and then update to its parent and work on whatever else you want to work on. When eventually the work is done you're pushing a changegroup not individual changesets, so no one will have the uncompiling stage at the end of those interstitial changesets on them.
Avoiding committing work in Mercurial (using shelve, attic, copying repos, etc.) is the only way to lose work -- avoid it.
我更喜欢我的第一个答案(提交它),但如果您确实无法让自己提交未完成的工作,那么您应该使用 Mercurial 队列以及位于其自己存储库中的补丁队列。这很容易完成:
然后使用以下命令将未提交的更改作为补丁导入:
然后您可以:
然后您可以
qclone
该存储库并获取正在进行的工作及其覆盖的基础存储库。更多详细信息请参阅Mercurial 书中有关队列的章节。但实际上,永远没有充分的理由让不投入的工作超过一两个小时。
I prefer my first answer (commit it) but if you positively can't bring yourself to commit unfinished work then you should be using Mercurial Queues with a patch queue that lives in its own repository. This is easily done with:
Then you import your uncomitted changes as a patch using:
then you can:
Then you can
qclone
that repo and get both the work in progress and the base repository on which it's overlayed. More details are available in the Mercurial book's chapter on queues.Really, though, there's just never a good reason to have uncommitted work for more than an hour or two.