kol
kol

Reputation: 28708

SVN - Automatically generate unique ID for every versioned file

Is there an unique identifier for every versioned file in an SVN repository? If yes, can it be read using some svn command? If no, is it possible to generate one on every svn add call?

For example, if I have a GUID generator application, can I call it on every svn add, and somehow bind its output (the new GUID) tightly to the added file? Storing it locally is not enough: the unique ID must be stored on the SVN server, because we must be able to download it during every svn checkout and svn update.

Upvotes: 0

Views: 844

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97285

Is there an unique identifier for every versioned file in an SVN repository?

No, in common sense. Why do you want to have it? Theoretically, URL of file can be such UUID, or URL@PEG, if you have to have ID for content, not just location

If yes, can it be read using some svn command?

svn info URL/OF/FILE may help

>svn info https://subversion.assembla.com/svn/proofsheets.natasha/readme.textile
Path: readme.textile
Name: readme.textile
URL: https://subversion.assembla.com/svn/proofsheets.natasha/readme.textile
Relative URL: ^/readme.textile
Repository Root: https://subversion.assembla.com/svn/proofsheets.natasha
Repository UUID: 3f205b2a-3c6b-4d59-9930-a6250b31609f
Revision: 5
Node Kind: file
Last Changed Author: lazybadger
Last Changed Rev: 2
Last Changed Date: 2013-11-28 00:13:01 +0600 (Чт, 28 ноя 2013)

You can use URL (globally unique), Relative URL (repo-wide unique), Repository UUID+Relative URL (globally unique)

if I have a GUID generator application, can I call it on every svn add

You can call it after add and before commit

somehow bind its output (the new GUID) tightly to the added file?

Yes. Read about (custom) SVN-properies, propset command, -F option of command and use it. As result, you'll get some versioned over time data as additional attribute of file, which you can read (propget) and write (propset|propedit) independently from checkout|update

Upvotes: 1

Related Questions