2

I'm trying to clone a specific tag from an existing repository from Kiln using Mercurial.

I have tried commands like:

hg clone --verbose [Source URL] -b [tag number] [Dest]

hg clone --verbose [Source URL] -r [tag number] [Dest]

hg clone --verbose [Source URL]/#[tag number] [Dest]

hg clone --verbose [Source URL]/[tag number] [Dest]

but nothing works.

a stone arachnid
  • 1,272
  • 1
  • 15
  • 27
kavya M
  • 31
  • 1
  • 2
  • Do you really mean to "clone" a tag? Or do you mean you want your working directory to be in the state as-of that tag? Cloning affects your local copy of the repository but is a separate operation from actually updating your local working folder. – StayOnTarget Jul 18 '18 at 18:19
  • I want to clone only a specific tag version. I don't want to clone any extra files. – kavya M Jul 18 '18 at 18:31

1 Answers1

2

you can clone a specific commit hash or a specific branch but I'm afraid you can't clone a tag.

The best solution I see is for you to get the commit hash for the tag via the web interface of the repository and use the hash for cloning with this syntax:

hg clone --verbose [Source URL] -r [tag number] [Dest]

Boris Feld
  • 825
  • 7
  • 8
  • Thanks for answering but I'm completely new to Mercurial . Can you please elaborate on hash? What do you mean by use the hash for cloning? – kavya M Jul 18 '18 at 16:10
  • Yes of course. Like git each commit is uniquely identified with a hash that looks like `88be288e8ac1`. Usually mercurial repositories are hosted with hgweb, which is bundled into Mercurial. For example, with Mercurial itself, it is hosted on: https://www.mercurial-scm.org/repo/hg/. On the left you have a `Tags` link. If you click on it and on a specific tag, you will arrive on a page like that: https://www.mercurial-scm.org/repo/hg/rev/4.6.2 where you can see the hash `0b63a6743010` on the top of the page. That's the hash you can pass to the clone command. – Boris Feld Jul 19 '18 at 07:36
  • That really helps! Thanks a lot :) – kavya M Jul 19 '18 at 20:31