Nicolas, peut-tu mettre ton expertise yaml perl au service de checkin
pour qu'on ait un fichier de conf pour paramétrer "checkin", plutôt
que des vars d'env ?
Merci !
2004-09-20 Akim Demaille <akim(a)epita.fr>
* src/checkin (get_user_info): Fix the use of getpwnam.
* doc/lrdetools.texi: Space changes.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 102)
+++ ChangeLog (working copy)
@@ -1,5 +1,10 @@
2004-09-20 Akim Demaille <akim(a)epita.fr>
+ * src/checkin (get_user_info): Fix the use of getpwnam.
+ * doc/lrdetools.texi: Space changes.
+
+2004-09-20 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
Index: src/checkin
===================================================================
--- src/checkin (revision 96)
+++ src/checkin (working copy)
@@ -128,7 +128,9 @@
$params{"FULLNAME"} = $ENV{"FULLNAME"};
if (not defined $params{"FULLNAME"})
{
- $params{"FULLNAME"} = getpwnam $ENV{"USER"}[6];
+ $params{"FULLNAME"} =
+ # Keep the Full Name, first ,-field.
+ (split /,/, (getpwnam $ENV{"USER"})[6])[0];
print STDERR "Warning: FULLNAME not set, using " . $params{"FULLNAME"} .
" instead.\n";
}
Index: doc/lrdetools.texi
===================================================================
--- doc/lrdetools.texi (revision 96)
+++ doc/lrdetools.texi (working copy)
@@ -330,9 +330,9 @@
@node checkin
@section @command{checkin}
-@command{checkin} is a Perl script designed to work conjointly with CVS,
-PRCS or Subversion. When launched, it produces diffs from the server
-and creates a @file{ChangeLog} entry with each modified file. It then
+@command{checkin} is designed to work conjointly with CVS, PRCS or
+Subversion. When launched, it produces diffs from the server and
+creates a @file{ChangeLog} entry with each modified file. It then
launches your favorite text editor on the diff file and the
@file{ChangeLog}, to allow you complete it. Once you have finished, it
proposes you to write a particular comment. Then the checkin (or
@@ -432,9 +432,9 @@
@node Using checkin
@subsection Using @command{checkin}
-@command{checkin} always start by doing a checkout or an update onto
-the repository unless you told him explicitly not to do so. This
-avoid dummy mistakes.
+@command{checkin} always start by doing a checkout or an update onto the
+repository unless you told him explicitly not to do so. This avoid dummy
+mistakes.
@command{checkin} generates the following files:
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
Index: trunk/ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Factor boolean tasks.
* src/task/boolean_task.hh, src/task/boolean_task.cc:
* src/task/Makefile.am:
Distribute new files.
* src/vm/vm-tasks.hh, src/vm/vm-tasks.cc,
* src/task/libtask.hh:
Use boolean tasks.
2004-09-18 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: trunk/src/task/boolean_task.hh
--- trunk/src/task/boolean_task.hh (revision 0)
+++ trunk/src/task/boolean_task.hh (revision 122)
@@ -0,0 +1,44 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Benoit Perrot <benoit(a)lrde.epita.fr>
+//
+// Nolimips is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Nolimips is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+#ifndef TASK_BOOLEAN_TASK_HH
+# define TASK_BOOLEAN_TASK_HH
+
+#include "task/task.hh"
+
+namespace task
+{
+
+ class BooleanTask: public Task
+ {
+ public:
+ BooleanTask(bool &flag,
+ const std::string& option, const std::string& module_name,
+ const std::string& desc, const std::string& deps = "");
+
+ public:
+ virtual void execute() const;
+
+ private:
+ mutable bool &flag_;
+ };
+
+} // namespace task
+
+#endif // !TASK_BOOLEAN_TASK_HH
Index: trunk/src/task/boolean_task.cc
--- trunk/src/task/boolean_task.cc (revision 0)
+++ trunk/src/task/boolean_task.cc (revision 122)
@@ -0,0 +1,41 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Benoit Perrot <benoit(a)lrde.epita.fr>
+//
+// Nolimips is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Nolimips is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+
+#include "task/boolean_task.hh"
+
+namespace task
+{
+
+ BooleanTask::BooleanTask(bool &flag,
+ const std::string& option,
+ const std::string& module_name,
+ const std::string& desc,
+ const std::string& deps):
+ Task(option, module_name, desc, deps),
+ flag_(flag)
+ {}
+
+ void
+ BooleanTask::execute (void) const
+ {
+ flag_ = true;
+ }
+
+} //namespace task
Index: trunk/src/task/libtask.hh
--- trunk/src/task/libtask.hh (revision 121)
+++ trunk/src/task/libtask.hh (revision 122)
@@ -22,21 +22,32 @@
# define TASK_LIBTASK_HH
# include "task/function_task.hh"
+# include "task/boolean_task.hh"
# ifdef NOLIMIPS_CC_
# define TASK_MODULE(Name) \
const char module_name [] = Name;
+
# define TASK_DECLARE(Option, Desc, Routine, Deps) \
extern void (Routine) (void); \
- task::FunctionTask task_##Routine (Routine, \
+ static task::FunctionTask task_##Routine (Routine, \
Option, module_name, \
Desc, Deps)
+
+# define BOOLEAN_TASK_DECLARE(Option, Desc, Flag, Deps) \
+ bool Flag; \
+ static task::BooleanTask task_##Flag(Flag, \
+ Option, module_name, \
+ Desc, Deps)
+
# else // !NOLIMIPS_CC_
# define TASK_MODULE(Name)
# define TASK_DECLARE(Name, Help, Routine, Dependencies) \
extern void (Routine) (void)
+# define BOOLEAN_TASK_DECLARE(Name, Help, Flag, Dependencies)\
+ extern bool Flag
# endif // NOLIMIPS_CC_
Index: trunk/src/task/Makefile.am
--- trunk/src/task/Makefile.am (revision 121)
+++ trunk/src/task/Makefile.am (revision 122)
@@ -4,6 +4,7 @@
libtask_a_SOURCES = \
task.hh task.cc \
function_task.hh function_task.cc \
+ boolean_task.hh boolean_task.cc \
task_register.hh task_register.cc \
libtask.hh \
task-tasks.hh task-tasks.cc
Index: trunk/src/vm/vm-tasks.hh
--- trunk/src/vm/vm-tasks.hh (revision 121)
+++ trunk/src/vm/vm-tasks.hh (revision 122)
@@ -29,13 +29,13 @@
TASK_MODULE ("3. Virtual Machine");
- TASK_DECLARE ("check-callee-save",
+ BOOLEAN_TASK_DECLARE ("check-callee-save",
"Warn if a callee save register "
"is not preserved across a call",
- check_callee_save, "");
+ check_callee_save_p, "");
- TASK_DECLARE ("E|trace-exec", "Trace the execution",
- trace_exec, "");
+ BOOLEAN_TASK_DECLARE ("E|trace-exec", "Trace the execution",
+ trace_exec_p, "");
TASK_DECLARE ("e|execute", "Execute the program on virtual machine",
execute, "prg-solve");
Index: trunk/src/vm/vm-tasks.cc
--- trunk/src/vm/vm-tasks.cc (revision 121)
+++ trunk/src/vm/vm-tasks.cc (revision 122)
@@ -29,20 +29,6 @@
namespace tasks
{
- static bool check_callee_save_p = false;
- void
- check_callee_save ()
- {
- check_callee_save_p = true;
- }
-
- static bool trace_exec_p = false;
- void
- trace_exec ()
- {
- trace_exec_p = true;
- }
-
void
execute ()
{
Euh... Est-ce qu'elle a déjà _vraiment_ fonctionné cette option ???
Même le test dit de "cohérence" est incohérent...
- if (date_d > dd and date_d < de) or \
- (date_e > dd and date_e < dd):
Index: ChangeLog
from Akim Demaille <akim(a)epita.fr>
* prcs2svn/prcs2svn.py (Prcs2svn.test_date_coherency):
Well... almost rewrite it.
Use understandable variable names.
Use readable date formats.
Issue readable error messages.
Don't run when not required.
(DatesSuperposition.mesg): Enhance the informational contents.
Index: prcs2svn/prcs2svn.py
--- prcs2svn/prcs2svn.py (revision 98)
+++ prcs2svn/prcs2svn.py (working copy)
@@ -55,9 +55,11 @@
AbstractError.__init__(self, self.mesg)
class DatesSuperposition(AbstractError):
- mesg = "The dates of your projects must not be superposed (don't use -p)."
- def __init__(self):
- AbstractError.__init__(self, self.mesg)
+ mesg = "These projects have overlapping chronologies (don't use -p)."
+ def __init__(self, p1, d1b, d1e, p2, d2b, d2e):
+ AbstractError.__init__(self,
+ "%s\n %s (%s -- %s)\n %s (%s -- %s)" %
+ (self.mesg, p1, d1b, d1e, p2, d2b, d2e))
class SvnCopyForbidden(AbstractError):
mesg = "You must copy the svn repository via file system"
@@ -785,6 +787,8 @@
## Test.
def test_date_coherency(self):
+ if not infos.preserve_dates:
+ return
info("> Test date coherency of projects")
dates = []
for project in infos.prcs_projects:
@@ -794,23 +798,28 @@
prcs_info = xpopen("prcs info --plain-format -f --sort=date " +\
project + ".prj | sed -ne \"1p;\$p\"" +\
" | sed -e \"s/.*, \(.*\) +[0-9]* by .*/\\1/\"" )
- f_date = ""
- l_date = ""
+ begin = ""
+ end = ""
for f in prcs_info:
- if len(f_date) == 0:
- f_date = f[:-1]
+ if begin:
+ end = f[:-1]
else:
- l_date = f[:-1]
- dates.append((time.mktime(time.strptime(f_date, "%d %b %Y %H:%M:%S")),
- time.mktime(time.strptime(l_date, "%d %b %Y %H:%M:%S")),
- project))
+ begin = f[:-1]
prcs_info.close()
- for (date_d, date_e, proj) in dates:
- for (dd, de, p) in dates:
- if p != proj:
- if (date_d > dd and date_d < de) or \
- (date_e > dd and date_e < dd):
- raise DatesSuperposition()
+ # DATES will be sorted by date, so leave BEGIN first.
+ dates.append ((time.strftime ("%F %T",
+ time.strptime (begin,
+ "%d %b %Y %H:%M:%S")),
+ time.strftime ("%F %T",
+ time.strptime (end, "%d %b %Y %H:%M:%S")),
+ project))
+ # Proj, Begin, End.
+ for (b1, e1, p1) in dates:
+ for (b2, e2, p2) in dates:
+ if p1 != p2:
+ if not (e2 < b1 or e1 < b2):
+ raise DatesSuperposition (p1, b1, e1,
+ p2, b2, e2)
dates.sort()
infos.prcs_projects = [z for (x,y,z) in dates]