Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way in svn to verify if an already existing file tree that "should" be at a given revision is in fact correct at that revision?
Suppose I had an earlier revision and obtains patches via svn diff for subsequent revisions, and applied them up to a given revision (or head). Now consider that perhaps some error happened during the application of these patches, or perhaps a file just got corrupted. What I would want to do is just verify if the tree I have now at this revision is the exactly tree I would get at this revision ... without actually pulling down the whole revision.
Note, I want to do this for exports, not for checkouts. That may make it simpler since the result of svn diff seems to only be for the actual data files.
doing that on an export is much harder as what you have locally is NOT SVN, they're just standard files so svn can not have any view about it at all. if it was a checkout then the "svn update" command does exactly what you want.
doing that on an export is much harder as what you have locally is NOT SVN, they're just standard files so svn can not have any view about it at all. if it was a checkout then the "svn update" command does exactly what you want.
I understand that. What I'm looking for is something like how rsync works, but with a perspective of SVN. So could checksums work? All I need to do, per file, is to avoid the transfer of files I already have that are identical (if they are different, then the transfer is needed).
well maybe you should use rsync then. svnfs will let you mount a repo as a filesystem and then you can rsync on top of that, but exclude the .svn dirs.
well maybe you should use rsync then. svnfs will let you mount a repo as a filesystem and then you can rsync on top of that, but exclude the .svn dirs.
Unfortunately, I don't have control over the SVN server. I have only read access to SVN and no other access to the machine at all. In fact, what I would download via SVN I was planning to re-export via rsync, anyway.
I understand that. What I'm looking for is something like how rsync works, but with a perspective of SVN. So could checksums work? All I need to do, per file, is to avoid the transfer of files I already have that are identical (if they are different, then the transfer is needed).
Think about that. Where would the checksum of the svn-hosted file come from? You'd retrieve the file and compute the checksum, then compute the local checksum, compare, and then if there's a difference you'd retrieve the file from svn again to overwrite the local copy. You've just retrieved the file at least once, and at most twice, per file in your local copy of the revision for which you are checking.
And what about those files that might have been deleted from your exported copy? How will you know that they exist in the revision and not locally? What about files added to your local export, but never imported into subversion? What if those files would have been handled by the svn exclude list?
I work with subversion every day for multiple projects. I am not claiming to be an expert, but I'm familiar with what we do. I have to ask, though, why spend so much time crafting a solution that is solved either with 'svn update' for a working copy or with 'svn export' for a clean (no .svn dirs)?
Think about that. Where would the checksum of the svn-hosted file come from? You'd retrieve the file and compute the checksum, then compute the local checksum, compare, and then if there's a difference you'd retrieve the file from svn again to overwrite the local copy. You've just retrieved the file at least once, and at most twice, per file in your local copy of the revision for which you are checking.
I did think about that. That's why I was asking if there was a way to do it through the server, so the file would not have to be transferred. I was thinking about how rsync did it. What rsync does is compute the checksum at the server, and transmits just the checksum over the network, when the -c option is used. Unless -W is used, it transmits checksums of blocks of data, too.
Maybe the SVN server already has checksums cached and ready to use. Or maybe it's OK to have it recompute.
Quote:
Originally Posted by jamesf
And what about those files that might have been deleted from your exported copy? How will you know that they exist in the revision and not locally? What about files added to your local export, but never imported into subversion? What if those files would have been handled by the svn exclude list?
If the server sends a list of files, the clients detects a file not in the list and deletes it if the list was transmitted in sorted order or finished. There would be no files added in the normal sense, as this isn't a checkout.
Quote:
Originally Posted by jamesf
I work with subversion every day for multiple projects. I am not claiming to be an expert, but I'm familiar with what we do. I have to ask, though, why spend so much time crafting a solution that is solved either with 'svn update' for a working copy or with 'svn export' for a clean (no .svn dirs)?
To minimize network traffic.
I suppose if "svn update" really will minimize traffic, I might be able to live with the extra wasted space in a staging area and do a 2nd stage re-export via rsync with --exclide to take out .svn directories.
Unfortunately, I don't have control over the SVN server. I have only read access to SVN and no other access to the machine at all. In fact, what I would download via SVN I was planning to re-export via rsync, anyway.
you don't need access to the server, svnfs is just a fuse filesystem and svn client.
I did think about that. That's why I was asking if there was a way to do it through the server, so the file would not have to be transferred. I was thinking about how rsync did it. What rsync does is compute the checksum at the server, and transmits just the checksum over the network, when the -c option is used. Unless -W is used, it transmits checksums of blocks of data, too.
Maybe the SVN server already has checksums cached and ready to use. Or maybe it's OK to have it recompute.
I'm an idiot. Sorry, now I see what you were thinking about. I'm not aware of any way to get svn to send you a list of files and their checksums. Doesn't mean there isn't one, but if there is I don't know it.
Quote:
[snippage]
I suppose if "svn update" really will minimize traffic, I might be able to live with the extra wasted space in a staging area and do a 2nd stage re-export via rsync with --exclide to take out .svn directories.
Now that sounds like a pretty good solution! ;v)
The only way you might have a problem is for locally edited files in your working copy. 'svn update' won't revert those changes, but only bring up-to-date files changed on the server (committed) but at a lower revision in your checkout.
So, something like this?
Code:
cd /path/to/local/working/copy
# Make sure to discard local edits
svn revert --recursive .
# Pick up changes from the server
svn update
then either
Code:
# Discard any changes to rsync area
rmdir -r -f /path/to/rsync/staging
# repopulate rsync area
svn export . /path/to/rsync/staging
or your rsync excluding svn dirs. I like your way better.
Unless the rsync daemon is running, no? Won't it help with calculating checksums on whatever machine is running the daemon?
well the point raised is that to get the checksum you'd need to read the whole file, and in the context of a mount of an svn repo would mean downloading the entire file each time.
well the point raised is that to get the checksum you'd need to read the whole file, and in the context of a mount of an svn repo would mean downloading the entire file each time.
Ah, yes. But I had thought that the poster was now suggesting to use svn update and then using rsync (excluding .svn dirs) to perform the equivalent of an 'svn export' on the local working copy.
So, svn to handle transferring on changes from svn, rsync to handle local working copy to rsync 'staging' area (if it is still necessary).
That is, of course, if I understood his suggestions correctly. ;v)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.