Question

Is there an efficient way to find out programmatically, who added a file in Subversion initially, other than parsing the history manually? Preferably with the SVNKit Java Library or on the command line.

I have the latest version checked out into a working copy. svn info gives me all the other infos I need, but not the initial author (by that I mean, who ran svn add on the file).

The problem with parsing the output are renames. If for example a file startet as myfile.txt in revision 10 and was renamed to myFancyFile.txt in revision 12, I sill need the original author from revision 10.

I don't need any information on deleted files or folders, only on files that exist in my current working copy. Thanks

Why I am doing this? We are extracting meta data from the files and I need to know who initially checked in the file. The report is generated every night.

Était-ce utile?

La solution

.svn/wc.db does not contain information on the creation attributes of a node as a look into the database reveals:

sqlite> .schema nodes
CREATE TABLE NODES ( wc_id  INTEGER NOT NULL REFERENCES WCROOT (id), local_relpath  TEXT NOT NULL, op_depth INTEGER NOT NULL,   parent_relpath  TEXT, repos_id  INTEGER REFERENCES REPOSITORY (id), repos_path  TEXT, revision  INTEGER, presence  TEXT NOT NULL, moved_here  INTEGER, moved_to  TEXT, kind  TEXT NOT NULL, properties  BLOB, depth  TEXT, checksum  TEXT, symlink_target  TEXT,   changed_revision  INTEGER, changed_date INTEGER, changed_author TEXT, translated_size  INTEGER, last_mod_time  INTEGER, dav_cache  BLOB, file_external  TEXT, PRIMARY KEY (wc_id, local_relpath, op_depth) );

Hence, you need to query the repository

For SVNKit, I'd use SVNRepository#getFileRevisions and/or SVNRepository#getLocations (for renamed files) here and get the desired information from the first reported revision.

If you need that information for many files (as I understand from your last sentence), you may also consider to run through the log and get the information from there.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top