Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to checkout a single directory from a Mercurial (HG) repository?

So, I'm trying to checkout just the TestNG plugin from the Netbeans contrib repository. (Or is it module? I'm new to Mercurial, so I don't really know the lingo yet.)

When I run the following command...

hg clone http://hg.netbeans.org/main/contrib/

...I get the entire repository, which contains all of the the contrib plug-ins. Is it possible to just pull this location?

http://hg.netbeans.org/main/contrib/file/tip/testng/

Thanks!

like image 223
braveterry Avatar asked Feb 24 '10 17:02

braveterry


1 Answers

This concept is called "narrow cloning" and no, it's not possible at the moment in Mercurial.

It's on the radar of some of us that contribute to Mercurial but it's a hard problem to solve. For example:

  • How do you calculate the hash of any new commits you make if you don't have all of the files in the repo?
  • What happens if you try to view the history of a file in contrib/testng if that file was moved from another folder?
like image 112
Steve Losh Avatar answered Sep 19 '22 14:09

Steve Losh