开发者

Copy Mercurial repository with uncommitted changes

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 rep开发者_StackOverflow社区o from the workstation to my laptop but this won't copy uncommited work.


Simply copy the entire repository's folder.


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.


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:

hg qinit --create-repo

Then you import your uncomitted changes as a patch using:

hg qnew --force name-for-this-work

then you can:

hg qcommit -m "work in progress"

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜