Changeset 581

Show
Ignore:
Timestamp:
10/31/04 16:16:40 (4 years ago)
Author:
jajcus
Message:

- better format of ChangeLog? entries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Makefile.am

    r578 r581  
    1717cl-stamp: .svn/entries 
    1818        TZ=UTC svn log -v --xml \ 
    19                 | aux/svn2log.py -p '/(branches/[^/]+|trunk)' -x ChangeLog -u aux/users 
     19                | aux/svn2log.py -p '/(branches/[^/]+|trunk)' -x ChangeLog -u aux/users -F 
    2020        touch cl-stamp 
    2121 
  • trunk/aux/svn2log.py

    r567 r581  
    4444reloc = { } 
    4545max_join_delta = 3 * 60 
     46list_format = False 
    4647 
    4748date_rx = re.compile(r"^(\d+-\d+-\d+T\d+:\d+:\d+)") 
     
    8586    return "%s <%s@%s>" % (u, u, default_domain) 
    8687 
    87 def wrap_text(str, pref, width): 
    88   ret = "" 
    89   line = "" 
     88def wrap_text_line(str, pref, width): 
     89  ret = u"" 
     90  line = u"" 
    9091  first_line = True 
    9192  for word in str.split(): 
    92     if line == "": 
     93    if line == u"": 
    9394      line = word 
    9495    else: 
    95       if len(line + " " + word) > width: 
     96      if len(line + u" " + word) > width: 
    9697        if first_line: 
    97           ret += line + "\n" 
     98          ret += line + u"\n" 
    9899          first_line = False 
    99100          line = word 
    100101        else: 
    101           ret += pref + line + "\n" 
     102          ret += pref + line + u"\n" 
    102103          line = word 
    103104      else: 
    104         line += " " + word 
     105        line += u" " + word 
    105106  if first_line: 
    106     ret += line + "\n" 
    107   else: 
    108     ret += pref + line + "\n" 
     107    ret += line + u"\n" 
     108  else: 
     109    ret += pref + line + u"\n" 
    109110  return ret 
     111 
     112def wrap_text(str, pref, width): 
     113  if not list_format: 
     114    return wrap_text_line(str,pref,width) 
     115  else: 
     116    items = re.split(r"\-\s+",str) 
     117    ret = wrap_text_line(items[0],pref,width) 
     118    for item in items[1:]: 
     119      ret += pref + u"- " + wrap_text_line(item,pref+"  ",width) 
     120    return ret 
    110121 
    111122class Entry: 
     
    126137    if self.rev != self.beg_rev: 
    127138      out.write("%s [r%s-%s]  %s\n\n" % \ 
    128                           (time.strftime("%Y-%m-%d %H:%M", time.gmtime(self.beg_tm)), \ 
     139                          (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \ 
    129140                           self.rev, self.beg_rev, convert_user(self.author))) 
    130141    else: 
    131142      out.write("%s [r%s]  %s\n\n" % \ 
    132                           (time.strftime("%Y-%m-%d %H:%M", time.gmtime(self.beg_tm)), \ 
     143                          (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \ 
    133144                           self.rev, convert_user(self.author))) 
    134145    out.write(self.msg) 
     
    201212  -d, --domain=DOMAIN  set default domain for logins not listed in users file 
    202213  -u, --users=FILE     read logins from specified file 
     214  -F, --list-format    format commit logs with enumerated change list (items 
     215                       prefixed by '- ') 
    203216  -r, --relocate=X=Y   before doing any other operations on paths, replace 
    204217                       X with Y (useful for directory moves) 
     
    229242def process_opts(): 
    230243  try: 
    231     opts, args = getopt.gnu_getopt(sys.argv[1:], "o:u:p:x:d:r:d:h",  
     244    opts, args = getopt.gnu_getopt(sys.argv[1:], "o:u:p:x:d:r:d:D:Fh",  
    232245                                   ["users=", "prefix=", "domain=", "delta=", 
    233                                     "exclude=", "help", "output=", "relocate="]) 
     246                                    "exclude=", "help", "output=", "relocate=", 
     247                                    "list-format"]) 
    234248  except getopt.GetoptError: 
    235249    usage() 
     
    237251  fin = sys.stdin 
    238252  fout = None 
    239   global kill_prefix_rx, exclude, users, default_domain, reloc, max_join_delta 
     253  global kill_prefix_rx, exclude, users, default_domain, reloc, max_join_delta, list_format 
    240254  for o, a in opts: 
    241255    if o in ("--prefix", "-p"): 
     
    262276    elif o in ("--delta", "-D"): 
    263277      max_join_delta = int(a) 
     278    elif o in ("--list-format", "-F"): 
     279      list_format = True 
    264280    else: 
    265281      usage()