comparison mercurial/patch.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents 75d448d56a9d
children 1aee2ab0f902
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
1054 elif r == 5: # done, skip remaining 1054 elif r == 5: # done, skip remaining
1055 ret = skipall = False 1055 ret = skipall = False
1056 elif r == 6: # all 1056 elif r == 6: # all
1057 ret = skipall = True 1057 ret = skipall = True
1058 elif r == 7: # quit 1058 elif r == 7: # quit
1059 raise util.Abort(_('user quit')) 1059 raise error.Abort(_('user quit'))
1060 return ret, skipfile, skipall, newpatches 1060 return ret, skipfile, skipall, newpatches
1061 1061
1062 seen = set() 1062 seen = set()
1063 applied = {} # 'filename' -> [] of chunks 1063 applied = {} # 'filename' -> [] of chunks
1064 skipfile, skipall = None, None 1064 skipfile, skipall = None, None
1962 # process. 1962 # process.
1963 pass 1963 pass
1964 else: 1964 else:
1965 store.setfile(path, data, mode) 1965 store.setfile(path, data, mode)
1966 else: 1966 else:
1967 raise util.Abort(_('unsupported parser state: %s') % state) 1967 raise error.Abort(_('unsupported parser state: %s') % state)
1968 1968
1969 if current_file: 1969 if current_file:
1970 rejects += current_file.close() 1970 rejects += current_file.close()
1971 1971
1972 if rejects: 1972 if rejects:
2020 if files is None: 2020 if files is None:
2021 files = set() 2021 files = set()
2022 if eolmode is None: 2022 if eolmode is None:
2023 eolmode = ui.config('patch', 'eol', 'strict') 2023 eolmode = ui.config('patch', 'eol', 'strict')
2024 if eolmode.lower() not in eolmodes: 2024 if eolmode.lower() not in eolmodes:
2025 raise util.Abort(_('unsupported line endings type: %s') % eolmode) 2025 raise error.Abort(_('unsupported line endings type: %s') % eolmode)
2026 eolmode = eolmode.lower() 2026 eolmode = eolmode.lower()
2027 2027
2028 store = filestore() 2028 store = filestore()
2029 try: 2029 try:
2030 fp = open(patchobj, 'rb') 2030 fp = open(patchobj, 'rb')
2093 '') 2093 '')
2094 changed.add(gp.path) 2094 changed.add(gp.path)
2095 if gp.op == 'RENAME': 2095 if gp.op == 'RENAME':
2096 changed.add(gp.oldpath) 2096 changed.add(gp.oldpath)
2097 elif state not in ('hunk', 'git'): 2097 elif state not in ('hunk', 'git'):
2098 raise util.Abort(_('unsupported parser state: %s') % state) 2098 raise error.Abort(_('unsupported parser state: %s') % state)
2099 return changed 2099 return changed
2100 finally: 2100 finally:
2101 fp.close() 2101 fp.close()
2102 2102
2103 class GitDiffRequired(Exception): 2103 class GitDiffRequired(Exception):