Light-weight/very-simple version control under Windows using Python?

Günther Dietrich gd.usenet at spamfence.net
Sun Jul 25 14:42:27 EDT 2010


python at bdurham.com wrote:

>I have some very simple use cases[1] for adding some version control
>capabilities to a product I'm working on. My product uses simple, text
>(UTF-8) based scripts that are independent of one another. I would like
>to "version control" these scripts on behalf of my users. By version
>control, I mean *very-simple* version control with no branching or
>merging - just the ability to store, list and restore a specific version
>of a file. The data store should be a local file with the ability to
>upsize to a multi-user database in the future.
>
>I'm looking for recommendations on possible solutions:
>
>1. Use an existing version control utility. There are lots of options
>here(!), any recommendations on a light weight, open source one that
>xcopy installs under Windows with lots of command line options?
>
>2. Interface to a hosted version control system (SaaS) that provides a
>RESTful API. Any recommendations here?
>
>3. Build this capability myself using Python and Python's DBI layer to
>store files in a local SQLite database at first (but with the ability to
>upsize to a real client server database in the future). Seems like a fun
>project to work on, but also smells like I'd be re-inventing the wheel
>with very little value added other than simpler deployment?
>
>Any suggestions appreciated.

Use Mercurial (<http://mercurial.selenic.com>). It is written in python, 
can be extended by python modules/packages and can be used by python 
programs directly.


>1. Check a file in with optional comment and username; ideally
>get a version number that can be used to reference this specific
>check-in in the future.

That's a basic task in mercurial (as probably in every version control 
system).


>2. Get a history listing of all checkins for a specific file
>(version number, timestamp, file size, user, comment)

Also avalilable. I am not sure about file size and comment, but if you 
have the list of version numbers, you can extract this info from the 
repository easily.


>3. Check out a specific version of a file by version number.

See point 1.


>4. Delete checked-in versions by version number, date range,
>and/or username.

I've never tried it with mercurial. There are a remove and a forget 
command. Maybe, one could use the rebase extension.

But deleting changesets from a repository usually is a bad idea.


>5. (Optional) Diff 2 versions of a file by version number and
>return diff in richly formatted format that visually shows
>changes via color and font effects (strikethru) (I'm thinking
>of using BeyondCompare for this if not present in a simple
>version control tool)

Also available.



Regards,

Günther



More information about the Python-list mailing list