1

Git and Subversion are great systems to synchronize source files between various locations and manage their versions.

However, sometimes it can be useful take only a section/part/ranges of a source file and synchronize this section/part between various locations within and between projects.

Examples scenarios of this could be:

  • The 'footer' of a web page identical in various web properties (e.g. <p>(c) My Inc. 2012</p>).
  • Small utility methods, which do not warrant the inclusion of another dependency/library (e.g. public static byte[] fromInputStream(InputStream is);).
  • Common parts of configuration files, for instance server addresses, database login info, ...

There are other solutions to above-mentioned scenarios, but being able to synchronize sections of source files could be a viable, versatile, additional tool for many purposes.

Do you know of any tools for synchronizing sections/parts/ranges of source files?

(I've built a little prototype for this, which wasn't too difficult, but it would be great to know of any established system/approach, which builds on known SCM solutions).

Edit: I changed the title from asking for a versioning system to asking for a synchronization system since I think it reflects the content of the question better and in response to discussion below.

12
  • You mean like marking ranges in files for version control instead of the whole file? Seems like you would have problems with maintaing accurate references to the "sections" if the content changes too much. Could you maybe expand on a real-world example of how you see this being used? I don't understand how you would be able to "include" partial file content into other files. If that "footer" were version controlled, how would it be included in 10 files? I would see it as just being a "footer.html" whole file.
    – jdi
    Aug 15, 2012 at 22:30
  • 3
    This a separation-of-concerns issue; you should separate the concern of versioning from the concern of assembling a larger whole from a collection of pieces. Do what it takes so the common pieces of the files are stored in only one place, and version that.
    – antlersoft
    Aug 15, 2012 at 22:35
  • @jdi Yes, that is what I mean. I like the term 'ranges' and added it above. Yes again, the partial file would indeed become just another file. Just this 'file' can then be included in another file.
    – mxro
    Aug 15, 2012 at 22:36
  • 1
    But what @antlersoft is saying is to not think about a versioning system supporting this separation concern. Implement it by splitting up your actual files into the sections, and version those.
    – jdi
    Aug 15, 2012 at 22:37
  • How would it become "included" in another file? What common functionality introduces this ability? If I am writing a new configuration file that shares some commonality, how would I "include" that into the conf file? It puts quite a lot of dependency onto this versioning system. Basically I would just put the common part in a file and version it.
    – jdi
    Aug 15, 2012 at 22:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.