Consider this simple python code that demonstrates a very simple version control option for a dictator:
def build_current(history): current = {} for action, key, value in history: assert action in ('set', 'del') if action == 'set': current[key] = value elif action == 'del': del current[key] return current history = [] history.append(('set', '1', 'one')) history.append(('set', '2', 'two')) history.append(('set', '3', 'three')) print build_current(history) history.append(('del', '2', None)) history.append(('set', '1', 'uno')) history.append(('set', '4', 'four')) print build_current(history) for action, key, value in history: if key == '2': print '(%s, %s, %s)' % (action, key, value)
Please note that using the history list you can restore the current dictionary to any state that it once existed. I consider this a “forward assembly” (due to the lack of a better term), because to create the current dictionary you need to start from the very beginning and process the entire history list. I consider this the most obvious and direct way.
As I’ve already heard, early version control systems used this “direct build” process, but they weren’t optimal, as most users care more about the latest build versions. In addition, users do not want to download the entire story when they only care about seeing the latest build.
Then my question is, what other approaches exist for storing stories in a version control system? Perhaps you can use "reassembly"? This may allow users to download only the latest versions without requiring the whole story. I also saw several different formats for storing history, namely: changes, snapshots and patches. What are the differences between change sets, snapshots, and patches?
Of today's popular version control tools available, how do they store their stories and what are the benefits of their various designs?
git python version-control svn mercurial
Buttons840 Jan 11 '12 at 18:26 2012-01-11 18:26
source share