From 3c84f349af8cf38fbb4b30d192854e26b7b040be Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 18 Jun 2007 23:04:05 +0000 Subject: [PATCH] * src/DbManager.py: check for revisions 2007-06-18 Don Allingham svn: r8585 --- ChangeLog | 4 +++- src/DbManager.py | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e1d272b8..654dbcd65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ +2007-06-18 Don Allingham + * src/DbManager.py: check for revisions + 2007-06-18 Don Allingham * src/GrampsDb/_GrampsDBDir.py: support lock file - * src/DbManager.py: display locked file message 2007-06-18 Alex Roitman * src/DateEdit.py (DateEditorDialog.switch_calendar): Only convert diff --git a/src/DbManager.py b/src/DbManager.py index c592b1a2b..34c3d7bb0 100644 --- a/src/DbManager.py +++ b/src/DbManager.py @@ -229,8 +229,7 @@ class DbManager: """ Builds the display model. """ - - self.model = gtk.ListStore(str, str, str, str, int, bool, str) + self.model = gtk.TreeStore(str, str, str, str, int, bool, str) # make the default directory if it does not exist @@ -271,7 +270,10 @@ class DbManager: for items in self.current_names: data = [items[0], items[1], items[2], items[3], items[4], items[5], items[6]] - self.model.append(data) + iter = self.model.append(None, data) + for rdata in find_revisions(os.path.join(items[1], "rev.gramps,v")): + data = [rdata[0], "", "", rdata[1], 0, False, "" ] + self.model.append(iter, data) self.dblist.set_model(self.model) def run(self): @@ -485,3 +487,30 @@ def icon_values(dirpath, active, open): else: return (False, "") +def find_revisions(name): + import re + import subprocess + + rev = re.compile("\s*revision\s+([\d\.]+)") + date = re.compile("\s*date:\s+([^;]+);") + rlog = [ "rlog" , name ] + + proc = subprocess.Popen(rlog, stdout = subprocess.PIPE) + proc.wait() + + revlist = [] + date_str = "" + rev_str = "" + + if os.path.isfile(name): + for i in proc.stdout: + match = rev.match(i) + if match: + rev_str = match.groups()[0] + + match = date.match(i) + if match: + date_str = match.groups()[0] + revlist.append((rev_str, date_str)) + + return revlist