简体   繁体   中英

SVN: How to get the first revision of a file?

When working with a subdirectory in a repository, how to find the revision when that specific directory has been added to the repository? By using "svn info http://.." I can find out when it was modified for the last time ("Last Changed Rev"), but I also need to find out the revision number of the commit when that directory (or file) was added for the first time (it's "first" revision).

I have been searching for that at the "SVN book", googling, but, obviously, I got no results.

Note: I need this for making a PHP script which downloads logs and stores them locally, just to make it clear and avoid "use tortoise/svnx/versions/you_name_it application" ;)

您可以使用svn log ,反向修订范围:

svn log -r 1:HEAD --limit 1 <REPO_URL>

最后一个条目

svn log http://...

For someone trying to do this in pysvn:

def get_branch_creation_rev(url)
    import pysvn
    cl = pysvn.Client()
    return  pysvn.Revision(pysvn.opt_revision_kind.number,
                           cl.log(url)[-1].data.get('revision').number)

Not sure what the command line method is. I use Tortoise on windows to do most of my SVN navigating. If you have that tool, just right click on the folder and it is tortoise SVN/Show Log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM