xref: /dragonfly/usr.bin/undo/undo.1 (revision e2f5ccfb)
1.\" Copyright (c) 2008 The DragonFly Project.  All rights reserved.
2.\"
3.\" This code is derived from software contributed to The DragonFly Project
4.\" by Matthew Dillon <dillon@backplane.com>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in
14.\"    the documentation and/or other materials provided with the
15.\"    distribution.
16.\" 3. Neither the name of The DragonFly Project nor the names of its
17.\"    contributors may be used to endorse or promote products derived
18.\"    from this software without specific, prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\" $DragonFly: src/usr.bin/undo/undo.1,v 1.2 2008/06/03 12:40:09 swildner Exp $
34.Dd May 31, 2008
35.Dt UNDO 1
36.Os
37.Sh NAME
38.Nm undo
39.Nd Undo changes made to files on HAMMER filesystems
40.Sh SYNOPSIS
41.Nm
42.Op Fl dDhiuv
43.Op Fl o Ar outfile
44.Op Fl t Ar <number>{s,m,h,d}
45.Op Fl t Ar <number>{s,m,h,d}
46.Ar file1
47.Ar ...
48.Sh DESCRIPTION
49The
50.Nm
51utility acquires an older version of the specified files and can output
52them stdout, generate a file with the previous contents, or generate
53a diff to stdout.  A history can also be generated.
54.Pp
55The options are as follows:
56.Bl -tag -width indent
57.It Fl d
58Generate a unified diff from the older version to the current version.
59.It Fl D
60Generate a unified diff from the current version to the older version.
61.It Fl i
62Generate a single line giving the transaction id and converted timestamp
63of the version of the file requested, rather then dumping the contents
64of the file.
65.It Fl h
66Iterate through the file's entire history generating undo files, diffs,
67output, etc.  Execute the generation op for each version.
68.It Fl u
69Output to a file synthesized from the input filename postfixed with ".undo".
70If not specified output is either to stdout or, if a single file argument
71is given, the file specified by the
72.Fl o
73option.
74.It Fl v
75Increase verboseness.
76.It Fl o Ar outfile
77Output to the specified file instead of to stdout.  If iterating through
78a file's entire history
79.Ar outfile
80will be postfixed with an iteration number in the form "outfile.%04d".
81If multiple files are specified
82.Ar outfile
83is used as a template where '%s' is replaced with the last component of
84each file path.  When used with multiple files '%%' must be used in the
85.Ar outfile
86specification to indicate a '%'.  When used with a single file the
87.Ar outfile
88string is used verbatim.
89.It Fl t Ar <number>{s,m,h,d}
90Specify how far to go back relative to the current time.  A HAMMER
91transaction id (0x16chars) may also be specified.  If not specified
92the program will attempt to locate the most recent version of the
93file(s) prior to the current version.
94This option does not apply if
95.Fl h
96is specified.
97.It Fl t Ar <number>{s,m,h,d}
98A second time specification may be given when the
99.Fl d
100or
101.Fl D
102option is used, to provide two end-points for the diff.  The file as-of
103the second
104.Fl t
105is used instead of the current version of the file.
106.El
107.Sh EXAMPLES
108.Li "undo -d mytextfile"
109.Pp
110.Li "undo -o mytextfile.old mytextfile"
111.Sh DIAGNOSTICS
112Exit status is 0 on success and 1 on error.
113.Sh SEE ALSO
114.Xr hammer 8
115.Sh HISTORY
116The
117.Nm
118utility first appeared in
119.Dx 1.13 .
120.Sh AUTHORS
121.An Matthew Dillon Aq dillon@backplane.com
122.Sh BUGS
123HAMMER only synchronizes information to disk every 30 seconds or so and
124a quick file create / delete is done entirely in system memory and cannot
125be undone.  This can be worked around by running 'hammer synctid <filesystem>'.
126