Project

General

Profile

Bug #1319 » undo.patch

joelkp, 03/29/2009 02:50 PM

View differences:

undo/undo.1 2009-03-29 14:05:56 +0000
Transaction ids always start with "0x".
A simple index may be
specified instead of a transaction id where 0 indicates the latest version
and increasing values indicate older versions.
and increasing values indicate older versions, or where -0 indicates the oldest version and decreasing values indicate newer versions.
.El
.Sh EXAMPLES
.Li "undo -d mytextfile"
undo/undo.c 2009-03-29 14:21:53 +0000
* Find entry if tid set to placeholder index
*/
if (flags & UNDO_FLAG_SETTID1){
tse1 = RB_MAX(undo_hist_entry_rb_tree, &tse_tree);
while (tse1 && ts1.tid--) {
tse1 = RB_PREV(undo_hist_entry_rb_tree,
&tse_tree, tse1);
if ((int64_t)ts1.tid >= 0) {
tse1 = RB_MAX(undo_hist_entry_rb_tree,
&tse_tree);
while (tse1 && ts1.tid--) {
tse1 = RB_PREV(undo_hist_entry_rb_tree,
&tse_tree, tse1);
}
} else {
tse1 = RB_MIN(undo_hist_entry_rb_tree,
&tse_tree);
while (tse1 && ++ts1.tid) {
tse1 = RB_NEXT(undo_hist_entry_rb_tree,
&tse_tree, tse1);
}
}
if (tse1)
ts1 = tse1->tse;
......
ts1.tid = 0;
}
if (flags & UNDO_FLAG_SETTID2){
tse2 = RB_MAX(undo_hist_entry_rb_tree, &tse_tree);
while (tse2 && ts2.tid--) {
tse2 = RB_PREV(undo_hist_entry_rb_tree,
&tse_tree, tse2);
if ((int64_t)ts2.tid >= 0) {
tse2 = RB_MAX(undo_hist_entry_rb_tree,
&tse_tree);
while (tse2 && ts2.tid--) {
tse2 = RB_PREV(undo_hist_entry_rb_tree,
&tse_tree, tse2);
}
} else {
tse2 = RB_MIN(undo_hist_entry_rb_tree,
&tse_tree);
while (tse2 && ++ts2.tid) {
tse2 = RB_NEXT(undo_hist_entry_rb_tree,
&tse_tree, tse2);
}
}
if (tse2)
ts2 = tse2->tse;
......
parse_delta_time(const char *timeStr, int *flags, int ind_flag)
{
hammer_tid_t tid;
int adj;
tid = strtoull(timeStr, NULL, 0);
if (timeStr[0] == '+')
adj = 0;
if (timeStr[0] == '+') {
++timeStr;
} else if (timeStr[0] == '-') {
++timeStr;
if (timeStr[0] >= '0' && timeStr[0] <= '9' && timeStr[1] != 'x')
adj = 1;
}
if (timeStr[0] >= '0' && timeStr[0] <= '9' && timeStr[1] != 'x') {
*flags |= ind_flag;
if (adj)
--tid;
}
return(tid);
}
......
" -t TID Retrieve as of transaction-id, TID\n"
" (a second `-t TID' to diff two)\n"
" transaction ids must be prefixed with 0x, and\n"
" otherwise may specify an index starting at 0\n"
" and iterating backwards through the history.\n"
" otherwise may specify a positive index starting\n"
" at 0 and iterating backwards through the\n"
" history, or a negative index starting at -0 and\n"
" iterating forwards through the history.\n"
);
exit(1);
}
(4-4/4)