Solved

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

Posted on 2008-10-12
7
366 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now