How to remove working copy from clone Mercurial?

When cloning a repository using mercurial, you can pass the -U / - noupdate flag to create a clone without a working copy. Is it possible to delete a working copy if I forgot to pass this flag during cloning? And if so, how?

This is conceptually similar to this git question , but for mercurial.

+50
clone repository mercurial
Nov 11 '10 at 20:00
source share
2 answers

Perhaps I do not have enough nuances. Someone can fix me.

The documentation on the Mercurial wiki page contains the following information about bare repositories:

"Although this is a small problem, Mercurial can obviously handle an open repository, that is, a repository without a working copy. In Git, you need a configuration parameter, whereas in Hg you only need to check the zero revision, for example:"

hg update null

Zero revision is the empty state that you have when you just finished hg init . This is the parent element of revision 0 (and the second parent code of all changes without merging), and by updating it back, you will again get an empty working copy.

The link may look ironic:

+75
Nov 11 '10 at 20:21
source share
 rm -rf * 

This removes all "visible" files (under * nix). Since the Mercurial repository is stored in a β€œhidden” .hg file, it will not be affected. Unfortunately, none of your own hidden files, for example .hgignore .

To restore a working copy, I'm sure the hg update flag works, but it will also be:

 hg revert --all 
-17
Nov 11 '10 at 20:26
source share



All Articles