Documentation : how to "undo" hg up
Adrian Buehlmann
adrian at cadifra.com
Thu Sep 18 05:09:48 CDT 2008
On 17.09.2008 23:30, Peter Hosey wrote:
> On Sep 17, 2008, at 14:05:22, Patrick Waugh wrote:
>> Can someone explain what [hg up null] does, perhaps with an example?
>
> Your working copy is relative to a specific version—a specific moment
> in time.
>
> `hg status` and `hg diff`, with no options, compare to the current
> version of the working copy.
>
> `hg up` is hg's time-travel command. It does two things:
>
> 1. Changes the version that your working copy is relative to
> 2a. Merges changes between the former current version (before you ran
> hg up) and the new current version (the version you're updating to)
> into your local files.
> 2b (with -C). Replaces all your local files with the tree as of the
> new current version.
>
> Normally, the current version is a real version in the timeline. If
> you run `hg log`, you'll see that version somewhere.
>
> But in a repository that has never been updated (i.e., one that has no
> working copy), the current version is null. The null version contains
> no files, is not authored by anyone, and has no commit message.
>
> If you run `hg init`, the resulting repository's current version is
> null. You can push or pull to this repository, and it will have
> changes, but unless you update, the current version doesn't change.
> (Think of the “run hg update to get a working copy” message.)
>
> So what hg up null does is travel back in time to before there were
> any changes, before there were any files, before anyone had ever
> touched the repository. The change that this makes to your working
> copy is to remove it. You're left with only a repository.
>
> The main reason to do this is if you're hosting a repository on a
> server. You're probably not going to actually work with the files in
> that repository—you'll work with another repository locally, and push
> changes to and pull changes from the server's repository. Therefore,
> the server's repo doesn't need a working copy.
>
> So, if you update the server's repository (whether by accident, or by
> not knowing any better, or because you wanted to check something), you
> may later want to un-update it to conserve disk space.
>
> That's what hg up null does.
I've added this to
http://www.selenic.com/mercurial/wiki/index.cgi/Update
Thanks!
More information about the Mercurial
mailing list