##// END OF EJS Templates
record: add white space diff options
Ingo Proetel -
r14597:3f1dccea default
parent child Browse files
Show More
@@ -17,6 +17,15 b' command = cmdutil.command(cmdtable)'
17
17
18 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
18 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
19
19
20 diffopts = [
21 ('w', 'ignore-all-space', False,
22 _('ignore white space when comparing lines')),
23 ('b', 'ignore-space-change', None,
24 _('ignore changes in the amount of white space')),
25 ('B', 'ignore-blank-lines', None,
26 _('ignore changes whose lines are all blank')),
27 ]
28
20 def scanpatch(fp):
29 def scanpatch(fp):
21 """like patch.iterhunks, but yield different events
30 """like patch.iterhunks, but yield different events
22
31
@@ -345,7 +354,8 b' def filterpatch(ui, headers):'
345 if h[0].special() or len(h) > 1], [])
354 if h[0].special() or len(h) > 1], [])
346
355
347 @command("record",
356 @command("record",
348 commands.table['^commit|ci'][1], # same options as commit
357 # same options as commit + white space diff options
358 commands.table['^commit|ci'][1][:] + diffopts,
349 _('hg record [OPTION]... [FILE]...'))
359 _('hg record [OPTION]... [FILE]...'))
350 def record(ui, repo, *pats, **opts):
360 def record(ui, repo, *pats, **opts):
351 '''interactively select changes to commit
361 '''interactively select changes to commit
@@ -435,7 +445,10 b' def dorecord(ui, repo, commitfunc, cmdsu'
435 '(use "hg commit" instead)'))
445 '(use "hg commit" instead)'))
436
446
437 changes = repo.status(match=match)[:3]
447 changes = repo.status(match=match)[:3]
438 diffopts = mdiff.diffopts(git=True, nodates=True)
448 diffopts = mdiff.diffopts(git=True, nodates=True,
449 ignorews=opts.get('ignore_all_space'),
450 ignorewsamount=opts.get('ignore_space_change'),
451 ignoreblanklines=opts.get('ignore_blank_lines'))
439 chunks = patch.diff(repo, changes=changes, opts=diffopts)
452 chunks = patch.diff(repo, changes=changes, opts=diffopts)
440 fp = cStringIO.StringIO()
453 fp = cStringIO.StringIO()
441 fp.write(''.join(chunks))
454 fp.write(''.join(chunks))
@@ -567,8 +580,8 b' def uisetup(ui):'
567 cmdtable["qrecord"] = \
580 cmdtable["qrecord"] = \
568 (qrecord,
581 (qrecord,
569 # same options as qnew, but copy them so we don't get
582 # same options as qnew, but copy them so we don't get
570 # -i/--interactive for qrecord
583 # -i/--interactive for qrecord and add white space diff options
571 mq.cmdtable['^qnew'][1][:],
584 mq.cmdtable['^qnew'][1][:] + diffopts,
572 _('hg qrecord [OPTION]... PATCH [FILE]...'))
585 _('hg qrecord [OPTION]... PATCH [FILE]...'))
573
586
574 _wrapcmd('qnew', mq.cmdtable, qrecord, _("interactively record a new patch"))
587 _wrapcmd('qnew', mq.cmdtable, qrecord, _("interactively record a new patch"))
@@ -64,6 +64,9 b' help record (record)'
64 -l --logfile FILE read commit message from file
64 -l --logfile FILE read commit message from file
65 -d --date DATE record the specified date as commit date
65 -d --date DATE record the specified date as commit date
66 -u --user USER record the specified user as committer
66 -u --user USER record the specified user as committer
67 -w --ignore-all-space ignore white space when comparing lines
68 -b --ignore-space-change ignore changes in the amount of white space
69 -B --ignore-blank-lines ignore changes whose lines are all blank
67
70
68 [+] marked option can be specified multiple times
71 [+] marked option can be specified multiple times
69
72
@@ -136,6 +139,9 b' help (mq present)'
136 -X --exclude PATTERN [+] exclude names matching the given patterns
139 -X --exclude PATTERN [+] exclude names matching the given patterns
137 -m --message TEXT use text as commit message
140 -m --message TEXT use text as commit message
138 -l --logfile FILE read commit message from file
141 -l --logfile FILE read commit message from file
142 -w --ignore-all-space ignore white space when comparing lines
143 -b --ignore-space-change ignore changes in the amount of white space
144 -B --ignore-blank-lines ignore changes whose lines are all blank
139 --mq operate on patch repository
145 --mq operate on patch repository
140
146
141 [+] marked option can be specified multiple times
147 [+] marked option can be specified multiple times
General Comments 0
You need to be logged in to leave comments. Login now