[sgt] / svn-tools / svndumpfilter2 Repository:
ViewVC logotype

Diff of /svn-tools/svndumpfilter2

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7275, Mon Feb 12 10:09:28 2007 UTC revision 7468, Wed Apr 18 23:05:00 2007 UTC
# Line 58  Line 58 
58  import types  import types
59  import md5  import md5
60    
61    # Quoting function which should render any string impervious to
62    # POSIX shell metacharacter expansion.
63    def quote(word):
64        return "'" + string.replace(word, "'", "'\\''") + "'"
65    
66  # First, the sensible way to deal with a pathname is to split it  # First, the sensible way to deal with a pathname is to split it
67  # into pieces at the slashes and thereafter treat it as a list.  # into pieces at the slashes and thereafter treat it as a list.
68  def splitpath(s):  def splitpath(s):
# Line 255  Line 260 
260                          # extract the subtree and convert it into                          # extract the subtree and convert it into
261                          # lumps.                          # lumps.
262                          treecmd = "svnlook tree -r%d %s %s" % \                          treecmd = "svnlook tree -r%d %s %s" % \
263                          (srcrev, repos, srcpath)                          (srcrev, quote(repos), quote(srcpath))
264                          tree = os.popen(treecmd, "r")                          tree = os.popen(treecmd, "r")
265                          pathcomponents = []                          pathcomponents = []
266                          while 1:                          while 1:
# Line 277  Line 282 
282                              newlump.sethdr("Node-path", thisdstpath)                              newlump.sethdr("Node-path", thisdstpath)
283                              newlump.sethdr("Node-action", "add")                              newlump.sethdr("Node-action", "add")
284                              props = os.popen("svnlook pl -r%d %s %s" % \                              props = os.popen("svnlook pl -r%d %s %s" % \
285                              (srcrev, repos, thissrcpath), "r")                              (srcrev, quote(repos), quote(thissrcpath)), "r")
286                              while 1:                              while 1:
287                                  propname = props.readline()                                  propname = props.readline()
288                                  if propname == "": break                                  if propname == "": break
289                                  if propname[-1:] == "\n": propname = propname[:-1]                                  if propname[-1:] == "\n": propname = propname[:-1]
290                                  while propname[:1] == " ": propname = propname[1:]                                  while propname[:1] == " ": propname = propname[1:]
291                                  propf = os.popen("svnlook pg -r%d %s %s %s" % \                                  propf = os.popen("svnlook pg -r%d %s %s %s" % \
292                                  (srcrev, repos, propname, thissrcpath), "r")                                  (srcrev, quote(repos), quote(propname), quote(thissrcpath)), "r")
293                                  proptext = propf.read()                                  proptext = propf.read()
294                                  propf.close()                                  propf.close()
295                                  newlump.setprop(propname, proptext)                                  newlump.setprop(propname, proptext)
# Line 294  Line 299 
299                              else:                              else:
300                                  newlump.sethdr("Node-kind", "file")                                  newlump.sethdr("Node-kind", "file")
301                                  f = os.popen("svnlook cat -r%d %s %s" % \                                  f = os.popen("svnlook cat -r%d %s %s" % \
302                                  (srcrev, repos, thissrcpath), "r")                                  (srcrev, quote(repos), quote(thissrcpath)), "r")
303                                  newlump.text = f.read()                                  newlump.text = f.read()
304                                  f.close()                                  f.close()
305                              contents2.append(newlump)                              contents2.append(newlump)

Legend:
Removed from v.7275  
changed lines
  Added in v.7468

CVS Admin
ViewVC Help
Powered by ViewVC 1.0.5