0002119: Archiving via RCS does not work in Windows
svn: r10776
This commit is contained in:
parent
90c1efc5d2
commit
4e8ef1cb31
@ -45,6 +45,9 @@ LOG = logging.getLogger(".DbManager")
|
|||||||
|
|
||||||
if os.sys.platform == "win32":
|
if os.sys.platform == "win32":
|
||||||
RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
||||||
|
if RCS_FOUND and not os.environ.has_key("TZ"):
|
||||||
|
# RCS requires the "TZ" variable be set.
|
||||||
|
os.environ["TZ"] = str(time.timezone)
|
||||||
else:
|
else:
|
||||||
RCS_FOUND = os.system("rcs -V >/dev/null 2>/dev/null") == 0
|
RCS_FOUND = os.system("rcs -V >/dev/null 2>/dev/null") == 0
|
||||||
|
|
||||||
@ -648,7 +651,7 @@ class DbManager(CLIDbManager):
|
|||||||
rev = self.model.get_value(node, PATH_COL)
|
rev = self.model.get_value(node, PATH_COL)
|
||||||
archive = os.path.join(db_dir, ARCHIVE_V)
|
archive = os.path.join(db_dir, ARCHIVE_V)
|
||||||
|
|
||||||
cmd = [ "rcs", "-m%s:%s" % (rev, new_text), archive ]
|
cmd = [ "rcs", "-x,v", "-m%s:%s" % (rev, new_text), archive ]
|
||||||
|
|
||||||
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE)
|
||||||
status = proc.wait()
|
status = proc.wait()
|
||||||
@ -801,7 +804,7 @@ class DbManager(CLIDbManager):
|
|||||||
rev = self.data_to_delete[PATH_COL]
|
rev = self.data_to_delete[PATH_COL]
|
||||||
archive = os.path.join(db_dir, ARCHIVE_V)
|
archive = os.path.join(db_dir, ARCHIVE_V)
|
||||||
|
|
||||||
cmd = [ "rcs", "-o%s" % rev, "-q", archive ]
|
cmd = [ "rcs", "-x,v", "-o%s" % rev, "-q", archive ]
|
||||||
|
|
||||||
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE)
|
||||||
status = proc.wait()
|
status = proc.wait()
|
||||||
@ -1024,7 +1027,7 @@ def find_revisions(name):
|
|||||||
if not os.path.isfile(name):
|
if not os.path.isfile(name):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
rlog = [ "rlog", "-zLT" , name ]
|
rlog = [ "rlog", "-x,v", "-zLT" , name ]
|
||||||
|
|
||||||
proc = subprocess.Popen(rlog, stdout = subprocess.PIPE)
|
proc = subprocess.Popen(rlog, stdout = subprocess.PIPE)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
@ -1077,8 +1080,8 @@ def check_out(dbase, rev, path, callback):
|
|||||||
Checks out the revision from rcs, and loads the resulting XML file
|
Checks out the revision from rcs, and loads the resulting XML file
|
||||||
into the database.
|
into the database.
|
||||||
"""
|
"""
|
||||||
co_cmd = [ "co", "-q%s" % rev] + [ os.path.join(path, ARCHIVE),
|
co_cmd = [ "co", "-x,v", "-q%s" % rev] + [ os.path.join(path, ARCHIVE),
|
||||||
os.path.join(path, ARCHIVE_V)]
|
os.path.join(path, ARCHIVE_V)]
|
||||||
|
|
||||||
proc = subprocess.Popen(co_cmd, stderr = subprocess.PIPE)
|
proc = subprocess.Popen(co_cmd, stderr = subprocess.PIPE)
|
||||||
status = proc.wait()
|
status = proc.wait()
|
||||||
@ -1103,8 +1106,9 @@ def check_in(dbase, filename, callback, cursor_func = None):
|
|||||||
"""
|
"""
|
||||||
Checks in the specified file into RCS
|
Checks in the specified file into RCS
|
||||||
"""
|
"""
|
||||||
init = [ "rcs", '-i', '-U', '-q', '-t-"GRAMPS database"', ]
|
init = [ "rcs", '-x,v', '-i', '-U', '-q', '-t-"GRAMPS database"' ]
|
||||||
ci_cmd = [ "ci", "-q", "-f" ]
|
ci_cmd = [ "ci", '-x,v', "-q", "-f" ]
|
||||||
|
archive_name = filename + ",v"
|
||||||
|
|
||||||
glade_xml_file = glade.XML(const.GLADE_FILE, "comment", "gramps")
|
glade_xml_file = glade.XML(const.GLADE_FILE, "comment", "gramps")
|
||||||
top = glade_xml_file.get_widget('comment')
|
top = glade_xml_file.get_widget('comment')
|
||||||
@ -1114,27 +1118,36 @@ def check_in(dbase, filename, callback, cursor_func = None):
|
|||||||
comment = text.get_text()
|
comment = text.get_text()
|
||||||
top.destroy()
|
top.destroy()
|
||||||
|
|
||||||
if not os.path.isfile(filename + ",v") :
|
if not os.path.isfile(archive_name):
|
||||||
proc = subprocess.Popen(init + [filename + ",v"],
|
cmd = init + [archive_name]
|
||||||
|
proc = subprocess.Popen(cmd,
|
||||||
stderr = subprocess.PIPE)
|
stderr = subprocess.PIPE)
|
||||||
status = proc.wait()
|
status = proc.wait()
|
||||||
message = "\n".join(proc.stderr.readlines())
|
message = "\n".join(proc.stderr.readlines())
|
||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
del proc
|
del proc
|
||||||
|
|
||||||
|
if status != 0:
|
||||||
|
ErrorDialog(
|
||||||
|
_("Archiving failed"),
|
||||||
|
_("An attempt to create the archive failed "
|
||||||
|
"with the following message:\n\n%s") % message
|
||||||
|
)
|
||||||
|
|
||||||
if cursor_func:
|
if cursor_func:
|
||||||
cursor_func(_("Creating data to be archived..."))
|
cursor_func(_("Creating data to be archived..."))
|
||||||
xmlwrite = GrampsDbUtils.XmlWriter(dbase, callback, False, 0)
|
xmlwrite = GrampsDbUtils.XmlWriter(dbase, callback, False, 0)
|
||||||
xmlwrite.write(filename)
|
xmlwrite.write(filename)
|
||||||
|
|
||||||
cmd = ci_cmd + ['-m%s' % comment, filename, filename + ",v" ]
|
|
||||||
|
|
||||||
if cursor_func:
|
if cursor_func:
|
||||||
cursor_func(_("Saving archive..."))
|
cursor_func(_("Saving archive..."))
|
||||||
|
|
||||||
|
cmd = ci_cmd + ['-m%s' % comment, filename, archive_name ]
|
||||||
|
proc = subprocess.Popen(cmd,
|
||||||
|
stderr = subprocess.PIPE)
|
||||||
|
|
||||||
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE )
|
|
||||||
message = "\n".join(proc.stderr.readlines())
|
|
||||||
status = proc.wait()
|
status = proc.wait()
|
||||||
|
message = "\n".join(proc.stderr.readlines())
|
||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
del proc
|
del proc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user