Mercurial: Mass Add and Remove All Files

By  on  

While I much prefer git and the GitHub workflow, Firefox's codebase (mozilla-central) is store in a mercurial repository.  There are tools that wrap mercurial so you can use a git-like interface, like git-cinnabar, but my philosophy is to learn the root tool so that I know what's going on every step of the way.  Imagine losing work to an abstraction problem -- that would be terrible!

One task you need accomplish is adding and removing files during the commit process, which is easy enough:

# Add file
hg add path/to/file

# Remove missing file
hg remove path/to/file

When there are many files being added and some being removed, you want to be very careful, but adding and removing files one by one can be time-consuming.  Once you've confirmed you want to add new files and remove missing files, you can run the following:

# Add new files, remove missing
hg addremove

If you only want to remove missing files, you can execute the following:

hg remove --after

I know that git branching and mercurial bookmarks are very similar, but I have much less confidence in my mercurial skills, so I'm always ultra careful not to mess up my commits.  Good luck!

Recent Features

  • By
    CSS @supports

    Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS.  What we end up doing is repeating the same properties multiple times with each browser prefix.  Yuck.  Another thing we...

  • By
    Interview with a Pornhub Web Developer

    Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...

Incredible Demos

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!