>>>>> "Leandro" == Leandro Lucarella <[EMAIL PROTECTED]> writes:

    Leandro> I think 'darcs revert' on 'darcs add'ed shouldn't remove
    Leandro> the file from the filesystem, just remove them from the
    Leandro> 'add queue' so they're not added to revision control on
    Leandro> the next record.

FWIW, I disagree.  darcs revert is documented to return the workspace
to the state recorded in the repository, for all files under darcs
control.  Since you added the file, it _is_ in revision control.
Since it _has no contents_ in the pristine, its contents should go
away.

In other words, we'd like the equation

darcs revert == darcs record -a -m P; darcs obliterate -p P

to be satisfied.  But that's equivalent to applying inv(P) to the
the workspace, which must remove the contents.

    Leandro> Or at least make the operation unrevertable (I guess is
    Leandro> not hard at all to do it).

Have you checked in the _darcs/patches directory for the "unrevert"
patch?  This is simply the patch that darcs would have recorded if you
had typed "darcs record" rather than "darcs revert".  The whole file
should appear there in plain text.  If the unrevert patch isn't there,
then you must have done something to the branch to make it go away.

Anyway, failure to unrevert is a bug, assuming you did nothing to the
workspace or repository in the meantime.  However, I can't replicate
it in a simple example:

papa% mkdir a
papa% cd a
papa% echo "This is junk." > b
papa% darcs initialize
papa% darcs record -a -l -m'import' --skip-long-comment -A me
Finished recording patch 'import'
papa% echo "this is more junk" > c
papa% darcs add c
papa% darcs whatsnew
{
addfile ./c
hunk ./c 1
+this is more junk
}
papa% darcs revert
addfile ./c
Shall I revert this patch? (1/?) [ynWsfqadjkc], or ? for help: y
Do you really want to revert these changes? y
Finished reverting.
papa% ls
_darcs  b
papa% darcs unrevert
addfile ./c
Shall I unrevert this patch? (1/?) [ynWsfqadjkc], or ? for help: y
hunk ./c 1
+this is more junk
Shall I unrevert this patch? (2/?) [ynWsfqadjkc], or ? for help: y
Finished unreverting.
papa% cat c
this is more junk
papa% darcs --version
1.0.4rc1 (stable branch)
papa% 

    Leandro> svn revert behavoir is not to remove the file from
    Leandro> filesystem, and is _the_ way to 'cancel' a file addition

It's a shame that the same name is used, but in darcs "revert" is
basically an operation on the _workspace_.  It is _documented_ to undo
your work; if that work is adding data, then it destroys it.  It asks
you twice if you want to revert your work, and then saves it for you
as a patch.

Aside: I don't much like the svn use of the name.  I'm an Emacs user,
and there "revert" is just as destructive as it is in darcs.
(Actually, more so---where darcs creates an unrevert patch, Emacs
removes the autosave backups!)  I think "undo" is a better term.
FWIW, your mileage obviously varies.

-- 
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.

_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to