3

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.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Martin Thurau
  • 7,564
  • 7
  • 43
  • 80
  • Would http://stackoverflow.com/questions/125272/using-mercurial-whats-the-easiest-way-to-commit-and-push-a-single-file-while-le be of any help here? – VonC Feb 11 '11 at 12:18

3 Answers3

4

Simply copy the entire repository's folder.

Steve
  • 1,760
  • 10
  • 18
4

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.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • 2
    +1. We need to change our way of thinking with Mercurial. I might also add that if you do NOT want to push a series of changesets with uncompleted work to others, you can always have a look at the collapse extension (or the rebase extension) to make multiple intermediary commits into one... – Eric-Karl Feb 11 '11 at 22:35
1

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.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169