equal
deleted
inserted
replaced
20 from .node import ( |
20 from .node import ( |
21 hex, |
21 hex, |
22 sha1nodeconstants, |
22 sha1nodeconstants, |
23 short, |
23 short, |
24 ) |
24 ) |
25 from .pycompat import open |
|
26 from . import ( |
25 from . import ( |
27 copies, |
26 copies, |
28 diffhelper, |
27 diffhelper, |
29 diffutil, |
28 diffutil, |
30 encoding, |
29 encoding, |
2380 raise error.Abort(_(b'unsupported line endings type: %s') % eolmode) |
2379 raise error.Abort(_(b'unsupported line endings type: %s') % eolmode) |
2381 eolmode = eolmode.lower() |
2380 eolmode = eolmode.lower() |
2382 |
2381 |
2383 store = filestore() |
2382 store = filestore() |
2384 try: |
2383 try: |
2385 fp = open(patchobj, b'rb') |
2384 fp = open(patchobj, 'rb') |
2386 except TypeError: |
2385 except TypeError: |
2387 fp = patchobj |
2386 fp = patchobj |
2388 try: |
2387 try: |
2389 ret = applydiff( |
2388 ret = applydiff( |
2390 ui, fp, backend, store, strip=strip, prefix=prefix, eolmode=eolmode |
2389 ui, fp, backend, store, strip=strip, prefix=prefix, eolmode=eolmode |
2456 |
2455 |
2457 |
2456 |
2458 def changedfiles(ui, repo, patchpath, strip=1, prefix=b''): |
2457 def changedfiles(ui, repo, patchpath, strip=1, prefix=b''): |
2459 backend = fsbackend(ui, repo.root) |
2458 backend = fsbackend(ui, repo.root) |
2460 prefix = _canonprefix(repo, prefix) |
2459 prefix = _canonprefix(repo, prefix) |
2461 with open(patchpath, b'rb') as fp: |
2460 with open(patchpath, 'rb') as fp: |
2462 changed = set() |
2461 changed = set() |
2463 for state, values in iterhunks(fp): |
2462 for state, values in iterhunks(fp): |
2464 if state == b'file': |
2463 if state == b'file': |
2465 afile, bfile, first_hunk, gp = values |
2464 afile, bfile, first_hunk, gp = values |
2466 if gp: |
2465 if gp: |