9

I'm working on my thesis and storing changes in mercurial. I'm not getting an error that I've got multiple heads, which I'm confused about -- I've only got one working repository which I push occasionally to bitbucket. Here's what happened:

$ hg commit -m "Fixing up..."
abort: No such file or directory: /Users/me/Dropbox/thesis/thesis_tex/simple.pdf
$ hg commit -m "Adding in page headers"
created new head

...one more commit, not having realized that having created a new head was a problem...

$ hg push
pushing to ssh://hg@bitbucket.org/...
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)

$ hg heads
changeset:   26:3823a395b1ce
tag:         tip
user:        me
date:        Fri Aug 26 09:39:45 2011 -0400
summary:     Adding...

changeset:   24:c7c6517d4281
user:        me
date:        Thu Aug 25 16:34:42 2011 -0400
summary:     Fixing up...

How can I easily get rid of the other head, without messing up my working directory? Why did a second head get created? Is there a problem with keeping mercurial repositories in dropbox folders?

Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
Noah
  • 21,451
  • 8
  • 63
  • 71

2 Answers2

7

How can I easily get rid of the other head, without messing up my working directory?

Merge the branches with hg merge.

Is there a problem with keeping mercurial repositories in dropbox folders?

This seems redundant to me, since Dropbox keeps a 30-day history on your files. I'd choose either Hg+Bitbucket (or whatever Mercurial hosting) or Dropbox, but not both.


Edit: Why not use Mercurial and Dropbox? Here's why.

Ben Hughes said it well:

By keeping your Mercurial repo on Dropbox you’re version controlling your version control system files. If you somehow manage to cause a conflict with files in your .hg directory, things could get messy. Recoverable, but messy.

Community
  • 1
  • 1
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • okay, got it merged. Aside from it being redundant, is there a reason it shouldn't work, assuming I let dropbox sync before making changes? Was it dropbox that made it two-headed? – Noah Aug 26 '11 at 14:23
  • Honestly, I have no idea why the second head was created. Dropbox could have definitely bungled things up, though. See my edit. – Matt Ball Aug 26 '11 at 14:32
  • thanks for the links; I think I'll continue with this setup as it has worked well for over a month so far, but I'll keep in mind what you've linked to from Ben Hughes. – Noah Aug 26 '11 at 15:43
3

I disagree with @Matt Ball on the dropbox matter.

I think redundancy is your friend. Also the purpose of Hg and the dropbox is slightly different in your case.

Dropbox backs up for you automatically (as well as tracking file changes and letting you work on any machine with internet and making it easy to share your work.) and Hg lets you work offline and commit in logical chunks (as well as working as backup when you sync).

I have used Hg in my dropbox folder without problem for at least a year and I have not experienced any problems.

If you work on more than one machine and have the dropbox/Hg combo on all machines I suggest that you let dropbox do the syncing.

steenhulthin
  • 4,553
  • 5
  • 33
  • 52