4

I am using the mercurial command line and I can't find out how to tag a certain folder. My source repository consists from different libraries so I'd like to tag them separately.
I also mistakenly tagged my whole source tree, so I'd like to know how do I erase a tag before I create the new tag.

the_drow
  • 18,571
  • 25
  • 126
  • 193

2 Answers2

3

You can only tag a revision, not a specific file or folder.

To erase a tag, issue the following command:

hg tag --remove TAG

To move a tag to a different revision:

hg tag --force TAG --rev REV

Note that in both cases, you'll end up creating a new changeset on top of the one you're at, you can't eradicate the commit that was created when the original tag was made.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • Than how should I manage different libraries? Must they be under different repositories? I am using the bitbucket private repository on a free account so I must maintain less than 5 repositories which is not practical. Is there a way around it? – the_drow May 11 '11 at 15:18
  • You would put different libraries into different repositories, and then you would reference them as sub-repositories by projects that use them (or include a binary version if they're stable.) Why do you have to maintain less than 5 repositories? – Lasse V. Karlsen May 11 '11 at 15:49
  • @LasseV.Karlsen: Because I'm on a free account as of now. – the_drow May 11 '11 at 16:00
  • @LasseV.Karlsen: Ok last problem. I am getting: `pushing subrepo Logging to https://the_drow@bitbucket.org/the_drow/agile.crm.fra mework/Logging warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7 c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace rts config setting) abort: HTTP Error 404: NOT FOUND` because the folder doesn't exist on the server. What should be done to sync it. I'm trying to hg push. – the_drow May 11 '11 at 16:00
  • I don't know what that error message means, but free account has unlimited repositories, both private and public. – Lasse V. Karlsen May 11 '11 at 16:12
  • @LasseV.Karlsen: But I am limited to associating 5 users for all repositories which means that if I want to commit I have to grant myself access to 5 repositories only. – the_drow May 11 '11 at 16:21
  • @the_drow: See here: http://stackoverflow.com/questions/5967563/using-subrepositories-with-bitbucket – the_drow May 11 '11 at 16:42
  • @the_drow, you can commit to all of your private repositories, be it 1 private repository, or 100 of them. You don't need a separate user for each. – Lasse V. Karlsen May 11 '11 at 19:08
  • @LasseV.Karlsen: So why do they have paid plans for? – the_drow May 11 '11 at 19:12
  • More unique users. For instance, if you let me have push access to your project, that would be 2 users (you and me.) When you need more than 5 unique users to your private repositories (users for public repositories don't count towards this limit), you need to pay. But for just you, you can create as many private repositories as you like. – Lasse V. Karlsen May 11 '11 at 19:15
  • It's stated on the pricing page even: https://bitbucket.org/plans - "All plans include unlimited public and private repositories" and "What is a user? Someone with read or write access to one of your private repositories." and "Is Bitbucket free for Open-Source? Yes... sign up for the 5 users free plan and your public repositories can have unlimited users." – Lasse V. Karlsen May 11 '11 at 19:18
  • I see you have posted an issue on the Mercurial issue tracker about being able to tag a folder. Note that there is no way that will ever happen. Tags in Mercurial are for changesets, the whole workflow model revolves around *not* having multiple distinct projects inside the same repository, so you might as well just learn how to deal with that (ie. no tag for folders) sooner rather than later. – Lasse V. Karlsen May 12 '11 at 09:16
2

As Lasse states, you can only tag a revision of the entire repository in Mercurial. In order to tag different components in your repository you could consider using Mercurial Subrepositories. Subrepositories allow you to treat individual components (what you are calling libraries) as independent repositories, and pull them together into a single, functional unit.

In terms of BitBucket's limitation on private repos - you could consider making some of them public, or placing the main repository on a local machine or server if you're concerned about exposing source publicly. If you're interested in hosting something yourself, Redmine is a good free tool that would allow you to serve as many repos as you want.

dls
  • 4,146
  • 2
  • 24
  • 26
  • How would you refactor (if that's the right word) a one monolithic repository to a main "framework" repository that is pushed to the server and multiple library subrepositories that are only local? – the_drow May 11 '11 at 15:30
  • I followed the tutorial, and now the subrepository is gone. What could be wrong? I think I got the `$ echo nested = nested > .hgsub` wrong. I don't quite get what should I replace nested = nested with. – the_drow May 11 '11 at 15:49