Index: ChangeLog
from Akim Demaille <akim(a)epita.fr>
* prcs2svn/prcs2svn.py (repositoryCmp.prjname): New, to pass prj
names instead of project names to prcs.
(Prcs.prjname): Likewise.
Index: prcs2svn/prcs2svn.py
--- prcs2svn/prcs2svn.py (revision 85)
+++ prcs2svn/prcs2svn.py (working copy)
@@ -323,6 +323,9 @@
# Prcs project's name.
__prcs_project = ""
+ def prjname (self):
+ """Name of the PRJ file."""
+ return self.prcs_project + ".prj"
def __del__(self):
shutil.rmtree(self.tmp, True)
@@ -344,7 +347,7 @@
result = dircmp.cmp(os.path.join(os.getcwd(), path_prcs),
os.path.join(os.getcwd(), path_svn),
self.keywords_clean,
- [".svn", self.prcs_project + ".prj"])
+ [".svn", self.prjname ()])
if not result:
dircmp.report()
raise RepositoriesDifferent()
@@ -357,7 +360,7 @@
prcs_revision = " -r " + prcs_revision + " "
os.mkdir(self.prcs_project + "_prcs")
os.chdir(self.prcs_project + "_prcs")
- xsystem("prcs checkout -f " + prcs_revision + self.prcs_project)
+ xsystem("prcs checkout -f " + prcs_revision + self.prjname ())
svn_repo = os.path.join(self.svn_project, os.path.join(infos.subdir,
"trunk"))
if len(infos.prcs_projects) > 1:
svn_repo = os.path.join(svn_repo, self.prcs_project)
@@ -376,7 +379,7 @@
def cmp_branch(self, prcs_revision):
os.mkdir(self.prcs_project + prcs_revision + "_prcs")
os.chdir(self.prcs_project + prcs_revision + "_prcs")
- xsystem("prcs checkout -f -r" + prcs_revision + " " +
self.prcs_project)
+ xsystem("prcs checkout -f -r" + prcs_revision + " " +
self.prjname ())
svn_repo = self.svn_project + "/" + os.path.join(infos.subdir,
"branches")
svn_repo = os.path.join(self.svn_project, os.path.join(infos.subdir,
"branches"))
if len(infos.prcs_projects) > 1:
@@ -684,6 +687,10 @@
# Prcs project's name.
name = ""
+ def prjname (self):
+ """Name of the PRJ file."""
+ return self.name + ".prj"
+
# Date of project.
create_date = ""
@@ -708,7 +715,7 @@
re_DELETED = re.compile(".*DELETED\*$")
prcs_versions = []
pipe = os.popen("prcs info --plain-format -f --sort=date " +\
- self.name + ".prj")
+ self.prjname ())
for line in pipe:
prcs_desc = line.split(" ")
if re_DELETED.match(line):
@@ -727,7 +734,7 @@
# Parse the prj file.
def parse(self):
self.prev_prj = self.prj
- self.prj = self.prj_parser.parse(self.name + ".prj")
+ self.prj = self.prj_parser.parse(self.prjname ())
info(" * User: " + self.prj.checkin_login)
info(" * Version-Log: " + self.prj.version_log)
info(" * Time: " + self.prj.checkin_time)
@@ -736,7 +743,7 @@
def project_parent_set(self):
if self.prj.parent_version.name() != self.prev_prj.version.name():
xsystem("prcs checkout -f -r " + self.prj.parent_version.name() + "
" +\
- self.name + ".prj " + self.name + ".prj")
+ self.prjname () + " " + self.prjname ())
self.prev_prj = self.prj_parser.parse(self.name + ".prj")
@@ -769,7 +776,7 @@
prcs_versions = []
# FIXME: should use python features instead of sed.
prcs_info = os.popen("prcs info --plain-format -f --sort=date " +\
- project + " | sed -ne \"1p;\$p\"" +\
+ project + ".prj | sed -ne \"1p;\$p\"" +\
" | sed -e \"s/.*, \(.*\) +[0-9]* by
.*/\\1/\"" )
f_date = ""
l_date = ""
@@ -1061,6 +1068,7 @@
self.desinit_repositories()
def init_repositories(self):
+ if infos.copy_prcs:
self.copy_prcs_repository()
self.copy_svn_repository()
self.create_svn_repository()
@@ -1082,8 +1090,6 @@
# Copy the prcs repository to work locally.
def copy_prcs_repository(self):
- if not infos.copy_prcs:
- return
info("> Copy prcs repository")
tmp = tempfile.mkdtemp(".prcs", "prcs2svn")
pwd = os.getcwd()