4

I made a repository as a test a while ago but I now want to create a different repository with the same name - is there a way to delete an existing repository using mercurial-server, and create another one with the same name? Or perhaps a way to overwrite the contents of a repository?

Michael La Voie
  • 27,772
  • 14
  • 72
  • 92
Ben Hymers
  • 25,586
  • 16
  • 59
  • 84

1 Answers1

6

Mercurial repos are just file system paths, so you should be able to remove the the repo and rebuild a new one it isn't place. IN looking it appears the mercurial-server wraps standard repos with a special restricted shell, to control access. I've never used mercurial-server, but I don't see why you couldn't create a backup of the directory at the filesystem level, then rm it and start over..

Doon
  • 19,719
  • 3
  • 40
  • 44
  • 1
    Yes you can. I already did that a couple of times under Mercurial server. Just rm -rf on the server machine, and hg will forget all about the previous repo. – Christophe Muller Aug 04 '10 at 07:11
  • This is probably a silly question, but how do I do that when the hg user has no password and I can't see the path to be able to rm it using sudo? I could give root a password temporarily I guess but that seems messy. – Ben Hymers Aug 04 '10 at 09:40
  • 1
    sudo or could also try sudo su hg for example: sudo sh will give you a root shell, and you should be all set to remove the directory (assuming your sudo will allow it) sudo su hg should switch you to the hg user, and also allow you to remove the directory (There are cases where this won't work such as invalid shell, etc..) but one of the 2 above should work. – Doon Aug 04 '10 at 12:18
  • 4
    sudo -u hg -H -s will start a shell as the "hg" user; "cd" takes you to their home directory. Then "cd repos; rm -rf repo/i/dont/want". – Paul Crowley May 04 '11 at 13:06