comparison mercurial/commands.py @ 2580:a20a1bb0c396

diff: add -b/-B options
author Haakon Riiser <haakon.riiser@fys.uio.no>
date Thu, 29 Jun 2006 15:16:25 +0200
parents 0875cda033fd
children dc63db82b530
comparison
equal deleted inserted replaced
2579:0875cda033fd 2580:a20a1bb0c396
403 r = [hexfunc(node) for node in [node1, node2] if node] 403 r = [hexfunc(node) for node in [node1, node2] if node]
404 404
405 diffopts = ui.diffopts() 405 diffopts = ui.diffopts()
406 showfunc = opts.get('show_function') or diffopts['showfunc'] 406 showfunc = opts.get('show_function') or diffopts['showfunc']
407 ignorews = opts.get('ignore_all_space') or diffopts['ignorews'] 407 ignorews = opts.get('ignore_all_space') or diffopts['ignorews']
408 ignorewsamount = opts.get('ignore_space_change') or \
409 diffopts['ignorewsamount']
410 ignoreblanklines = opts.get('ignore_blank_lines') or \
411 diffopts['ignoreblanklines']
408 for f in modified: 412 for f in modified:
409 to = None 413 to = None
410 if f in mmap: 414 if f in mmap:
411 to = repo.file(f).read(mmap[f]) 415 to = repo.file(f).read(mmap[f])
412 tn = read(f) 416 tn = read(f)
413 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text, 417 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
414 showfunc=showfunc, ignorews=ignorews)) 418 showfunc=showfunc, ignorews=ignorews,
419 ignorewsamount=ignorewsamount,
420 ignoreblanklines=ignoreblanklines))
415 for f in added: 421 for f in added:
416 to = None 422 to = None
417 tn = read(f) 423 tn = read(f)
418 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text, 424 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
419 showfunc=showfunc, ignorews=ignorews)) 425 showfunc=showfunc, ignorews=ignorews,
426 ignorewsamount=ignorewsamount,
427 ignoreblanklines=ignoreblanklines))
420 for f in removed: 428 for f in removed:
421 to = repo.file(f).read(mmap[f]) 429 to = repo.file(f).read(mmap[f])
422 tn = None 430 tn = None
423 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text, 431 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
424 showfunc=showfunc, ignorews=ignorews)) 432 showfunc=showfunc, ignorews=ignorews,
433 ignorewsamount=ignorewsamount,
434 ignoreblanklines=ignoreblanklines))
425 435
426 def trimuser(ui, name, rev, revcache): 436 def trimuser(ui, name, rev, revcache):
427 """trim the name of the user who committed a change""" 437 """trim the name of the user who committed a change"""
428 user = revcache.get(rev) 438 user = revcache.get(rev)
429 if user is None: 439 if user is None:
3016 ('a', 'text', None, _('treat all files as text')), 3026 ('a', 'text', None, _('treat all files as text')),
3017 ('p', 'show-function', None, 3027 ('p', 'show-function', None,
3018 _('show which function each change is in')), 3028 _('show which function each change is in')),
3019 ('w', 'ignore-all-space', None, 3029 ('w', 'ignore-all-space', None,
3020 _('ignore white space when comparing lines')), 3030 _('ignore white space when comparing lines')),
3031 ('b', 'ignore-space-change', None,
3032 _('ignore changes in the amount of white space')),
3033 ('B', 'ignore-blank-lines', None,
3034 _('ignore changes whose lines are all blank')),
3021 ('I', 'include', [], _('include names matching the given patterns')), 3035 ('I', 'include', [], _('include names matching the given patterns')),
3022 ('X', 'exclude', [], _('exclude names matching the given patterns'))], 3036 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
3023 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), 3037 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
3024 "^export": 3038 "^export":
3025 (export, 3039 (export,