[darcs-users] How to look at older versions of a file

Stephen J. Turnbull stephen at xemacs.org
Thu Dec 1 09:34:12 UTC 2005


>>>>> "David" == David Rosenstrauch <Rosenstrauch> writes:

    David> How do I go back to see/compare various versions of a file?

Identifying a version in darcs is hard, since a version is
conceptually "what you get when you apply a sequence of patches to an
empty repository".  In order to have a handle, you need to use "darcs
tag".  Unlike CVS where a tag is attached to a version of each file
individually (and need not even be attached to all the files in the
repo), "darcs tag" is the set of patches needed to recreate the
version.

darcs diff will show the difference between two tags.  I believe you
can restrict to a subset of files, but this is a presentation issue;
darcs still creates the whole tree (two, in fact, if neither is the
workspace or the _darcs/current pristine cache).

    David> Or let's say that I create a copy of my repo, and I'd like
    David> to "roll it back" to, say, a tag that I placed a couple of
    David> weeks back.  How would I go about doing that.

There are two possibilities.  One is "darcs rollback", surprisingly
enough.  This is "safe" in the sense that the required sequence of
inverse patches is applied to the repository---ie, you have an
undo/redo history.

The other is "darcs obliterate", which unrecords the patch from the
repository and reverts your workspace to the appropriate state by
applying the reverse patch.  Obviously, you've lost information here.

Or ... maybe you haven't.  You mention creating a copy of your repo.
Although darcs doesn't care if you use "rsync" or "darcs get" or
whatever, let's think like Darcs users.  You're going to copy the repo
by pulling all the patches (up to current---there are ways to pull
only a subset, as you probably already know).  Aww, you're way ahead
of me!  That's right, "darcs unpull" is an alias for "darcs
obliterate", but in the context of undoing a pull it's safe because
the patches being obliterated in _this_ repo still exist in _that_
one.

Historical note: Someday darcs unpull may try to confirm that the
patch actually exists somewhere, and thus justify the redundancy in
names.  However, there's some debate as to the usefulness/efficiency
of this, and it hasn't yet been implemented.  The reason for the alias
is that "darcs unpull" was the original name, but in the interest of
truth-in-advertising, caveat user and all that David decided to give
it the fearsome moniker "obliterate".

HTH

-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.




More information about the darcs-users mailing list