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
    Camera and Video Control with HTML5

    Client-side APIs on mobile and desktop devices are quickly providing the same APIs.  Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop.  One of those APIs is the getUserMedia API...

  • By
    Facebook Open Graph META Tags

    It's no secret that Facebook has become a major traffic driver for all types of websites.  Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly.  And of course there are Facebook "Like" and "Recommend" widgets on every website.  One...

Incredible Demos

  • By
    Event Delegation with MooTools

    Events play a huge role in JavaScript. I can't name one website I've created in the past two years that hasn't used JavaScript event handling on some level. Ask yourself: how often do I inject elements into the DOM and not add an...

  • By
    Elegant Overflow with CSS Ellipsis

    Overflow with text is always a big issue, especially in a programmatic environment. There's always only so much space but variable content to add into that space. I was recently working on a table for displaying user information and noticed that longer strings were...

Discussion

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