DragonFly kernel List (threaded) for 2008-07
DragonFly BSD
DragonFly kernel List (threaded) for 2008-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: a safer undo


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 7 Jul 2008 09:32:16 -0700 (PDT)

:Hi,
:
:I find myself the utility "undo" very dangerous, as it removes history.
:I'd instead suggest a soft-undo mode by default, which reverts to the
:last version of that file, but keeps the history, i.e. it overwrites the
:file with the content of the old. To really undo, there would be a "-f"
:(force) option, which removes forever the latest version and moves back
:to the last version.
:
:It's so easy to forget the "-d" if you want a diff output, and then, the
:file is gone.
:
:Other than that, a great utility. It's a great way to have version
:control for configuration files built-in from the very beginning.
:
:Regards,
:
:   Michael

    Hmm.  Doesn't it output to stdout by default?  Are you telling it
    to overwrite the original file with '-o <same_file_name>' ?

    Even if you do the original isn't lost.  Undo has no ability to
    remove the file's history.

test# echo abc > x
test# sync
test# sync
test# echo def > x
test# sync
test# sync

test# undo -i x
x: objid=0x10dbbe5dad464b6f
        0x10dbbe5dad47d214 07-Jul-2008 09:28:06
        0x10dbbe5dad47d222 07-Jul-2008 09:28:23

test# undo -o x x
test# sync
test# undo -i x
x: objid=0x10dbbe5dad464b6f
        0x10dbbe5dad47d214 07-Jul-2008 09:28:06
        0x10dbbe5dad47d222 07-Jul-2008 09:28:23
        0x10dbbe5dad47d22a 07-Jul-2008 09:29:15

test# cat x@@0x10dbbe5dad47d214
abc
test# cat x@@0x10dbbe5dad47d222
def
test# cat x@@0x10dbbe5dad47d22a
abc

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]