hgext/convert/p4.py
changeset 7869 bc027d72c289
parent 7823 11efa41037e2
child 7905 d596b1f2935a
child 8063 ee8d9b93b316
equal deleted inserted replaced
7868:2b901f9b37aa 7869:bc027d72c289
    64             else:
    64             else:
    65                 views = {"//": ""}
    65                 views = {"//": ""}
    66         else:
    66         else:
    67             cmd = "p4 -G client -o '%s'" % path
    67             cmd = "p4 -G client -o '%s'" % path
    68             clientspec = marshal.load(util.popen(cmd))
    68             clientspec = marshal.load(util.popen(cmd))
    69             
    69 
    70             views = {}
    70             views = {}
    71             for client in clientspec:
    71             for client in clientspec:
    72                 if client.startswith("View"):
    72                 if client.startswith("View"):
    73                     sview, cview = clientspec[client].split()
    73                     sview, cview = clientspec[client].split()
    74                     self._parse_view(sview)
    74                     self._parse_view(sview)
    87         vieworder = views.keys()
    87         vieworder = views.keys()
    88         vieworder.sort(key=lambda x: -len(x))
    88         vieworder.sort(key=lambda x: -len(x))
    89 
    89 
    90         # handle revision limiting
    90         # handle revision limiting
    91         startrev = self.ui.config('convert', 'p4.startrev', default=0)
    91         startrev = self.ui.config('convert', 'p4.startrev', default=0)
    92         self.p4changes = [x for x in self.p4changes 
    92         self.p4changes = [x for x in self.p4changes
    93                           if ((not startrev or int(x) >= int(startrev)) and 
    93                           if ((not startrev or int(x) >= int(startrev)) and
    94                               (not self.rev or int(x) <= int(self.rev)))]
    94                               (not self.rev or int(x) <= int(self.rev)))]
    95 
    95 
    96         # now read the full changelists to get the list of file revisions
    96         # now read the full changelists to get the list of file revisions
    97         ui.status(_('collecting p4 changelists\n'))
    97         ui.status(_('collecting p4 changelists\n'))
    98         lastid = None
    98         lastid = None
   108 
   108 
   109             if lastid:
   109             if lastid:
   110                 parents = [lastid]
   110                 parents = [lastid]
   111             else:
   111             else:
   112                 parents = []
   112                 parents = []
   113             
   113 
   114             date = (int(d["time"]), 0)     # timezone not set
   114             date = (int(d["time"]), 0)     # timezone not set
   115             c = commit(author=self.recode(d["user"]), date=util.datestr(date),
   115             c = commit(author=self.recode(d["user"]), date=util.datestr(date),
   116                         parents=parents, desc=desc, branch='', extra={"p4": change})
   116                         parents=parents, desc=desc, branch='', extra={"p4": change})
   117 
   117 
   118             files = []
   118             files = []
   129                     self.depotname[filename] = oldname
   129                     self.depotname[filename] = oldname
   130                 i += 1
   130                 i += 1
   131             self.changeset[change] = c
   131             self.changeset[change] = c
   132             self.files[change] = files
   132             self.files[change] = files
   133             lastid = change
   133             lastid = change
   134         
   134 
   135         if lastid:
   135         if lastid:
   136             self.heads = [lastid]
   136             self.heads = [lastid]
   137 
   137 
   138     def getheads(self):
   138     def getheads(self):
   139         return self.heads
   139         return self.heads