equal
deleted
inserted
replaced
147 yield chunk(cur) |
147 yield chunk(cur) |
148 |
148 |
149 def remainder(cur): |
149 def remainder(cur): |
150 yield chunk(cur) |
150 yield chunk(cur) |
151 |
151 |
152 class fiter(object): |
152 class fiter: |
153 def __init__(self, fp): |
153 def __init__(self, fp): |
154 self.fp = fp |
154 self.fp = fp |
155 |
155 |
156 def __iter__(self): |
156 def __iter__(self): |
157 return self |
157 return self |
340 data[b'filename'] = tmpname |
340 data[b'filename'] = tmpname |
341 |
341 |
342 return data |
342 return data |
343 |
343 |
344 |
344 |
345 class patchmeta(object): |
345 class patchmeta: |
346 """Patched file metadata |
346 """Patched file metadata |
347 |
347 |
348 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY |
348 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY |
349 or COPY. 'path' is patched file path. 'oldpath' is set to the |
349 or COPY. 'path' is patched file path. 'oldpath' is set to the |
350 origin file when 'op' is either COPY or RENAME, None otherwise. If |
350 origin file when 'op' is either COPY or RENAME, None otherwise. If |
433 gitpatches.append(gp) |
433 gitpatches.append(gp) |
434 |
434 |
435 return gitpatches |
435 return gitpatches |
436 |
436 |
437 |
437 |
438 class linereader(object): |
438 class linereader: |
439 # simple class to allow pushing lines back into the input stream |
439 # simple class to allow pushing lines back into the input stream |
440 def __init__(self, fp): |
440 def __init__(self, fp): |
441 self.fp = fp |
441 self.fp = fp |
442 self.buf = [] |
442 self.buf = [] |
443 |
443 |
454 |
454 |
455 def __iter__(self): |
455 def __iter__(self): |
456 return iter(self.readline, b'') |
456 return iter(self.readline, b'') |
457 |
457 |
458 |
458 |
459 class abstractbackend(object): |
459 class abstractbackend: |
460 def __init__(self, ui): |
460 def __init__(self, ui): |
461 self.ui = ui |
461 self.ui = ui |
462 |
462 |
463 def getfile(self, fname): |
463 def getfile(self, fname): |
464 """Return target file data and flags as a (data, (islink, |
464 """Return target file data and flags as a (data, (islink, |
590 if changed: |
590 if changed: |
591 scmutil.marktouched(self.repo, changed, self.similarity) |
591 scmutil.marktouched(self.repo, changed, self.similarity) |
592 return sorted(self.changed) |
592 return sorted(self.changed) |
593 |
593 |
594 |
594 |
595 class filestore(object): |
595 class filestore: |
596 def __init__(self, maxsize=None): |
596 def __init__(self, maxsize=None): |
597 self.opener = None |
597 self.opener = None |
598 self.files = {} |
598 self.files = {} |
599 self.created = 0 |
599 self.created = 0 |
600 self.maxsize = maxsize |
600 self.maxsize = maxsize |
679 unidesc = re.compile(br'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') |
679 unidesc = re.compile(br'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') |
680 contextdesc = re.compile(br'(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') |
680 contextdesc = re.compile(br'(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') |
681 eolmodes = [b'strict', b'crlf', b'lf', b'auto'] |
681 eolmodes = [b'strict', b'crlf', b'lf', b'auto'] |
682 |
682 |
683 |
683 |
684 class patchfile(object): |
684 class patchfile: |
685 def __init__(self, ui, gp, backend, store, eolmode=b'strict'): |
685 def __init__(self, ui, gp, backend, store, eolmode=b'strict'): |
686 self.fname = gp.path |
686 self.fname = gp.path |
687 self.eolmode = eolmode |
687 self.eolmode = eolmode |
688 self.eol = None |
688 self.eol = None |
689 self.backend = backend |
689 self.backend = backend |
912 self.writelines(self.fname, self.lines, self.mode) |
912 self.writelines(self.fname, self.lines, self.mode) |
913 self.write_rej() |
913 self.write_rej() |
914 return len(self.rej) |
914 return len(self.rej) |
915 |
915 |
916 |
916 |
917 class header(object): |
917 class header: |
918 """patch header""" |
918 """patch header""" |
919 |
919 |
920 diffgit_re = re.compile(b'diff --git a/(.*) b/(.*)$') |
920 diffgit_re = re.compile(b'diff --git a/(.*) b/(.*)$') |
921 diff_re = re.compile(b'diff -r .* (.*)$') |
921 diff_re = re.compile(b'diff -r .* (.*)$') |
922 allhunks_re = re.compile(b'(?:index|deleted file) ') |
922 allhunks_re = re.compile(b'(?:index|deleted file) ') |
992 return emptynewfile or any( |
992 return emptynewfile or any( |
993 self.special_re.match(h) for h in self.header |
993 self.special_re.match(h) for h in self.header |
994 ) |
994 ) |
995 |
995 |
996 |
996 |
997 class recordhunk(object): |
997 class recordhunk: |
998 """patch hunk |
998 """patch hunk |
999 |
999 |
1000 XXX shouldn't we merge this with the other hunk class? |
1000 XXX shouldn't we merge this with the other hunk class? |
1001 """ |
1001 """ |
1002 |
1002 |
1347 ), |
1347 ), |
1348 {}, |
1348 {}, |
1349 ) |
1349 ) |
1350 |
1350 |
1351 |
1351 |
1352 class hunk(object): |
1352 class hunk: |
1353 def __init__(self, desc, num, lr, context): |
1353 def __init__(self, desc, num, lr, context): |
1354 self.number = num |
1354 self.number = num |
1355 self.desc = desc |
1355 self.desc = desc |
1356 self.hunk = [desc] |
1356 self.hunk = [desc] |
1357 self.a = [] |
1357 self.a = [] |
1575 if self.lenb and newstart > 0: |
1575 if self.lenb and newstart > 0: |
1576 newstart -= 1 |
1576 newstart -= 1 |
1577 return old, oldstart, new, newstart |
1577 return old, oldstart, new, newstart |
1578 |
1578 |
1579 |
1579 |
1580 class binhunk(object): |
1580 class binhunk: |
1581 """A binary patch file.""" |
1581 """A binary patch file.""" |
1582 |
1582 |
1583 def __init__(self, lr, fname): |
1583 def __init__(self, lr, fname): |
1584 self.text = None |
1584 self.text = None |
1585 self.delta = False |
1585 self.delta = False |
1756 @@ -8,1 +9,2 @@ |
1756 @@ -8,1 +9,2 @@ |
1757 8 |
1757 8 |
1758 +9 |
1758 +9 |
1759 """ |
1759 """ |
1760 |
1760 |
1761 class parser(object): |
1761 class parser: |
1762 """patch parsing state machine""" |
1762 """patch parsing state machine""" |
1763 |
1763 |
1764 def __init__(self): |
1764 def __init__(self): |
1765 self.fromline = 0 |
1765 self.fromline = 0 |
1766 self.toline = 0 |
1766 self.toline = 0 |