contrib/hgk.py
changeset 1308 2073e5a71008
parent 1278 6a0d373d3126
child 1344 ca0e27e05de3
equal deleted inserted replaced
1285:1546c2aa6b30 1308:2073e5a71008
    84         date1 = date(change)
    84         date1 = date(change)
    85         empty = "0" * 40;
    85         empty = "0" * 40;
    86 
    86 
    87         for f in c:
    87         for f in c:
    88             # TODO get file permissions
    88             # TODO get file permissions
    89             print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]), 
    89             print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]),
    90                                                       hg.hex(mmap2[f]), f, f)
    90                                                       hg.hex(mmap2[f]), f, f)
    91         for f in a:
    91         for f in a:
    92             print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f)
    92             print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f)
    93         for f in d:
    93         for f in d:
    94             print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f)
    94             print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f)
   135     lines = changes[4].splitlines()
   135     lines = changes[4].splitlines()
   136     if lines[-1].startswith('committer:'):
   136     if lines[-1].startswith('committer:'):
   137         committer = lines[-1].split(': ')[1].rstrip()
   137         committer = lines[-1].split(': ')[1].rstrip()
   138     else:
   138     else:
   139         committer = "%s %s %s" % (changes[1], date, date_ar[1])
   139         committer = "%s %s %s" % (changes[1], date, date_ar[1])
   140         
   140 
   141     print "author %s %s %s" % (changes[1], date, date_ar[1])
   141     print "author %s %s %s" % (changes[1], date, date_ar[1])
   142     print "committer %s" % (committer)
   142     print "committer %s" % (committer)
   143     print ""
   143     print ""
   144     if prefix != "":
   144     if prefix != "":
   145         print "%s%s" % (prefix, changes[4].replace('\n', nlprefix).strip())
   145         print "%s%s" % (prefix, changes[4].replace('\n', nlprefix).strip())
   218             for x in xrange(chunk-1, -1, -1):
   218             for x in xrange(chunk-1, -1, -1):
   219                 if l[x] != 0:
   219                 if l[x] != 0:
   220                     yield (i + x, full != None and l[x] or None)
   220                     yield (i + x, full != None and l[x] or None)
   221             if i == 0:
   221             if i == 0:
   222                 break
   222                 break
   223             
   223 
   224     # calculate and return the reachability bitmask for sha
   224     # calculate and return the reachability bitmask for sha
   225     def is_reachable(ar, reachable, sha):
   225     def is_reachable(ar, reachable, sha):
   226         if len(ar) == 0:
   226         if len(ar) == 0:
   227             return 1
   227             return 1
   228         mask = 0
   228         mask = 0