* src/plugins/Checkpoint.py: Minor improvements for the RCS.

* src/plugins/Makefile.am: Ship Checkpoint.py.


svn: r5219
This commit is contained in:
Alex Roitman 2005-09-23 20:57:05 +00:00
parent f819efd5c2
commit 4f003d46b4
2 changed files with 36 additions and 11 deletions

View File

@ -119,17 +119,36 @@ class Checkpoint:
comment = self.timestamp() comment = self.timestamp()
archive = archive_base + ",v" archive = archive_base + ",v"
# If the archive file does not exist, we either set it up
# or die trying
if not os.path.exists(archive): if not os.path.exists(archive):
proc = popen2.Popen3('rcs -i -U -q -t-"GRAMPS database" %s' % archive,True) proc = popen2.Popen3(
'rcs -i -U -q -t-"GRAMPS database" %s' % archive,
True)
proc.tochild.write(comment) proc.tochild.write(comment)
proc.tochild.close() proc.tochild.close()
status = proc.wait() status = proc.wait()
if status: message = "\n".join(proc.childerr.readlines())
ErrorDialog(_("Checkpoint failed"),
"\n".join(proc.childerr.readlines()))
del proc del proc
return
if status:
ErrorDialog(_("Checkpoint Archive Creation Failed"),
_("No checkpointing archive was found. "
"An attempt to create it has failed with the "
"following message:\n\n%s")
% message)
return
else:
OkDialog(_("Checkpoint Archive Created"),
_("No checkpointing archive was found, "
"so it was created to enable archiving.\n\n"
"The archive file name is %s\n"
"Deleting this file will lose the archive and make "
"impossible to extract archived data from it.")
% archive)
# At this point, we have an existing archive file
xmlwrite = WriteXML.XmlWriter(self.db,self.callback,False,False) xmlwrite = WriteXML.XmlWriter(self.db,self.callback,False,False)
xmlwrite.write(archive_base) xmlwrite.write(archive_base)
@ -137,10 +156,15 @@ class Checkpoint:
proc.tochild.write(comment) proc.tochild.write(comment)
proc.tochild.close() proc.tochild.close()
status = proc.wait() status = proc.wait()
if status: message = "\n".join(proc.childerr.readlines())
ErrorDialog(_("Checkpoint failed"),
"\n".join(proc.childerr.readlines()))
del proc del proc
if status:
ErrorDialog(_("Checkpoint Failed"),
_("An attempt to archive the data failed "
"with the following message:\n\n%s") % message)
else:
OkDialog(_("Checkpoint Succeeded "),
_("The data was successfully archived."))
def callback(self,value): def callback(self,value):
""" """

View File

@ -65,7 +65,8 @@ pkgdata_PYTHON = \
rel_sv.py\ rel_sv.py\
ImportGeneWeb.py\ ImportGeneWeb.py\
WriteGeneWeb.py\ WriteGeneWeb.py\
rel_es.py rel_es.py\
Checkpoint.py
pkgpyexecdir = @pkgpyexecdir@/plugins pkgpyexecdir = @pkgpyexecdir@/plugins
pkgpythondir = @pkgpythondir@/plugins pkgpythondir = @pkgpythondir@/plugins
@ -88,8 +89,8 @@ GLADEFILES = \
writeftree.glade\ writeftree.glade\
genewebexport.glade\ genewebexport.glade\
scratchpad.glade\ scratchpad.glade\
vcardexport.glade\ vcardexport.glade\
vcalendarexport.glade vcalendarexport.glade
GRAPHICS = \ GRAPHICS = \
stock_link.png stock_link.png