Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 10615:3bb438ce4458
patch/diff: move diff related code next to each other
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 09 Mar 2010 19:04:18 +0100 |
parents | e764f24a45ee |
children | 71cf11f03b3d |
comparison
equal
deleted
inserted
replaced
10614:d0050f36e688 | 10615:3bb438ce4458 |
---|---|
1173 | 1173 |
1174 if rejects: | 1174 if rejects: |
1175 return -1 | 1175 return -1 |
1176 return err | 1176 return err |
1177 | 1177 |
1178 def diffopts(ui, opts=None, untrusted=False): | |
1179 def get(key, name=None, getter=ui.configbool): | |
1180 return ((opts and opts.get(key)) or | |
1181 getter('diff', name or key, None, untrusted=untrusted)) | |
1182 return mdiff.diffopts( | |
1183 text=opts and opts.get('text'), | |
1184 git=get('git'), | |
1185 nodates=get('nodates'), | |
1186 showfunc=get('show_function', 'showfunc'), | |
1187 ignorews=get('ignore_all_space', 'ignorews'), | |
1188 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), | |
1189 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), | |
1190 context=get('unified', getter=ui.config)) | |
1191 | |
1192 def updatedir(ui, repo, patches, similarity=0): | 1178 def updatedir(ui, repo, patches, similarity=0): |
1193 '''Update dirstate after patch application according to metadata''' | 1179 '''Update dirstate after patch application according to metadata''' |
1194 if not patches: | 1180 if not patches: |
1195 return | 1181 return |
1196 copies = [] | 1182 copies = [] |
1373 ret.append('\n') | 1359 ret.append('\n') |
1374 return ''.join(ret) | 1360 return ''.join(ret) |
1375 | 1361 |
1376 class GitDiffRequired(Exception): | 1362 class GitDiffRequired(Exception): |
1377 pass | 1363 pass |
1364 | |
1365 def diffopts(ui, opts=None, untrusted=False): | |
1366 def get(key, name=None, getter=ui.configbool): | |
1367 return ((opts and opts.get(key)) or | |
1368 getter('diff', name or key, None, untrusted=untrusted)) | |
1369 return mdiff.diffopts( | |
1370 text=opts and opts.get('text'), | |
1371 git=get('git'), | |
1372 nodates=get('nodates'), | |
1373 showfunc=get('show_function', 'showfunc'), | |
1374 ignorews=get('ignore_all_space', 'ignorews'), | |
1375 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), | |
1376 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), | |
1377 context=get('unified', getter=ui.config)) | |
1378 | 1378 |
1379 def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None, | 1379 def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None, |
1380 losedatafn=None): | 1380 losedatafn=None): |
1381 '''yields diff of changes to files between two nodes, or node and | 1381 '''yields diff of changes to files between two nodes, or node and |
1382 working directory. | 1382 working directory. |