Index: ChangeLog
from Akim Demaille <akim(a)epita.fr>
* prcs2svn/prcs2svn.py (string_unescape): Remove, useless.
* prcs2svn/prcs.py: s/\([a-z_]*\) * = *\1 *\+/\1 +=/.
(ProjectScanner.get_token): Do not escape the strings! This is not
your business.
Index: prcs2svn/prcs2svn.py
--- prcs2svn/prcs2svn.py (revision 101)
+++ prcs2svn/prcs2svn.py (working copy)
@@ -157,12 +157,6 @@
(e.g., via system calls)."""
return "\"" + re.sub (r'(["\\$`])', r'\\\1', arg) +
"\""
-## (Un)escape special chars in sh.
-def string_unescape(s):
- r = string.replace (s, "\$", "$")
- r = string.replace (r, "\\\\", "\\")
- return r
-
## Print copy on debug stream and copy a file.
def xcopy(src, dst):
trace ("cp --force " + src + " " + dst)
Index: prcs2svn/prcs.py
--- prcs2svn/prcs.py (revision 96)
+++ prcs2svn/prcs.py (working copy)
@@ -40,9 +40,9 @@
dirs = dirname.split(os.sep)
p = ""
for d in dirs:
- p = p + d
+ p += d
dictionary[p] = True
- p = p + os.sep
+ p += os.sep
return dictionary
## Convert a list into a pretty string.
@@ -50,9 +50,9 @@
res = ""
i = len(l)
for e in l:
- res = res + str(e)
+ res += str(e)
if i > 1:
- res = res + " "
+ res += " "
i = i - 1
return res
@@ -61,9 +61,9 @@
res = ""
for e in sx:
if isinstance(e, list):
- res = res + "(" + sexpr_to_string(e) +") "
+ res += "(" + sexpr_to_string(e) +") "
else:
- res = res + str(e) + " "
+ res += str(e) + " "
return res
## Sort file names by path.
@@ -122,7 +122,7 @@
## Convert the project file into a string
def __str__(self):
res = ";; -*- Prcs -*-\n"
- res = res + \
+ res += \
"(Created-By-Prcs-Version " +\
list_to_string(self.created_by_prcs_version) + ")\n\n" +\
"(Project-Description \"" + self.description +
"\")\n" +\
@@ -132,26 +132,26 @@
"(New-Version-Log\n\"" + self.new_version_log +
"\")\n\n" +\
"(Checkin-Time \"" + self.checkin_time +
"\")\n" +\
"(Checkin-Login " + self.checkin_login + ")\n\n"
- res = res + "(Files\n" + "\n ;; ./" + "\n"
+ res += "(Files\n" + "\n ;; ./" + "\n"
current_dir = ""
for e in self.files:
i = string.rfind(e[0], "/")
if i != -1:
dir = e[0][:i]
if current_dir != dir:
- res = res + "\n ;; ./" + dir + "/\n"
+ res += "\n ;; ./" + dir + "/\n"
current_dir = dir
- res = res + " (" + e[0] + " (" + list_to_string(e[1]) +
")"
+ res += " (" + e[0] + " (" + list_to_string(e[1]) +
")"
if len(e) >= 3:
- res = res + " " + e[2]
- res = res + ")\n"
- res = res + " )\n\n"
- res = res + "(Populate-Ignore\n (\n"
+ res += " " + e[2]
+ res += ")\n"
+ res += " )\n\n"
+ res += "(Populate-Ignore\n (\n"
if len(self.populate_ignore) > 0:
for e in self.populate_ignore[0]:
- res = res + " " + str(e) + "\n"
- res = res + " )\n )\n\n"
- res = res +\
+ res += " " + str(e) + "\n"
+ res += " )\n )\n\n"
+ res +=\
"(Project-Keywords " +\
sexpr_to_string(self.project_keywords) +")\n\n" +\
"(Merge-Parents " +\
@@ -191,8 +191,8 @@
if c == '\\':
c = self.getc()
if c not in ['\\', '"']:
- s = s + '\\'
- s = s + c
+ s += '\\'
+ s += c
c = self.getc()
if c == "":
return ""
@@ -217,9 +217,7 @@
if (len(self.token) > 1 and
c in [" ", ":", "(", ")"] and self.token[-1]
== '\\'):
self.token = self.token[:-1]
- if c in ["\"", "$"]:
- self.token = self.token + "\\"
- self.token = self.token + c
+ self.token += c
c = self.getc()
self.ungetc()
return self.token
@@ -329,19 +327,19 @@
def __str__(self):
res = ""
for i in self.links:
- res = res + i + "\t symbolic link\n"
+ res += i + "\t symbolic link\n"
for i in self.added_dirs:
- res = res + i + "\tadded directory\n"
+ res += i + "\tadded directory\n"
for i in self.added_files:
- res = res + i + "\tadded file\n"
+ res += i + "\tadded file\n"
for i in self.renamed:
- res = res + i[1] + "\trenamed from " + i[0] + "\n"
+ res += i[1] + "\trenamed from " + i[0] + "\n"
for i in self.deleted_files:
- res = res + i + "\tdeleted file\n"
+ res += i + "\tdeleted file\n"
for i in self.deleted_dirs:
- res = res + i + "\tdeleted directory\n"
+ res += i + "\tdeleted directory\n"
for i in self.modified:
- res = res + i + "\tmodified\n"
+ res += i + "\tmodified\n"
return res
Show replies by date