hgext/convert/p4.py
changeset 43787 be8552f25cab
parent 43077 687b865b95ad
child 47068 3af293735d0f
equal deleted inserted replaced
43786:421ea5772039 43787:be8552f25cab
    22 
    22 
    23 from . import common
    23 from . import common
    24 
    24 
    25 
    25 
    26 def loaditer(f):
    26 def loaditer(f):
    27     b"Yield the dictionary objects generated by p4"
    27     """Yield the dictionary objects generated by p4"""
    28     try:
    28     try:
    29         while True:
    29         while True:
    30             d = marshal.load(f)
    30             d = marshal.load(f)
    31             if not d:
    31             if not d:
    32                 break
    32                 break
   103         imports if a revmap is provided.
   103         imports if a revmap is provided.
   104         """
   104         """
   105         self.revmap = revmap
   105         self.revmap = revmap
   106 
   106 
   107     def _parse_view(self, path):
   107     def _parse_view(self, path):
   108         b"Read changes affecting the path"
   108         """Read changes affecting the path"""
   109         cmd = b'p4 -G changes -s submitted %s' % procutil.shellquote(path)
   109         cmd = b'p4 -G changes -s submitted %s' % procutil.shellquote(path)
   110         stdout = procutil.popen(cmd, mode=b'rb')
   110         stdout = procutil.popen(cmd, mode=b'rb')
   111         p4changes = {}
   111         p4changes = {}
   112         for d in loaditer(stdout):
   112         for d in loaditer(stdout):
   113             c = d.get(b"change", None)
   113             c = d.get(b"change", None)
   114             if c:
   114             if c:
   115                 p4changes[c] = True
   115                 p4changes[c] = True
   116         return p4changes
   116         return p4changes
   117 
   117 
   118     def _parse(self, ui, path):
   118     def _parse(self, ui, path):
   119         b"Prepare list of P4 filenames and revisions to import"
   119         """Prepare list of P4 filenames and revisions to import"""
   120         p4changes = {}
   120         p4changes = {}
   121         changeset = {}
   121         changeset = {}
   122         files_map = {}
   122         files_map = {}
   123         copies_map = {}
   123         copies_map = {}
   124         localname = {}
   124         localname = {}