[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnu-arch-users] Re: recover deleted files
From: |
Miles Bader |
Subject: |
[Gnu-arch-users] Re: recover deleted files |
Date: |
08 May 2004 09:38:10 +0900 |
Charles Duffy <address@hidden> writes:
> > It appears to be attempting to determine the file id from the working
> > tree, not from the library revision.
>
> Yes, that's what it looks like -- but "cp `file-find myfile.c`
> myfile.c" is a common meme for recovering deleted files (from trees in
> which said files' deletion has not yet been committed to the archive),
> so that behaviour doesn't really make sense.
None-the-less, that's the way it seems to work. It may be that it will
find and use the explicit id for a deleted file, in which case whether
it works or not depends on what tagging method you use.
The `tla library-find' command, on the other hand, _does_ work even if
all traces of a file are removed from the working directory, but it's a
bit annoying because it doesn't do automatic adding to greedy revlibs,
etc.
Here's the crap my `tla-update-ids' command goes through to try to find
a pristine copy of a file that's been deleted:
# Return the path to FILE in a pristine version (either a revision
# library entry or a pristine tree) of the latest revision, or 0 if one
# cannot be found.
function pristine_file(file
,latest_rev,revlib,revlibs_cmd,revlibs_cmd_status,greedy)
{
if (! pristine_root) {
# Find the latest revision and make sure we have a pristine tree for
# it; by `pristine tree' we really mean revlib entry or pristine tree
latest_rev = run_cmd_first_line("$TLA logs -f | sed -n '$p'")
# See if we've got a revlib entry handy
pristine_root = run_cmd_first_line("$TLA library-find --silent",
latest_rev)
if (! pristine_root) {
# No revlib entry; can we add one to a greedy library?
# Search for a greedy revision library
revlibs_cmd = make_cmd("$TLA my-revision-library 2>/dev/null")
while ((revlibs_cmd_status = (revlibs_cmd |getline revlib)) > 0) {
greedy = run_cmd_first_line(make_cmd("$TLA library-config", revlib) \
"| grep '^greedy[?]'")
if (greedy ~ /yes$/)
break
}
if (revlibs_cmd_status >= 0)
close (revlibs_cmd)
if (revlibs_cmd_status > 0) {
# Found a greedy library, add an entry for this revision to it
if (run_cmd("$TLA library-add", latest_rev))
pristine_root = run_cmd_first_line("$TLA library-find", latest_rev)
}
if (! pristine_root) {
# Give up with revlibs and try to add a pristine tree
if (run_cmd("$TLA add-pristine", latest_rev))
pristine_root = run_cmd_first_line("$TLA find-pristine",
latest_rev)
}
}
}
if (pristine_root)
return pristine_root "/" file
else
return 0
}
I suspect the behavior of this function may not be quite the same as tla's
normal greedy revlib behavior in corner cases too.
It would be nice if there was a simpler way to do this, e.g., if you
could do something like `tla library-find --add-greedy ...' or something.
-Miles
--
Love is a snowmobile racing across the tundra. Suddenly it flips over,
pinning you underneath. At night the ice weasels come. --Nietzsche
- Re: [Gnu-arch-users] recover deleted files, (continued)
- Re: [Gnu-arch-users] recover deleted files, Michael Grubb, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Charles Duffy, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Michael Grubb, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Charles Duffy, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Michael Grubb, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Aaron Bentley, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Michael Grubb, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Aaron Bentley, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Michael Grubb, 2004/05/07
- Re: [Gnu-arch-users] recover deleted files, Charles Duffy, 2004/05/07
- [Gnu-arch-users] Re: recover deleted files,
Miles Bader <=