Solved

How do I check what files in SVN are new against some revision?

Posted on 2008-10-12
7
368 Views
Last Modified: 2013-11-25
I have a web interface to SVN storage. It allows users to view folders, download, add and delete files. I need to implement feature which will show user the list of new files to him. This should be list of files, which were added to svn from the moment of users last login. SVN contains more than 2000 files and folders so it takes more than 30s to check all files details and compile the list on login. How do I implement this in more fast way? Maybe SVN have some tool which will help?
Successful solution shoud be simple with minimum operations. It should take minimum efforts to implement and test. It also should concern that SVN contents may be changed by 3rd party interfaces like SVN client. It is not preferred to cashe because cashed data will be different from actual SVN contents.
0
Comment
Question by:technoparkcorp
  • 4
  • 3
7 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22697445
svn status

The first column tells you the status of files - 'A' refers to addition

something like the following (adjust for whitespace) would get you the required list.
svn status | grep "^A"

It will have to browse the entire repository to get the list - there is no easy way to shorten this process. The hard way is to fiddle with svn server code to do periodic pre-calculations.

Note that this status is since last svn update command and not login. Getting files added since last login would be trickier. Typically we never log off svn and there might be checkins while we are logged in that we are not necessarily aware of. Even from usability point of view, additions since last update make lot more sense as compared to additions since last login. Also repository might have been checked out at different locations and user is likely to be interested in getting the list of files added to current repository rather than updates to another repository that was used at the time of last login.
0
 

Author Comment

by:technoparkcorp
ID: 22700759
svn status deals with local copy but not with the entire repository, this will not help
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22710853
> I need to implement feature which will show user the list of new files to him.
This will require some client specific info - Infact your solution will integrate with client and not the server.

>This should be list of files, which were added to svn from the moment of users last login.
Can you be more specific. What happens if a user logs in and does not log off - will he never see an update? Or what happens if a user is logged in from multiple machines - what would be the behavior on each of them?
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:technoparkcorp
ID: 22711110
seems that you have not got the point. my fault. let me explain:
- SVN repository on the remote server contains some data. It is used just as data storage.
- Im inplementing  a web-interface (lets call it System) which allows users to manage this repository by  "Create folder", "Download file", "Delete file" ,"Upload file" etc... tools

what I want to b implemented:
1. User A has been logged to System 10-Oct and then logged off
2. 11-Oct users B and C were logged in and added files b.txt and c.txt to SVN repository. Then they logged off.
3. 12-Oct user A logs to the System and see shortcuts ti b.txt and c.txt files in "New files" zone.

for now, I need to scan all repository on user login and check if there is files added later then 10-Oct. it takes 30 sec, so I have great troubles here. so Im looking for some tool which will return new files list in few secs maximum.
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22711260
Okay - I get it ...  

save the revision number when the user last visited.
Run the command
svn log -v -r LAST_VISIT:HEAD

Where LAST_VISIT is your svn revision number since last visit.

filter out all lines beginning with A - these are the added file.

This will be lot faster than svn status.
0
 

Author Comment

by:technoparkcorp
ID: 22720031
tried this... but it returns added files only however I need edited files as well.
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 22728033
Extract all lines beginning with M as well.
If you want all changes, get all entries reported by log and then do a unique on them
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question