Solved

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

Posted on 2008-10-12
7
369 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

861 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