[viewvc-users] svndbadmin fails when files are deleted (viewvc 1.1.12, svn 1.7.1)
ganaware <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Message-ID | <1936298591.3554.1321257156719.JavaMail.httpd__1611.25280797041$1321283214$gmane$org@localhost> |
Hi,
with viewvc 1.1.12 and svn 1.7.1,
svndbadmin fails when files are deleted.
command line logs:
$ svn rm test.txt
D test.txt
$ svn ci -m "remove test"
Deleting test.txt
Committed revision 89.
Warning: post-commit hook failed (exit code 1) with output:
Traceback (most recent call last):
File "/usr/local/viewvc/bin/svndbadmin", line 364, in <module>
main(command, repository, revs, verbose, force)
File "/usr/local/viewvc/bin/svndbadmin", line 273, in main
handle_revision(db, command, repo, rev, verbose, force)
File "/usr/local/viewvc/bin/svndbadmin", line 196, in handle_revision
revision = repo[rev]
File "/usr/local/viewvc/bin/svndbadmin", line 85, in __getitem__
rev = SvnRev(self, rev)
File "/usr/local/viewvc/bin/svndbadmin", line 182, in __init__
diff_fp = diffobj.get_pipe()
File "/usr/local/lib/python2.5/site-packages/svn/fs.py", line 108, in get_pipe
self.get_files()
File "/usr/local/lib/python2.5/site-packages/svn/fs.py", line 103, in get_files
self._dump_contents(self.tempfile2, self.root2, self.path2)
File "/usr/local/lib/python2.5/site-packages/svn/fs.py", line 81, in _dump_contents
stream = file_contents(root, path, pool)
File "/usr/local/lib/python2.5/site-packages/libsvn/fs.py", line 656, in svn_fs_file_contents
return _fs.svn_fs_file_contents(*args)
svn.core.SubversionException: 160013 - File not found: revision 89, path '/test.txt'
$ /usr/local/viewvc/bin/svndbadmin update /path-to-my-repository 89 --force -v
(snip) same as above traceback.
$ python --version
Python 2.5.1
$ svn --version
svn, version 1.7.1 (r1186859)
compiled Oct 31 2011, 20:05:46
(snip)
I found that change.path is not None even if a file has been deleted.
So, this patch fixes the problem:
--- bin/svndbadmin.old 2011-11-14 16:42:58.000000000 +0900
+++ bin/svndbadmin 2011-11-14 16:48:30.000000000 +0900
@@ -168,7 +168,11 @@
if change.base_path:
base_root = self._get_root_for_rev(change.base_rev)
- if not change.path:
+ root2 = change.path and fsroot or None
+ path2 = change.path and change.path or None
+ if change.action == svn.repos.CHANGE_ACTION_DELETE:
+ root2 = None
+ path2 = None
action = 'remove'
elif change.added:
action = 'add'
@@ -177,8 +181,7 @@
diffobj = svn.fs.FileDiff(base_root and base_root or None,
base_root and change.base_path or None,
- change.path and fsroot or None,
- change.path and change.path or None)
+ root2, path2)
diff_fp = diffobj.get_pipe()
plus, minus = _get_diff_counts(diff_fp)
self.changes.append((path, action, plus, minus))
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2877880
To unsubscribe from this discussion, e-mail: [[email protected]].