hg remove directory from repo?

mercurial

Solution

Yes. Because mercurial doesn't track directories at all, only files, it only creates directories that have files in them, and if someone `hg updates` to a revision any directories that become empty are automatically removed. So if you do:

hg remove directory/*
hg commit -m 'removed all files in directory'
hg update -r 0   # updates to a different revision
hg update tip    # jump back to the tip

That last update would remove the directory. For everyone else it's even easier. When they `hg update` to your new changes their directory will just vanish (provided they have no uncommitted file in it).

Problem

I'd like to remove a directory and all the files in it from a repo. I have removed all the files with `hg remove`, but how do I remove the directory itself? Will it just automatically vanish once I commit all the removed files?

Original source