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
    Write Better JavaScript with Promises

    You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...

  • By
    Introducing MooTools Templated

    One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating: new Element Madness The first way to create UI-driven...

Incredible Demos

  • By
    Detect Vendor Prefix with JavaScript

    Regardless of our position on vendor prefixes, we have to live with them and occasionally use them to make things work.  These prefixes can be used in two formats:  the CSS format (-moz-, as in -moz-element) and the JS format (navigator.mozApps).  The awesome X-Tag project has...

  • By
    CSS Gradients

    With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements.  CSS gradients are another step in that direction.  Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...

Discussion

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