##// END OF EJS Templates
color: add support for terminfo-based attributes and color...
Danek Duvall -
r13987:e0f07847 default
parent child Browse files
Show More
@@ -1,363 +1,480 b''
1 # color.py color output for the status and qseries commands
1 # color.py color output for the status and qseries commands
2 #
2 #
3 # Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com>
3 # Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com>
4 #
4 #
5 # This program is free software; you can redistribute it and/or modify it
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2 of the License, or (at your
7 # Free Software Foundation; either version 2 of the License, or (at your
8 # option) any later version.
8 # option) any later version.
9 #
9 #
10 # This program is distributed in the hope that it will be useful, but
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 # Public License for more details.
13 # Public License for more details.
14 #
14 #
15 # You should have received a copy of the GNU General Public License along
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
18
19 '''colorize output from some commands
19 '''colorize output from some commands
20
20
21 This extension modifies the status and resolve commands to add color
21 This extension modifies the status and resolve commands to add color
22 to their output to reflect file status, the qseries command to add
22 to their output to reflect file status, the qseries command to add
23 color to reflect patch status (applied, unapplied, missing), and to
23 color to reflect patch status (applied, unapplied, missing), and to
24 diff-related commands to highlight additions, removals, diff headers,
24 diff-related commands to highlight additions, removals, diff headers,
25 and trailing whitespace.
25 and trailing whitespace.
26
26
27 Other effects in addition to color, like bold and underlined text, are
27 Other effects in addition to color, like bold and underlined text, are
28 also available. Effects are rendered with the ECMA-48 SGR control
28 also available. By default, the terminfo database is used to find the
29 terminal codes used to change color and effect. If terminfo is not
30 available, then effects are rendered with the ECMA-48 SGR control
29 function (aka ANSI escape codes).
31 function (aka ANSI escape codes).
30
32
31 Default effects may be overridden from your configuration file::
33 Default effects may be overridden from your configuration file::
32
34
33 [color]
35 [color]
34 status.modified = blue bold underline red_background
36 status.modified = blue bold underline red_background
35 status.added = green bold
37 status.added = green bold
36 status.removed = red bold blue_background
38 status.removed = red bold blue_background
37 status.deleted = cyan bold underline
39 status.deleted = cyan bold underline
38 status.unknown = magenta bold underline
40 status.unknown = magenta bold underline
39 status.ignored = black bold
41 status.ignored = black bold
40
42
41 # 'none' turns off all effects
43 # 'none' turns off all effects
42 status.clean = none
44 status.clean = none
43 status.copied = none
45 status.copied = none
44
46
45 qseries.applied = blue bold underline
47 qseries.applied = blue bold underline
46 qseries.unapplied = black bold
48 qseries.unapplied = black bold
47 qseries.missing = red bold
49 qseries.missing = red bold
48
50
49 diff.diffline = bold
51 diff.diffline = bold
50 diff.extended = cyan bold
52 diff.extended = cyan bold
51 diff.file_a = red bold
53 diff.file_a = red bold
52 diff.file_b = green bold
54 diff.file_b = green bold
53 diff.hunk = magenta
55 diff.hunk = magenta
54 diff.deleted = red
56 diff.deleted = red
55 diff.inserted = green
57 diff.inserted = green
56 diff.changed = white
58 diff.changed = white
57 diff.trailingwhitespace = bold red_background
59 diff.trailingwhitespace = bold red_background
58
60
59 resolve.unresolved = red bold
61 resolve.unresolved = red bold
60 resolve.resolved = green bold
62 resolve.resolved = green bold
61
63
62 bookmarks.current = green
64 bookmarks.current = green
63
65
64 branches.active = none
66 branches.active = none
65 branches.closed = black bold
67 branches.closed = black bold
66 branches.current = green
68 branches.current = green
67 branches.inactive = none
69 branches.inactive = none
68
70
69 The color extension will try to detect whether to use ANSI codes or
71 The available effects in terminfo mode are 'blink', 'bold', 'dim',
70 Win32 console APIs, unless it is made explicit::
72 'inverse', 'invisible', 'italic', 'standout', and 'underline'; in
73 ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and
74 'underline'. How each is rendered depends on the terminal emulator.
75 Some may not be available for a given terminal type, and will be
76 silently ignored.
77
78 Because there are only eight standard colors, this module allows you
79 to define color names for other color slots which might be available
80 for your terminal type, assuming terminfo mode. For instance::
81
82 color.brightblue = 12
83 color.pink = 207
84 color.orange = 202
85
86 to set 'brightblue' to color slot 12 (useful for 16 color terminals
87 that have brighter colors defined in the upper eight) and, 'pink' and
88 'orange' to colors in 256-color xterm's default color cube. These
89 defined colors may then be used as any of the pre-defined eight,
90 including appending '_background' to set the background to that color.
91
92 The color extension will try to detect whether to use terminfo, ANSI
93 codes or Win32 console APIs, unless it is made explicit; e.g.::
71
94
72 [color]
95 [color]
73 mode = ansi
96 mode = ansi
74
97
75 Any value other than 'ansi', 'win32', or 'auto' will disable color.
98 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will
99 disable color.
76
100
77 '''
101 '''
78
102
79 import os
103 import os
80
104
81 from mercurial import commands, dispatch, extensions, ui as uimod, util
105 from mercurial import commands, dispatch, extensions, ui as uimod, util
82 from mercurial.i18n import _
106 from mercurial.i18n import _
83
107
84 # start and stop parameters for effects
108 # start and stop parameters for effects
85 _effects = {'none': 0, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33,
109 _effects = {'none': 0, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33,
86 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37, 'bold': 1,
110 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37, 'bold': 1,
87 'italic': 3, 'underline': 4, 'inverse': 7,
111 'italic': 3, 'underline': 4, 'inverse': 7,
88 'black_background': 40, 'red_background': 41,
112 'black_background': 40, 'red_background': 41,
89 'green_background': 42, 'yellow_background': 43,
113 'green_background': 42, 'yellow_background': 43,
90 'blue_background': 44, 'purple_background': 45,
114 'blue_background': 44, 'purple_background': 45,
91 'cyan_background': 46, 'white_background': 47}
115 'cyan_background': 46, 'white_background': 47}
92
116
117 def _terminfosetup(ui):
118 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
119
120 global _terminfo_params
121 # If we failed to load curses, we go ahead and return.
122 if not _terminfo_params:
123 return
124 # Otherwise, see what the config file says.
125 mode = ui.config('color', 'mode', 'auto')
126 if mode not in ('auto', 'terminfo'):
127 return
128
129 _terminfo_params.update(dict((
130 (key[6:], (False, int(val)))
131 for key, val in ui.configitems('color')
132 if key.startswith('color.')
133 )))
134
135 try:
136 curses.setupterm()
137 except curses.error, e:
138 _terminfo_params = {}
139 return
140
141 for key, (b, e) in _terminfo_params.items():
142 if not b:
143 continue
144 if not curses.tigetstr(e):
145 # Most terminals don't support dim, invis, etc, so don't be
146 # noisy and use ui.debug().
147 ui.debug("no terminfo entry for %s\n" % e)
148 del _terminfo_params[key]
149 if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
150 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
151 "ECMA-48 color\n"))
152 _terminfo_params = {}
153
154 try:
155 import curses
156 # Mapping from effect name to terminfo attribute name or color number.
157 # This will also force-load the curses module.
158 _terminfo_params = {'none': (True, 'sgr0'),
159 'standout': (True, 'smso'),
160 'underline': (True, 'smul'),
161 'reverse': (True, 'rev'),
162 'inverse': (True, 'rev'),
163 'blink': (True, 'blink'),
164 'dim': (True, 'dim'),
165 'bold': (True, 'bold'),
166 'invisible': (True, 'invis'),
167 'italic': (True, 'sitm'),
168 'black': (False, curses.COLOR_BLACK),
169 'red': (False, curses.COLOR_RED),
170 'green': (False, curses.COLOR_GREEN),
171 'yellow': (False, curses.COLOR_YELLOW),
172 'blue': (False, curses.COLOR_BLUE),
173 'magenta': (False, curses.COLOR_MAGENTA),
174 'cyan': (False, curses.COLOR_CYAN),
175 'white': (False, curses.COLOR_WHITE)}
176 except ImportError:
177 _terminfo_params = False
178
93 _styles = {'grep.match': 'red bold',
179 _styles = {'grep.match': 'red bold',
94 'bookmarks.current': 'green',
180 'bookmarks.current': 'green',
95 'branches.active': 'none',
181 'branches.active': 'none',
96 'branches.closed': 'black bold',
182 'branches.closed': 'black bold',
97 'branches.current': 'green',
183 'branches.current': 'green',
98 'branches.inactive': 'none',
184 'branches.inactive': 'none',
99 'diff.changed': 'white',
185 'diff.changed': 'white',
100 'diff.deleted': 'red',
186 'diff.deleted': 'red',
101 'diff.diffline': 'bold',
187 'diff.diffline': 'bold',
102 'diff.extended': 'cyan bold',
188 'diff.extended': 'cyan bold',
103 'diff.file_a': 'red bold',
189 'diff.file_a': 'red bold',
104 'diff.file_b': 'green bold',
190 'diff.file_b': 'green bold',
105 'diff.hunk': 'magenta',
191 'diff.hunk': 'magenta',
106 'diff.inserted': 'green',
192 'diff.inserted': 'green',
107 'diff.trailingwhitespace': 'bold red_background',
193 'diff.trailingwhitespace': 'bold red_background',
108 'diffstat.deleted': 'red',
194 'diffstat.deleted': 'red',
109 'diffstat.inserted': 'green',
195 'diffstat.inserted': 'green',
110 'ui.prompt': 'yellow',
196 'ui.prompt': 'yellow',
111 'log.changeset': 'yellow',
197 'log.changeset': 'yellow',
112 'resolve.resolved': 'green bold',
198 'resolve.resolved': 'green bold',
113 'resolve.unresolved': 'red bold',
199 'resolve.unresolved': 'red bold',
114 'status.added': 'green bold',
200 'status.added': 'green bold',
115 'status.clean': 'none',
201 'status.clean': 'none',
116 'status.copied': 'none',
202 'status.copied': 'none',
117 'status.deleted': 'cyan bold underline',
203 'status.deleted': 'cyan bold underline',
118 'status.ignored': 'black bold',
204 'status.ignored': 'black bold',
119 'status.modified': 'blue bold',
205 'status.modified': 'blue bold',
120 'status.removed': 'red bold',
206 'status.removed': 'red bold',
121 'status.unknown': 'magenta bold underline'}
207 'status.unknown': 'magenta bold underline'}
122
208
123
209
210 def _effect_str(effect):
211 '''Helper function for render_effects().'''
212
213 bg = False
214 if effect.endswith('_background'):
215 bg = True
216 effect = effect[:-11]
217 attr, val = _terminfo_params[effect]
218 if attr:
219 return curses.tigetstr(val)
220 elif bg:
221 return curses.tparm(curses.tigetstr('setab'), val)
222 else:
223 return curses.tparm(curses.tigetstr('setaf'), val)
224
124 def render_effects(text, effects):
225 def render_effects(text, effects):
125 'Wrap text in commands to turn on each effect.'
226 'Wrap text in commands to turn on each effect.'
126 if not text:
227 if not text:
127 return text
228 return text
229 if not _terminfo_params:
128 start = [str(_effects[e]) for e in ['none'] + effects.split()]
230 start = [str(_effects[e]) for e in ['none'] + effects.split()]
129 start = '\033[' + ';'.join(start) + 'm'
231 start = '\033[' + ';'.join(start) + 'm'
130 stop = '\033[' + str(_effects['none']) + 'm'
232 stop = '\033[' + str(_effects['none']) + 'm'
233 else:
234 start = ''.join(_effect_str(effect)
235 for effect in ['none'] + effects.split())
236 stop = _effect_str('none')
131 return ''.join([start, text, stop])
237 return ''.join([start, text, stop])
132
238
133 def extstyles():
239 def extstyles():
134 for name, ext in extensions.extensions():
240 for name, ext in extensions.extensions():
135 _styles.update(getattr(ext, 'colortable', {}))
241 _styles.update(getattr(ext, 'colortable', {}))
136
242
137 def configstyles(ui):
243 def configstyles(ui):
138 for status, cfgeffects in ui.configitems('color'):
244 for status, cfgeffects in ui.configitems('color'):
139 if '.' not in status:
245 if '.' not in status or status.startswith('color.'):
140 continue
246 continue
141 cfgeffects = ui.configlist('color', status)
247 cfgeffects = ui.configlist('color', status)
142 if cfgeffects:
248 if cfgeffects:
143 good = []
249 good = []
144 for e in cfgeffects:
250 for e in cfgeffects:
145 if e in _effects:
251 if not _terminfo_params and e in _effects:
252 good.append(e)
253 elif e in _terminfo_params or e[:-11] in _terminfo_params:
146 good.append(e)
254 good.append(e)
147 else:
255 else:
148 ui.warn(_("ignoring unknown color/effect %r "
256 ui.warn(_("ignoring unknown color/effect %r "
149 "(configured in color.%s)\n")
257 "(configured in color.%s)\n")
150 % (e, status))
258 % (e, status))
151 _styles[status] = ' '.join(good)
259 _styles[status] = ' '.join(good)
152
260
153 class colorui(uimod.ui):
261 class colorui(uimod.ui):
154 def popbuffer(self, labeled=False):
262 def popbuffer(self, labeled=False):
155 if labeled:
263 if labeled:
156 return ''.join(self.label(a, label) for a, label
264 return ''.join(self.label(a, label) for a, label
157 in self._buffers.pop())
265 in self._buffers.pop())
158 return ''.join(a for a, label in self._buffers.pop())
266 return ''.join(a for a, label in self._buffers.pop())
159
267
160 _colormode = 'ansi'
268 _colormode = 'ansi'
161 def write(self, *args, **opts):
269 def write(self, *args, **opts):
162 label = opts.get('label', '')
270 label = opts.get('label', '')
163 if self._buffers:
271 if self._buffers:
164 self._buffers[-1].extend([(str(a), label) for a in args])
272 self._buffers[-1].extend([(str(a), label) for a in args])
165 elif self._colormode == 'win32':
273 elif self._colormode == 'win32':
166 for a in args:
274 for a in args:
167 win32print(a, super(colorui, self).write, **opts)
275 win32print(a, super(colorui, self).write, **opts)
168 else:
276 else:
169 return super(colorui, self).write(
277 return super(colorui, self).write(
170 *[self.label(str(a), label) for a in args], **opts)
278 *[self.label(str(a), label) for a in args], **opts)
171
279
172 def write_err(self, *args, **opts):
280 def write_err(self, *args, **opts):
173 label = opts.get('label', '')
281 label = opts.get('label', '')
174 if self._colormode == 'win32':
282 if self._colormode == 'win32':
175 for a in args:
283 for a in args:
176 win32print(a, super(colorui, self).write_err, **opts)
284 win32print(a, super(colorui, self).write_err, **opts)
177 else:
285 else:
178 return super(colorui, self).write_err(
286 return super(colorui, self).write_err(
179 *[self.label(str(a), label) for a in args], **opts)
287 *[self.label(str(a), label) for a in args], **opts)
180
288
181 def label(self, msg, label):
289 def label(self, msg, label):
182 effects = []
290 effects = []
183 for l in label.split():
291 for l in label.split():
184 s = _styles.get(l, '')
292 s = _styles.get(l, '')
185 if s:
293 if s:
186 effects.append(s)
294 effects.append(s)
187 effects = ''.join(effects)
295 effects = ''.join(effects)
188 if effects:
296 if effects:
189 return '\n'.join([render_effects(s, effects)
297 return '\n'.join([render_effects(s, effects)
190 for s in msg.split('\n')])
298 for s in msg.split('\n')])
191 return msg
299 return msg
192
300
193
301
194 def uisetup(ui):
302 def uisetup(ui):
303 global _terminfo_params
195 if ui.plain():
304 if ui.plain():
196 return
305 return
197 mode = ui.config('color', 'mode', 'auto')
306 mode = ui.config('color', 'mode', 'auto')
198 if mode == 'auto':
307 if mode == 'auto':
199 if os.name == 'nt' and 'TERM' not in os.environ:
308 if os.name == 'nt' and 'TERM' not in os.environ:
200 # looks line a cmd.exe console, use win32 API or nothing
309 # looks line a cmd.exe console, use win32 API or nothing
201 mode = w32effects and 'win32' or 'none'
310 mode = w32effects and 'win32' or 'none'
202 else:
311 else:
312 _terminfosetup(ui)
313 if not _terminfo_params:
203 mode = 'ansi'
314 mode = 'ansi'
315 else:
316 mode = 'terminfo'
204 if mode == 'win32':
317 if mode == 'win32':
205 if w32effects is None:
318 if w32effects is None:
206 # only warn if color.mode is explicitly set to win32
319 # only warn if color.mode is explicitly set to win32
207 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
320 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
208 return
321 return
209 _effects.update(w32effects)
322 _effects.update(w32effects)
210 elif mode != 'ansi':
323 elif mode == 'ansi':
324 _terminfo_params = {}
325 elif mode == 'terminfo':
326 _terminfosetup(ui)
327 elif mode not in ('ansi', 'terminfo'):
211 return
328 return
212 def colorcmd(orig, ui_, opts, cmd, cmdfunc):
329 def colorcmd(orig, ui_, opts, cmd, cmdfunc):
213 coloropt = opts['color']
330 coloropt = opts['color']
214 auto = coloropt == 'auto'
331 auto = coloropt == 'auto'
215 always = util.parsebool(coloropt)
332 always = util.parsebool(coloropt)
216 if (always or
333 if (always or
217 (always is None and
334 (always is None and
218 (auto and (os.environ.get('TERM') != 'dumb' and ui_.formatted())))):
335 (auto and (os.environ.get('TERM') != 'dumb' and ui_.formatted())))):
219 colorui._colormode = mode
336 colorui._colormode = mode
220 colorui.__bases__ = (ui_.__class__,)
337 colorui.__bases__ = (ui_.__class__,)
221 ui_.__class__ = colorui
338 ui_.__class__ = colorui
222 extstyles()
339 extstyles()
223 configstyles(ui_)
340 configstyles(ui_)
224 return orig(ui_, opts, cmd, cmdfunc)
341 return orig(ui_, opts, cmd, cmdfunc)
225 extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
342 extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
226
343
227 def extsetup(ui):
344 def extsetup(ui):
228 commands.globalopts.append(
345 commands.globalopts.append(
229 ('', 'color', 'auto',
346 ('', 'color', 'auto',
230 # i18n: 'always', 'auto', and 'never' are keywords and should
347 # i18n: 'always', 'auto', and 'never' are keywords and should
231 # not be translated
348 # not be translated
232 _("when to colorize (boolean, always, auto, or never)"),
349 _("when to colorize (boolean, always, auto, or never)"),
233 _('TYPE')))
350 _('TYPE')))
234
351
235 if os.name != 'nt':
352 if os.name != 'nt':
236 w32effects = None
353 w32effects = None
237 else:
354 else:
238 import re, ctypes
355 import re, ctypes
239
356
240 _kernel32 = ctypes.windll.kernel32
357 _kernel32 = ctypes.windll.kernel32
241
358
242 _WORD = ctypes.c_ushort
359 _WORD = ctypes.c_ushort
243
360
244 _INVALID_HANDLE_VALUE = -1
361 _INVALID_HANDLE_VALUE = -1
245
362
246 class _COORD(ctypes.Structure):
363 class _COORD(ctypes.Structure):
247 _fields_ = [('X', ctypes.c_short),
364 _fields_ = [('X', ctypes.c_short),
248 ('Y', ctypes.c_short)]
365 ('Y', ctypes.c_short)]
249
366
250 class _SMALL_RECT(ctypes.Structure):
367 class _SMALL_RECT(ctypes.Structure):
251 _fields_ = [('Left', ctypes.c_short),
368 _fields_ = [('Left', ctypes.c_short),
252 ('Top', ctypes.c_short),
369 ('Top', ctypes.c_short),
253 ('Right', ctypes.c_short),
370 ('Right', ctypes.c_short),
254 ('Bottom', ctypes.c_short)]
371 ('Bottom', ctypes.c_short)]
255
372
256 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
373 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
257 _fields_ = [('dwSize', _COORD),
374 _fields_ = [('dwSize', _COORD),
258 ('dwCursorPosition', _COORD),
375 ('dwCursorPosition', _COORD),
259 ('wAttributes', _WORD),
376 ('wAttributes', _WORD),
260 ('srWindow', _SMALL_RECT),
377 ('srWindow', _SMALL_RECT),
261 ('dwMaximumWindowSize', _COORD)]
378 ('dwMaximumWindowSize', _COORD)]
262
379
263 _STD_OUTPUT_HANDLE = 0xfffffff5L # (DWORD)-11
380 _STD_OUTPUT_HANDLE = 0xfffffff5L # (DWORD)-11
264 _STD_ERROR_HANDLE = 0xfffffff4L # (DWORD)-12
381 _STD_ERROR_HANDLE = 0xfffffff4L # (DWORD)-12
265
382
266 _FOREGROUND_BLUE = 0x0001
383 _FOREGROUND_BLUE = 0x0001
267 _FOREGROUND_GREEN = 0x0002
384 _FOREGROUND_GREEN = 0x0002
268 _FOREGROUND_RED = 0x0004
385 _FOREGROUND_RED = 0x0004
269 _FOREGROUND_INTENSITY = 0x0008
386 _FOREGROUND_INTENSITY = 0x0008
270
387
271 _BACKGROUND_BLUE = 0x0010
388 _BACKGROUND_BLUE = 0x0010
272 _BACKGROUND_GREEN = 0x0020
389 _BACKGROUND_GREEN = 0x0020
273 _BACKGROUND_RED = 0x0040
390 _BACKGROUND_RED = 0x0040
274 _BACKGROUND_INTENSITY = 0x0080
391 _BACKGROUND_INTENSITY = 0x0080
275
392
276 _COMMON_LVB_REVERSE_VIDEO = 0x4000
393 _COMMON_LVB_REVERSE_VIDEO = 0x4000
277 _COMMON_LVB_UNDERSCORE = 0x8000
394 _COMMON_LVB_UNDERSCORE = 0x8000
278
395
279 # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx
396 # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx
280 w32effects = {
397 w32effects = {
281 'none': -1,
398 'none': -1,
282 'black': 0,
399 'black': 0,
283 'red': _FOREGROUND_RED,
400 'red': _FOREGROUND_RED,
284 'green': _FOREGROUND_GREEN,
401 'green': _FOREGROUND_GREEN,
285 'yellow': _FOREGROUND_RED | _FOREGROUND_GREEN,
402 'yellow': _FOREGROUND_RED | _FOREGROUND_GREEN,
286 'blue': _FOREGROUND_BLUE,
403 'blue': _FOREGROUND_BLUE,
287 'magenta': _FOREGROUND_BLUE | _FOREGROUND_RED,
404 'magenta': _FOREGROUND_BLUE | _FOREGROUND_RED,
288 'cyan': _FOREGROUND_BLUE | _FOREGROUND_GREEN,
405 'cyan': _FOREGROUND_BLUE | _FOREGROUND_GREEN,
289 'white': _FOREGROUND_RED | _FOREGROUND_GREEN | _FOREGROUND_BLUE,
406 'white': _FOREGROUND_RED | _FOREGROUND_GREEN | _FOREGROUND_BLUE,
290 'bold': _FOREGROUND_INTENSITY,
407 'bold': _FOREGROUND_INTENSITY,
291 'black_background': 0x100, # unused value > 0x0f
408 'black_background': 0x100, # unused value > 0x0f
292 'red_background': _BACKGROUND_RED,
409 'red_background': _BACKGROUND_RED,
293 'green_background': _BACKGROUND_GREEN,
410 'green_background': _BACKGROUND_GREEN,
294 'yellow_background': _BACKGROUND_RED | _BACKGROUND_GREEN,
411 'yellow_background': _BACKGROUND_RED | _BACKGROUND_GREEN,
295 'blue_background': _BACKGROUND_BLUE,
412 'blue_background': _BACKGROUND_BLUE,
296 'purple_background': _BACKGROUND_BLUE | _BACKGROUND_RED,
413 'purple_background': _BACKGROUND_BLUE | _BACKGROUND_RED,
297 'cyan_background': _BACKGROUND_BLUE | _BACKGROUND_GREEN,
414 'cyan_background': _BACKGROUND_BLUE | _BACKGROUND_GREEN,
298 'white_background': (_BACKGROUND_RED | _BACKGROUND_GREEN |
415 'white_background': (_BACKGROUND_RED | _BACKGROUND_GREEN |
299 _BACKGROUND_BLUE),
416 _BACKGROUND_BLUE),
300 'bold_background': _BACKGROUND_INTENSITY,
417 'bold_background': _BACKGROUND_INTENSITY,
301 'underline': _COMMON_LVB_UNDERSCORE, # double-byte charsets only
418 'underline': _COMMON_LVB_UNDERSCORE, # double-byte charsets only
302 'inverse': _COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
419 'inverse': _COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
303 }
420 }
304
421
305 passthrough = set([_FOREGROUND_INTENSITY,
422 passthrough = set([_FOREGROUND_INTENSITY,
306 _BACKGROUND_INTENSITY,
423 _BACKGROUND_INTENSITY,
307 _COMMON_LVB_UNDERSCORE,
424 _COMMON_LVB_UNDERSCORE,
308 _COMMON_LVB_REVERSE_VIDEO])
425 _COMMON_LVB_REVERSE_VIDEO])
309
426
310 stdout = _kernel32.GetStdHandle(
427 stdout = _kernel32.GetStdHandle(
311 _STD_OUTPUT_HANDLE) # don't close the handle returned
428 _STD_OUTPUT_HANDLE) # don't close the handle returned
312 if stdout is None or stdout == _INVALID_HANDLE_VALUE:
429 if stdout is None or stdout == _INVALID_HANDLE_VALUE:
313 w32effects = None
430 w32effects = None
314 else:
431 else:
315 csbi = _CONSOLE_SCREEN_BUFFER_INFO()
432 csbi = _CONSOLE_SCREEN_BUFFER_INFO()
316 if not _kernel32.GetConsoleScreenBufferInfo(
433 if not _kernel32.GetConsoleScreenBufferInfo(
317 stdout, ctypes.byref(csbi)):
434 stdout, ctypes.byref(csbi)):
318 # stdout may not support GetConsoleScreenBufferInfo()
435 # stdout may not support GetConsoleScreenBufferInfo()
319 # when called from subprocess or redirected
436 # when called from subprocess or redirected
320 w32effects = None
437 w32effects = None
321 else:
438 else:
322 origattr = csbi.wAttributes
439 origattr = csbi.wAttributes
323 ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
440 ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
324 re.MULTILINE | re.DOTALL)
441 re.MULTILINE | re.DOTALL)
325
442
326 def win32print(text, orig, **opts):
443 def win32print(text, orig, **opts):
327 label = opts.get('label', '')
444 label = opts.get('label', '')
328 attr = origattr
445 attr = origattr
329
446
330 def mapcolor(val, attr):
447 def mapcolor(val, attr):
331 if val == -1:
448 if val == -1:
332 return origattr
449 return origattr
333 elif val in passthrough:
450 elif val in passthrough:
334 return attr | val
451 return attr | val
335 elif val > 0x0f:
452 elif val > 0x0f:
336 return (val & 0x70) | (attr & 0x8f)
453 return (val & 0x70) | (attr & 0x8f)
337 else:
454 else:
338 return (val & 0x07) | (attr & 0xf8)
455 return (val & 0x07) | (attr & 0xf8)
339
456
340 # determine console attributes based on labels
457 # determine console attributes based on labels
341 for l in label.split():
458 for l in label.split():
342 style = _styles.get(l, '')
459 style = _styles.get(l, '')
343 for effect in style.split():
460 for effect in style.split():
344 attr = mapcolor(w32effects[effect], attr)
461 attr = mapcolor(w32effects[effect], attr)
345
462
346 # hack to ensure regexp finds data
463 # hack to ensure regexp finds data
347 if not text.startswith('\033['):
464 if not text.startswith('\033['):
348 text = '\033[m' + text
465 text = '\033[m' + text
349
466
350 # Look for ANSI-like codes embedded in text
467 # Look for ANSI-like codes embedded in text
351 m = re.match(ansire, text)
468 m = re.match(ansire, text)
352
469
353 try:
470 try:
354 while m:
471 while m:
355 for sattr in m.group(1).split(';'):
472 for sattr in m.group(1).split(';'):
356 if sattr:
473 if sattr:
357 attr = mapcolor(int(sattr), attr)
474 attr = mapcolor(int(sattr), attr)
358 _kernel32.SetConsoleTextAttribute(stdout, attr)
475 _kernel32.SetConsoleTextAttribute(stdout, attr)
359 orig(m.group(2), **opts)
476 orig(m.group(2), **opts)
360 m = re.match(ansire, m.group(3))
477 m = re.match(ansire, m.group(3))
361 finally:
478 finally:
362 # Explicity reset original attributes
479 # Explicity reset original attributes
363 _kernel32.SetConsoleTextAttribute(stdout, origattr)
480 _kernel32.SetConsoleTextAttribute(stdout, origattr)
@@ -1,398 +1,400 b''
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3 $ echo 'root' >root
3 $ echo 'root' >root
4 $ hg add root
4 $ hg add root
5 $ hg commit -d '0 0' -m "Adding root node"
5 $ hg commit -d '0 0' -m "Adding root node"
6
6
7 $ echo 'a' >a
7 $ echo 'a' >a
8 $ hg add a
8 $ hg add a
9 $ hg branch a
9 $ hg branch a
10 marked working directory as branch a
10 marked working directory as branch a
11 $ hg commit -d '1 0' -m "Adding a branch"
11 $ hg commit -d '1 0' -m "Adding a branch"
12
12
13 $ hg branch q
13 $ hg branch q
14 marked working directory as branch q
14 marked working directory as branch q
15 $ echo 'aa' >a
15 $ echo 'aa' >a
16 $ hg branch -C
16 $ hg branch -C
17 reset working directory to branch a
17 reset working directory to branch a
18 $ hg commit -d '2 0' -m "Adding to a branch"
18 $ hg commit -d '2 0' -m "Adding to a branch"
19
19
20 $ hg update -C 0
20 $ hg update -C 0
21 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 $ echo 'b' >b
22 $ echo 'b' >b
23 $ hg add b
23 $ hg add b
24 $ hg branch b
24 $ hg branch b
25 marked working directory as branch b
25 marked working directory as branch b
26 $ hg commit -d '2 0' -m "Adding b branch"
26 $ hg commit -d '2 0' -m "Adding b branch"
27
27
28 $ echo 'bh1' >bh1
28 $ echo 'bh1' >bh1
29 $ hg add bh1
29 $ hg add bh1
30 $ hg commit -d '3 0' -m "Adding b branch head 1"
30 $ hg commit -d '3 0' -m "Adding b branch head 1"
31
31
32 $ hg update -C 2
32 $ hg update -C 2
33 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
34 $ echo 'bh2' >bh2
34 $ echo 'bh2' >bh2
35 $ hg add bh2
35 $ hg add bh2
36 $ hg commit -d '4 0' -m "Adding b branch head 2"
36 $ hg commit -d '4 0' -m "Adding b branch head 2"
37
37
38 $ echo 'c' >c
38 $ echo 'c' >c
39 $ hg add c
39 $ hg add c
40 $ hg branch c
40 $ hg branch c
41 marked working directory as branch c
41 marked working directory as branch c
42 $ hg commit -d '5 0' -m "Adding c branch"
42 $ hg commit -d '5 0' -m "Adding c branch"
43
43
44 $ hg branch tip
44 $ hg branch tip
45 abort: the name 'tip' is reserved
45 abort: the name 'tip' is reserved
46 [255]
46 [255]
47 $ hg branch null
47 $ hg branch null
48 abort: the name 'null' is reserved
48 abort: the name 'null' is reserved
49 [255]
49 [255]
50 $ hg branch .
50 $ hg branch .
51 abort: the name '.' is reserved
51 abort: the name '.' is reserved
52 [255]
52 [255]
53
53
54 $ echo 'd' >d
54 $ echo 'd' >d
55 $ hg add d
55 $ hg add d
56 $ hg branch 'a branch name much longer than the default justification used by branches'
56 $ hg branch 'a branch name much longer than the default justification used by branches'
57 marked working directory as branch a branch name much longer than the default justification used by branches
57 marked working directory as branch a branch name much longer than the default justification used by branches
58 $ hg commit -d '6 0' -m "Adding d branch"
58 $ hg commit -d '6 0' -m "Adding d branch"
59
59
60 $ hg branches
60 $ hg branches
61 a branch name much longer than the default justification used by branches 7:10ff5895aa57
61 a branch name much longer than the default justification used by branches 7:10ff5895aa57
62 b 4:aee39cd168d0
62 b 4:aee39cd168d0
63 c 6:589736a22561 (inactive)
63 c 6:589736a22561 (inactive)
64 a 5:d8cbc61dbaa6 (inactive)
64 a 5:d8cbc61dbaa6 (inactive)
65 default 0:19709c5a4e75 (inactive)
65 default 0:19709c5a4e75 (inactive)
66
66
67 -------
67 -------
68
68
69 $ hg branches -a
69 $ hg branches -a
70 a branch name much longer than the default justification used by branches 7:10ff5895aa57
70 a branch name much longer than the default justification used by branches 7:10ff5895aa57
71 b 4:aee39cd168d0
71 b 4:aee39cd168d0
72
72
73 --- Branch a
73 --- Branch a
74
74
75 $ hg log -b a
75 $ hg log -b a
76 changeset: 5:d8cbc61dbaa6
76 changeset: 5:d8cbc61dbaa6
77 branch: a
77 branch: a
78 parent: 2:881fe2b92ad0
78 parent: 2:881fe2b92ad0
79 user: test
79 user: test
80 date: Thu Jan 01 00:00:04 1970 +0000
80 date: Thu Jan 01 00:00:04 1970 +0000
81 summary: Adding b branch head 2
81 summary: Adding b branch head 2
82
82
83 changeset: 2:881fe2b92ad0
83 changeset: 2:881fe2b92ad0
84 branch: a
84 branch: a
85 user: test
85 user: test
86 date: Thu Jan 01 00:00:02 1970 +0000
86 date: Thu Jan 01 00:00:02 1970 +0000
87 summary: Adding to a branch
87 summary: Adding to a branch
88
88
89 changeset: 1:dd6b440dd85a
89 changeset: 1:dd6b440dd85a
90 branch: a
90 branch: a
91 user: test
91 user: test
92 date: Thu Jan 01 00:00:01 1970 +0000
92 date: Thu Jan 01 00:00:01 1970 +0000
93 summary: Adding a branch
93 summary: Adding a branch
94
94
95
95
96 ---- Branch b
96 ---- Branch b
97
97
98 $ hg log -b b
98 $ hg log -b b
99 changeset: 4:aee39cd168d0
99 changeset: 4:aee39cd168d0
100 branch: b
100 branch: b
101 user: test
101 user: test
102 date: Thu Jan 01 00:00:03 1970 +0000
102 date: Thu Jan 01 00:00:03 1970 +0000
103 summary: Adding b branch head 1
103 summary: Adding b branch head 1
104
104
105 changeset: 3:ac22033332d1
105 changeset: 3:ac22033332d1
106 branch: b
106 branch: b
107 parent: 0:19709c5a4e75
107 parent: 0:19709c5a4e75
108 user: test
108 user: test
109 date: Thu Jan 01 00:00:02 1970 +0000
109 date: Thu Jan 01 00:00:02 1970 +0000
110 summary: Adding b branch
110 summary: Adding b branch
111
111
112
112
113 ---- going to test branch closing
113 ---- going to test branch closing
114
114
115 $ hg branches
115 $ hg branches
116 a branch name much longer than the default justification used by branches 7:10ff5895aa57
116 a branch name much longer than the default justification used by branches 7:10ff5895aa57
117 b 4:aee39cd168d0
117 b 4:aee39cd168d0
118 c 6:589736a22561 (inactive)
118 c 6:589736a22561 (inactive)
119 a 5:d8cbc61dbaa6 (inactive)
119 a 5:d8cbc61dbaa6 (inactive)
120 default 0:19709c5a4e75 (inactive)
120 default 0:19709c5a4e75 (inactive)
121 $ hg up -C b
121 $ hg up -C b
122 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
122 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
123 $ echo 'xxx1' >> b
123 $ echo 'xxx1' >> b
124 $ hg commit -d '7 0' -m 'adding cset to branch b'
124 $ hg commit -d '7 0' -m 'adding cset to branch b'
125 $ hg up -C aee39cd168d0
125 $ hg up -C aee39cd168d0
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 $ echo 'xxx2' >> b
127 $ echo 'xxx2' >> b
128 $ hg commit -d '8 0' -m 'adding head to branch b'
128 $ hg commit -d '8 0' -m 'adding head to branch b'
129 created new head
129 created new head
130 $ echo 'xxx3' >> b
130 $ echo 'xxx3' >> b
131 $ hg commit -d '9 0' -m 'adding another cset to branch b'
131 $ hg commit -d '9 0' -m 'adding another cset to branch b'
132 $ hg branches
132 $ hg branches
133 b 10:bfbe841b666e
133 b 10:bfbe841b666e
134 a branch name much longer than the default justification used by branches 7:10ff5895aa57
134 a branch name much longer than the default justification used by branches 7:10ff5895aa57
135 c 6:589736a22561 (inactive)
135 c 6:589736a22561 (inactive)
136 a 5:d8cbc61dbaa6 (inactive)
136 a 5:d8cbc61dbaa6 (inactive)
137 default 0:19709c5a4e75 (inactive)
137 default 0:19709c5a4e75 (inactive)
138 $ hg heads --closed
138 $ hg heads --closed
139 changeset: 10:bfbe841b666e
139 changeset: 10:bfbe841b666e
140 branch: b
140 branch: b
141 tag: tip
141 tag: tip
142 user: test
142 user: test
143 date: Thu Jan 01 00:00:09 1970 +0000
143 date: Thu Jan 01 00:00:09 1970 +0000
144 summary: adding another cset to branch b
144 summary: adding another cset to branch b
145
145
146 changeset: 8:eebb944467c9
146 changeset: 8:eebb944467c9
147 branch: b
147 branch: b
148 parent: 4:aee39cd168d0
148 parent: 4:aee39cd168d0
149 user: test
149 user: test
150 date: Thu Jan 01 00:00:07 1970 +0000
150 date: Thu Jan 01 00:00:07 1970 +0000
151 summary: adding cset to branch b
151 summary: adding cset to branch b
152
152
153 changeset: 7:10ff5895aa57
153 changeset: 7:10ff5895aa57
154 branch: a branch name much longer than the default justification used by branches
154 branch: a branch name much longer than the default justification used by branches
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:06 1970 +0000
156 date: Thu Jan 01 00:00:06 1970 +0000
157 summary: Adding d branch
157 summary: Adding d branch
158
158
159 changeset: 6:589736a22561
159 changeset: 6:589736a22561
160 branch: c
160 branch: c
161 user: test
161 user: test
162 date: Thu Jan 01 00:00:05 1970 +0000
162 date: Thu Jan 01 00:00:05 1970 +0000
163 summary: Adding c branch
163 summary: Adding c branch
164
164
165 changeset: 5:d8cbc61dbaa6
165 changeset: 5:d8cbc61dbaa6
166 branch: a
166 branch: a
167 parent: 2:881fe2b92ad0
167 parent: 2:881fe2b92ad0
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:04 1970 +0000
169 date: Thu Jan 01 00:00:04 1970 +0000
170 summary: Adding b branch head 2
170 summary: Adding b branch head 2
171
171
172 changeset: 0:19709c5a4e75
172 changeset: 0:19709c5a4e75
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: Adding root node
175 summary: Adding root node
176
176
177 $ hg heads
177 $ hg heads
178 changeset: 10:bfbe841b666e
178 changeset: 10:bfbe841b666e
179 branch: b
179 branch: b
180 tag: tip
180 tag: tip
181 user: test
181 user: test
182 date: Thu Jan 01 00:00:09 1970 +0000
182 date: Thu Jan 01 00:00:09 1970 +0000
183 summary: adding another cset to branch b
183 summary: adding another cset to branch b
184
184
185 changeset: 8:eebb944467c9
185 changeset: 8:eebb944467c9
186 branch: b
186 branch: b
187 parent: 4:aee39cd168d0
187 parent: 4:aee39cd168d0
188 user: test
188 user: test
189 date: Thu Jan 01 00:00:07 1970 +0000
189 date: Thu Jan 01 00:00:07 1970 +0000
190 summary: adding cset to branch b
190 summary: adding cset to branch b
191
191
192 changeset: 7:10ff5895aa57
192 changeset: 7:10ff5895aa57
193 branch: a branch name much longer than the default justification used by branches
193 branch: a branch name much longer than the default justification used by branches
194 user: test
194 user: test
195 date: Thu Jan 01 00:00:06 1970 +0000
195 date: Thu Jan 01 00:00:06 1970 +0000
196 summary: Adding d branch
196 summary: Adding d branch
197
197
198 changeset: 6:589736a22561
198 changeset: 6:589736a22561
199 branch: c
199 branch: c
200 user: test
200 user: test
201 date: Thu Jan 01 00:00:05 1970 +0000
201 date: Thu Jan 01 00:00:05 1970 +0000
202 summary: Adding c branch
202 summary: Adding c branch
203
203
204 changeset: 5:d8cbc61dbaa6
204 changeset: 5:d8cbc61dbaa6
205 branch: a
205 branch: a
206 parent: 2:881fe2b92ad0
206 parent: 2:881fe2b92ad0
207 user: test
207 user: test
208 date: Thu Jan 01 00:00:04 1970 +0000
208 date: Thu Jan 01 00:00:04 1970 +0000
209 summary: Adding b branch head 2
209 summary: Adding b branch head 2
210
210
211 changeset: 0:19709c5a4e75
211 changeset: 0:19709c5a4e75
212 user: test
212 user: test
213 date: Thu Jan 01 00:00:00 1970 +0000
213 date: Thu Jan 01 00:00:00 1970 +0000
214 summary: Adding root node
214 summary: Adding root node
215
215
216 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
216 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
217 $ hg branches -a
217 $ hg branches -a
218 b 8:eebb944467c9
218 b 8:eebb944467c9
219 a branch name much longer than the default justification used by branches 7:10ff5895aa57
219 a branch name much longer than the default justification used by branches 7:10ff5895aa57
220 $ hg up -C b
220 $ hg up -C b
221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
222 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
223
223
224 --- b branch should be inactive
224 --- b branch should be inactive
225
225
226 $ hg branches
226 $ hg branches
227 a branch name much longer than the default justification used by branches 7:10ff5895aa57
227 a branch name much longer than the default justification used by branches 7:10ff5895aa57
228 c 6:589736a22561 (inactive)
228 c 6:589736a22561 (inactive)
229 a 5:d8cbc61dbaa6 (inactive)
229 a 5:d8cbc61dbaa6 (inactive)
230 default 0:19709c5a4e75 (inactive)
230 default 0:19709c5a4e75 (inactive)
231 $ hg branches -c
231 $ hg branches -c
232 a branch name much longer than the default justification used by branches 7:10ff5895aa57
232 a branch name much longer than the default justification used by branches 7:10ff5895aa57
233 b 12:2da6583810df (closed)
233 b 12:2da6583810df (closed)
234 c 6:589736a22561 (inactive)
234 c 6:589736a22561 (inactive)
235 a 5:d8cbc61dbaa6 (inactive)
235 a 5:d8cbc61dbaa6 (inactive)
236 default 0:19709c5a4e75 (inactive)
236 default 0:19709c5a4e75 (inactive)
237 $ hg branches -a
237 $ hg branches -a
238 a branch name much longer than the default justification used by branches 7:10ff5895aa57
238 a branch name much longer than the default justification used by branches 7:10ff5895aa57
239 $ hg heads b
239 $ hg heads b
240 no open branch heads found on branches b
240 no open branch heads found on branches b
241 [1]
241 [1]
242 $ hg heads --closed b
242 $ hg heads --closed b
243 changeset: 12:2da6583810df
243 changeset: 12:2da6583810df
244 branch: b
244 branch: b
245 tag: tip
245 tag: tip
246 parent: 8:eebb944467c9
246 parent: 8:eebb944467c9
247 user: test
247 user: test
248 date: Thu Jan 01 00:00:09 1970 +0000
248 date: Thu Jan 01 00:00:09 1970 +0000
249 summary: close this part branch too
249 summary: close this part branch too
250
250
251 changeset: 11:c84627f3c15d
251 changeset: 11:c84627f3c15d
252 branch: b
252 branch: b
253 user: test
253 user: test
254 date: Thu Jan 01 00:00:09 1970 +0000
254 date: Thu Jan 01 00:00:09 1970 +0000
255 summary: prune bad branch
255 summary: prune bad branch
256
256
257 $ echo 'xxx4' >> b
257 $ echo 'xxx4' >> b
258 $ hg commit -d '9 0' -m 'reopen branch with a change'
258 $ hg commit -d '9 0' -m 'reopen branch with a change'
259 reopening closed branch head 12
259 reopening closed branch head 12
260
260
261 --- branch b is back in action
261 --- branch b is back in action
262
262
263 $ hg branches -a
263 $ hg branches -a
264 b 13:6ac12926b8c3
264 b 13:6ac12926b8c3
265 a branch name much longer than the default justification used by branches 7:10ff5895aa57
265 a branch name much longer than the default justification used by branches 7:10ff5895aa57
266
266
267 ---- test heads listings
267 ---- test heads listings
268
268
269 $ hg heads
269 $ hg heads
270 changeset: 13:6ac12926b8c3
270 changeset: 13:6ac12926b8c3
271 branch: b
271 branch: b
272 tag: tip
272 tag: tip
273 user: test
273 user: test
274 date: Thu Jan 01 00:00:09 1970 +0000
274 date: Thu Jan 01 00:00:09 1970 +0000
275 summary: reopen branch with a change
275 summary: reopen branch with a change
276
276
277 changeset: 7:10ff5895aa57
277 changeset: 7:10ff5895aa57
278 branch: a branch name much longer than the default justification used by branches
278 branch: a branch name much longer than the default justification used by branches
279 user: test
279 user: test
280 date: Thu Jan 01 00:00:06 1970 +0000
280 date: Thu Jan 01 00:00:06 1970 +0000
281 summary: Adding d branch
281 summary: Adding d branch
282
282
283 changeset: 6:589736a22561
283 changeset: 6:589736a22561
284 branch: c
284 branch: c
285 user: test
285 user: test
286 date: Thu Jan 01 00:00:05 1970 +0000
286 date: Thu Jan 01 00:00:05 1970 +0000
287 summary: Adding c branch
287 summary: Adding c branch
288
288
289 changeset: 5:d8cbc61dbaa6
289 changeset: 5:d8cbc61dbaa6
290 branch: a
290 branch: a
291 parent: 2:881fe2b92ad0
291 parent: 2:881fe2b92ad0
292 user: test
292 user: test
293 date: Thu Jan 01 00:00:04 1970 +0000
293 date: Thu Jan 01 00:00:04 1970 +0000
294 summary: Adding b branch head 2
294 summary: Adding b branch head 2
295
295
296 changeset: 0:19709c5a4e75
296 changeset: 0:19709c5a4e75
297 user: test
297 user: test
298 date: Thu Jan 01 00:00:00 1970 +0000
298 date: Thu Jan 01 00:00:00 1970 +0000
299 summary: Adding root node
299 summary: Adding root node
300
300
301
301
302 branch default
302 branch default
303
303
304 $ hg heads default
304 $ hg heads default
305 changeset: 0:19709c5a4e75
305 changeset: 0:19709c5a4e75
306 user: test
306 user: test
307 date: Thu Jan 01 00:00:00 1970 +0000
307 date: Thu Jan 01 00:00:00 1970 +0000
308 summary: Adding root node
308 summary: Adding root node
309
309
310
310
311 branch a
311 branch a
312
312
313 $ hg heads a
313 $ hg heads a
314 changeset: 5:d8cbc61dbaa6
314 changeset: 5:d8cbc61dbaa6
315 branch: a
315 branch: a
316 parent: 2:881fe2b92ad0
316 parent: 2:881fe2b92ad0
317 user: test
317 user: test
318 date: Thu Jan 01 00:00:04 1970 +0000
318 date: Thu Jan 01 00:00:04 1970 +0000
319 summary: Adding b branch head 2
319 summary: Adding b branch head 2
320
320
321 $ hg heads --active a
321 $ hg heads --active a
322 no open branch heads found on branches a
322 no open branch heads found on branches a
323 [1]
323 [1]
324
324
325 branch b
325 branch b
326
326
327 $ hg heads b
327 $ hg heads b
328 changeset: 13:6ac12926b8c3
328 changeset: 13:6ac12926b8c3
329 branch: b
329 branch: b
330 tag: tip
330 tag: tip
331 user: test
331 user: test
332 date: Thu Jan 01 00:00:09 1970 +0000
332 date: Thu Jan 01 00:00:09 1970 +0000
333 summary: reopen branch with a change
333 summary: reopen branch with a change
334
334
335 $ hg heads --closed b
335 $ hg heads --closed b
336 changeset: 13:6ac12926b8c3
336 changeset: 13:6ac12926b8c3
337 branch: b
337 branch: b
338 tag: tip
338 tag: tip
339 user: test
339 user: test
340 date: Thu Jan 01 00:00:09 1970 +0000
340 date: Thu Jan 01 00:00:09 1970 +0000
341 summary: reopen branch with a change
341 summary: reopen branch with a change
342
342
343 changeset: 11:c84627f3c15d
343 changeset: 11:c84627f3c15d
344 branch: b
344 branch: b
345 user: test
345 user: test
346 date: Thu Jan 01 00:00:09 1970 +0000
346 date: Thu Jan 01 00:00:09 1970 +0000
347 summary: prune bad branch
347 summary: prune bad branch
348
348
349 default branch colors:
349 default branch colors:
350
350
351 $ echo "[extensions]" >> $HGRCPATH
351 $ echo "[extensions]" >> $HGRCPATH
352 $ echo "color =" >> $HGRCPATH
352 $ echo "color =" >> $HGRCPATH
353 $ echo "[color]" >> $HGRCPATH
354 $ echo "mode = ansi" >> $HGRCPATH
353
355
354 $ hg up -C c
356 $ hg up -C c
355 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
357 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
356 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
358 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
357 $ hg up -C b
359 $ hg up -C b
358 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
360 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
359 $ hg branches --color=always
361 $ hg branches --color=always
360 \x1b[0;32mb\x1b[0m \x1b[0;33m 13:6ac12926b8c3\x1b[0m (esc)
362 \x1b[0;32mb\x1b[0m \x1b[0;33m 13:6ac12926b8c3\x1b[0m (esc)
361 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
363 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
362 \x1b[0;0ma\x1b[0m \x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
364 \x1b[0;0ma\x1b[0m \x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
363 \x1b[0;0mdefault\x1b[0m \x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
365 \x1b[0;0mdefault\x1b[0m \x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
364
366
365 default closed branch color:
367 default closed branch color:
366
368
367 $ hg branches --color=always --closed
369 $ hg branches --color=always --closed
368 \x1b[0;32mb\x1b[0m \x1b[0;33m 13:6ac12926b8c3\x1b[0m (esc)
370 \x1b[0;32mb\x1b[0m \x1b[0;33m 13:6ac12926b8c3\x1b[0m (esc)
369 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
371 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
370 \x1b[0;30;1mc\x1b[0m \x1b[0;33m 14:717d2e6fabe1\x1b[0m (closed) (esc)
372 \x1b[0;30;1mc\x1b[0m \x1b[0;33m 14:717d2e6fabe1\x1b[0m (closed) (esc)
371 \x1b[0;0ma\x1b[0m \x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
373 \x1b[0;0ma\x1b[0m \x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
372 \x1b[0;0mdefault\x1b[0m \x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
374 \x1b[0;0mdefault\x1b[0m \x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
373
375
374 $ echo "[extensions]" >> $HGRCPATH
376 $ echo "[extensions]" >> $HGRCPATH
375 $ echo "color =" >> $HGRCPATH
377 $ echo "color =" >> $HGRCPATH
376 $ echo "[color]" >> $HGRCPATH
378 $ echo "[color]" >> $HGRCPATH
377 $ echo "branches.active = green" >> $HGRCPATH
379 $ echo "branches.active = green" >> $HGRCPATH
378 $ echo "branches.closed = blue" >> $HGRCPATH
380 $ echo "branches.closed = blue" >> $HGRCPATH
379 $ echo "branches.current = red" >> $HGRCPATH
381 $ echo "branches.current = red" >> $HGRCPATH
380 $ echo "branches.inactive = magenta" >> $HGRCPATH
382 $ echo "branches.inactive = magenta" >> $HGRCPATH
381 $ echo "log.changeset = cyan" >> $HGRCPATH
383 $ echo "log.changeset = cyan" >> $HGRCPATH
382
384
383 custom branch colors:
385 custom branch colors:
384
386
385 $ hg branches --color=always
387 $ hg branches --color=always
386 \x1b[0;31mb\x1b[0m \x1b[0;36m 13:6ac12926b8c3\x1b[0m (esc)
388 \x1b[0;31mb\x1b[0m \x1b[0;36m 13:6ac12926b8c3\x1b[0m (esc)
387 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
389 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
388 \x1b[0;35ma\x1b[0m \x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
390 \x1b[0;35ma\x1b[0m \x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
389 \x1b[0;35mdefault\x1b[0m \x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
391 \x1b[0;35mdefault\x1b[0m \x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
390
392
391 custom closed branch color:
393 custom closed branch color:
392
394
393 $ hg branches --color=always --closed
395 $ hg branches --color=always --closed
394 \x1b[0;31mb\x1b[0m \x1b[0;36m 13:6ac12926b8c3\x1b[0m (esc)
396 \x1b[0;31mb\x1b[0m \x1b[0;36m 13:6ac12926b8c3\x1b[0m (esc)
395 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
397 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
396 \x1b[0;34mc\x1b[0m \x1b[0;36m 14:717d2e6fabe1\x1b[0m (closed) (esc)
398 \x1b[0;34mc\x1b[0m \x1b[0;36m 14:717d2e6fabe1\x1b[0m (closed) (esc)
397 \x1b[0;35ma\x1b[0m \x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
399 \x1b[0;35ma\x1b[0m \x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
398 \x1b[0;35mdefault\x1b[0m \x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
400 \x1b[0;35mdefault\x1b[0m \x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
@@ -1,125 +1,127 b''
1 Setup
1 Setup
2
2
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode = ansi" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "color=" >> $HGRCPATH
6 $ echo "color=" >> $HGRCPATH
5 $ hg init repo
7 $ hg init repo
6 $ cd repo
8 $ cd repo
7 $ cat > a <<EOF
9 $ cat > a <<EOF
8 > c
10 > c
9 > c
11 > c
10 > a
12 > a
11 > a
13 > a
12 > b
14 > b
13 > a
15 > a
14 > a
16 > a
15 > c
17 > c
16 > c
18 > c
17 > EOF
19 > EOF
18 $ hg ci -Am adda
20 $ hg ci -Am adda
19 adding a
21 adding a
20 $ cat > a <<EOF
22 $ cat > a <<EOF
21 > c
23 > c
22 > c
24 > c
23 > a
25 > a
24 > a
26 > a
25 > dd
27 > dd
26 > a
28 > a
27 > a
29 > a
28 > c
30 > c
29 > c
31 > c
30 > EOF
32 > EOF
31
33
32 default context
34 default context
33
35
34 $ hg diff --nodates --color=always
36 $ hg diff --nodates --color=always
35 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
37 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
36 \x1b[0;31;1m--- a/a\x1b[0m (esc)
38 \x1b[0;31;1m--- a/a\x1b[0m (esc)
37 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
39 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
38 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
40 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
39 c
41 c
40 a
42 a
41 a
43 a
42 \x1b[0;31m-b\x1b[0m (esc)
44 \x1b[0;31m-b\x1b[0m (esc)
43 \x1b[0;32m+dd\x1b[0m (esc)
45 \x1b[0;32m+dd\x1b[0m (esc)
44 a
46 a
45 a
47 a
46 c
48 c
47
49
48 --unified=2
50 --unified=2
49
51
50 $ hg diff --nodates -U 2 --color=always
52 $ hg diff --nodates -U 2 --color=always
51 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
53 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
52 \x1b[0;31;1m--- a/a\x1b[0m (esc)
54 \x1b[0;31;1m--- a/a\x1b[0m (esc)
53 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
55 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
54 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
56 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
55 a
57 a
56 a
58 a
57 \x1b[0;31m-b\x1b[0m (esc)
59 \x1b[0;31m-b\x1b[0m (esc)
58 \x1b[0;32m+dd\x1b[0m (esc)
60 \x1b[0;32m+dd\x1b[0m (esc)
59 a
61 a
60 a
62 a
61
63
62 diffstat
64 diffstat
63
65
64 $ hg diff --stat --color=always
66 $ hg diff --stat --color=always
65 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
67 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
66 1 files changed, 1 insertions(+), 1 deletions(-)
68 1 files changed, 1 insertions(+), 1 deletions(-)
67 $ echo "record=" >> $HGRCPATH
69 $ echo "record=" >> $HGRCPATH
68 $ echo "[ui]" >> $HGRCPATH
70 $ echo "[ui]" >> $HGRCPATH
69 $ echo "interactive=true" >> $HGRCPATH
71 $ echo "interactive=true" >> $HGRCPATH
70 $ echo "[diff]" >> $HGRCPATH
72 $ echo "[diff]" >> $HGRCPATH
71 $ echo "git=True" >> $HGRCPATH
73 $ echo "git=True" >> $HGRCPATH
72
74
73 record
75 record
74
76
75 $ chmod 0755 a
77 $ chmod 0755 a
76 $ hg record --color=always -m moda a <<EOF
78 $ hg record --color=always -m moda a <<EOF
77 > y
79 > y
78 > y
80 > y
79 > EOF
81 > EOF
80 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
82 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
81 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
83 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
82 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
84 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
83 1 hunks, 1 lines changed
85 1 hunks, 1 lines changed
84 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
86 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
85 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
87 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
86 c
88 c
87 a
89 a
88 a
90 a
89 \x1b[0;31m-b\x1b[0m (esc)
91 \x1b[0;31m-b\x1b[0m (esc)
90 \x1b[0;32m+dd\x1b[0m (esc)
92 \x1b[0;32m+dd\x1b[0m (esc)
91 a
93 a
92 a
94 a
93 c
95 c
94 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
96 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
95 $ echo
97 $ echo
96
98
97 $ echo "[extensions]" >> $HGRCPATH
99 $ echo "[extensions]" >> $HGRCPATH
98 $ echo "mq=" >> $HGRCPATH
100 $ echo "mq=" >> $HGRCPATH
99 $ hg rollback
101 $ hg rollback
100 repository tip rolled back to revision 0 (undo commit)
102 repository tip rolled back to revision 0 (undo commit)
101 working directory now based on revision 0
103 working directory now based on revision 0
102
104
103 qrecord
105 qrecord
104
106
105 $ hg qrecord --color=always -m moda patch <<EOF
107 $ hg qrecord --color=always -m moda patch <<EOF
106 > y
108 > y
107 > y
109 > y
108 > EOF
110 > EOF
109 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
111 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
110 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
112 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
111 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
113 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
112 1 hunks, 1 lines changed
114 1 hunks, 1 lines changed
113 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
115 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
114 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
116 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
115 c
117 c
116 a
118 a
117 a
119 a
118 \x1b[0;31m-b\x1b[0m (esc)
120 \x1b[0;31m-b\x1b[0m (esc)
119 \x1b[0;32m+dd\x1b[0m (esc)
121 \x1b[0;32m+dd\x1b[0m (esc)
120 a
122 a
121 a
123 a
122 c
124 c
123 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
125 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
124 $ echo
126 $ echo
125
127
@@ -1,68 +1,70 b''
1 http://mercurial.selenic.com/bts/issue352
1 http://mercurial.selenic.com/bts/issue352
2
2
3 $ "$TESTDIR/hghave" eol-in-paths || exit 80
3 $ "$TESTDIR/hghave" eol-in-paths || exit 80
4
4
5 test issue352
5 test issue352
6
6
7 $ hg init foo
7 $ hg init foo
8 $ cd foo
8 $ cd foo
9 $ A=`printf 'he\rllo'`
9 $ A=`printf 'he\rllo'`
10 $ echo foo > "$A"
10 $ echo foo > "$A"
11 $ hg add
11 $ hg add
12 adding he\rllo (esc)
12 adding he\rllo (esc)
13 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
13 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
14 [255]
14 [255]
15 $ hg ci -A -m m
15 $ hg ci -A -m m
16 adding he\rllo (esc)
16 adding he\rllo (esc)
17 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
17 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
18 [255]
18 [255]
19 $ rm "$A"
19 $ rm "$A"
20 $ echo foo > "hell
20 $ echo foo > "hell
21 > o"
21 > o"
22 $ hg add
22 $ hg add
23 adding hell
23 adding hell
24 o
24 o
25 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
25 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
26 [255]
26 [255]
27 $ hg ci -A -m m
27 $ hg ci -A -m m
28 adding hell
28 adding hell
29 o
29 o
30 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
30 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
31 [255]
31 [255]
32 $ echo foo > "$A"
32 $ echo foo > "$A"
33 $ hg debugwalk
33 $ hg debugwalk
34 f he\rllo he\rllo (esc)
34 f he\rllo he\rllo (esc)
35 f hell
35 f hell
36 o hell
36 o hell
37 o
37 o
38
38
39 $ echo bla > quickfox
39 $ echo bla > quickfox
40 $ hg add quickfox
40 $ hg add quickfox
41 $ hg ci -m 2
41 $ hg ci -m 2
42 $ A=`printf 'quick\rfox'`
42 $ A=`printf 'quick\rfox'`
43 $ hg cp quickfox "$A"
43 $ hg cp quickfox "$A"
44 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
44 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
45 [255]
45 [255]
46 $ hg mv quickfox "$A"
46 $ hg mv quickfox "$A"
47 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
47 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
48 [255]
48 [255]
49
49
50 http://mercurial.selenic.com/bts/issue2036
50 http://mercurial.selenic.com/bts/issue2036
51
51
52 $ cd ..
52 $ cd ..
53
53
54 test issue2039
54 test issue2039
55
55
56 $ hg init bar
56 $ hg init bar
57 $ cd bar
57 $ cd bar
58 $ echo "[extensions]" >> $HGRCPATH
58 $ echo "[extensions]" >> $HGRCPATH
59 $ echo "color=" >> $HGRCPATH
59 $ echo "color=" >> $HGRCPATH
60 $ echo "[color]" >> $HGRCPATH
61 $ echo "mode = ansi" >> $HGRCPATH
60 $ A=`printf 'foo\nbar'`
62 $ A=`printf 'foo\nbar'`
61 $ B=`printf 'foo\nbar.baz'`
63 $ B=`printf 'foo\nbar.baz'`
62 $ touch "$A"
64 $ touch "$A"
63 $ touch "$B"
65 $ touch "$B"
64 $ hg status --color=always
66 $ hg status --color=always
65 \x1b[0;35;1;4m? foo\x1b[0m (esc)
67 \x1b[0;35;1;4m? foo\x1b[0m (esc)
66 \x1b[0;35;1;4mbar\x1b[0m (esc)
68 \x1b[0;35;1;4mbar\x1b[0m (esc)
67 \x1b[0;35;1;4m? foo\x1b[0m (esc)
69 \x1b[0;35;1;4m? foo\x1b[0m (esc)
68 \x1b[0;35;1;4mbar.baz\x1b[0m (esc)
70 \x1b[0;35;1;4mbar.baz\x1b[0m (esc)
@@ -1,436 +1,436 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3
3
4 $ hg init
4 $ hg init
5 $ hg qinit
5 $ hg qinit
6
6
7 $ echo x > x
7 $ echo x > x
8 $ hg ci -Ama
8 $ hg ci -Ama
9 adding x
9 adding x
10
10
11 $ hg qnew a.patch
11 $ hg qnew a.patch
12 $ echo a > a
12 $ echo a > a
13 $ hg add a
13 $ hg add a
14 $ hg qrefresh
14 $ hg qrefresh
15
15
16 $ hg qnew b.patch
16 $ hg qnew b.patch
17 $ echo b > b
17 $ echo b > b
18 $ hg add b
18 $ hg add b
19 $ hg qrefresh
19 $ hg qrefresh
20
20
21 $ hg qnew c.patch
21 $ hg qnew c.patch
22 $ echo c > c
22 $ echo c > c
23 $ hg add c
23 $ hg add c
24 $ hg qrefresh
24 $ hg qrefresh
25
25
26 $ hg qpop -a
26 $ hg qpop -a
27 popping c.patch
27 popping c.patch
28 popping b.patch
28 popping b.patch
29 popping a.patch
29 popping a.patch
30 patch queue now empty
30 patch queue now empty
31
31
32
32
33 should fail
33 should fail
34
34
35 $ hg qguard does-not-exist.patch +bleh
35 $ hg qguard does-not-exist.patch +bleh
36 abort: no patch named does-not-exist.patch
36 abort: no patch named does-not-exist.patch
37 [255]
37 [255]
38
38
39
39
40 should fail
40 should fail
41
41
42 $ hg qguard +fail
42 $ hg qguard +fail
43 abort: no patches applied
43 abort: no patches applied
44 [255]
44 [255]
45
45
46 $ hg qpush
46 $ hg qpush
47 applying a.patch
47 applying a.patch
48 now at: a.patch
48 now at: a.patch
49
49
50 should guard a.patch
50 should guard a.patch
51
51
52 $ hg qguard +a
52 $ hg qguard +a
53
53
54 should print +a
54 should print +a
55
55
56 $ hg qguard
56 $ hg qguard
57 a.patch: +a
57 a.patch: +a
58 $ hg qpop
58 $ hg qpop
59 popping a.patch
59 popping a.patch
60 patch queue now empty
60 patch queue now empty
61
61
62
62
63 should fail
63 should fail
64
64
65 $ hg qpush a.patch
65 $ hg qpush a.patch
66 cannot push 'a.patch' - guarded by ['+a']
66 cannot push 'a.patch' - guarded by ['+a']
67 [1]
67 [1]
68
68
69 $ hg qguard a.patch
69 $ hg qguard a.patch
70 a.patch: +a
70 a.patch: +a
71
71
72 should push b.patch
72 should push b.patch
73
73
74 $ hg qpush
74 $ hg qpush
75 applying b.patch
75 applying b.patch
76 now at: b.patch
76 now at: b.patch
77
77
78 $ hg qpop
78 $ hg qpop
79 popping b.patch
79 popping b.patch
80 patch queue now empty
80 patch queue now empty
81
81
82 test selection of an empty guard
82 test selection of an empty guard
83
83
84 $ hg qselect ""
84 $ hg qselect ""
85 abort: guard cannot be an empty string
85 abort: guard cannot be an empty string
86 [255]
86 [255]
87 $ hg qselect a
87 $ hg qselect a
88 number of unguarded, unapplied patches has changed from 2 to 3
88 number of unguarded, unapplied patches has changed from 2 to 3
89
89
90 should push a.patch
90 should push a.patch
91
91
92 $ hg qpush
92 $ hg qpush
93 applying a.patch
93 applying a.patch
94 now at: a.patch
94 now at: a.patch
95
95
96 $ hg qguard -- c.patch -a
96 $ hg qguard -- c.patch -a
97
97
98 should print -a
98 should print -a
99
99
100 $ hg qguard c.patch
100 $ hg qguard c.patch
101 c.patch: -a
101 c.patch: -a
102
102
103
103
104 should skip c.patch
104 should skip c.patch
105
105
106 $ hg qpush -a
106 $ hg qpush -a
107 applying b.patch
107 applying b.patch
108 skipping c.patch - guarded by '-a'
108 skipping c.patch - guarded by '-a'
109 now at: b.patch
109 now at: b.patch
110
110
111 should display b.patch
111 should display b.patch
112
112
113 $ hg qtop
113 $ hg qtop
114 b.patch
114 b.patch
115
115
116 $ hg qguard -n c.patch
116 $ hg qguard -n c.patch
117
117
118 should push c.patch
118 should push c.patch
119
119
120 $ hg qpush -a
120 $ hg qpush -a
121 applying c.patch
121 applying c.patch
122 now at: c.patch
122 now at: c.patch
123
123
124 $ hg qpop -a
124 $ hg qpop -a
125 popping c.patch
125 popping c.patch
126 popping b.patch
126 popping b.patch
127 popping a.patch
127 popping a.patch
128 patch queue now empty
128 patch queue now empty
129 $ hg qselect -n
129 $ hg qselect -n
130 guards deactivated
130 guards deactivated
131 number of unguarded, unapplied patches has changed from 3 to 2
131 number of unguarded, unapplied patches has changed from 3 to 2
132
132
133 should push all
133 should push all
134
134
135 $ hg qpush -a
135 $ hg qpush -a
136 applying b.patch
136 applying b.patch
137 applying c.patch
137 applying c.patch
138 now at: c.patch
138 now at: c.patch
139
139
140 $ hg qpop -a
140 $ hg qpop -a
141 popping c.patch
141 popping c.patch
142 popping b.patch
142 popping b.patch
143 patch queue now empty
143 patch queue now empty
144 $ hg qguard a.patch +1
144 $ hg qguard a.patch +1
145 $ hg qguard b.patch +2
145 $ hg qguard b.patch +2
146 $ hg qselect 1
146 $ hg qselect 1
147 number of unguarded, unapplied patches has changed from 1 to 2
147 number of unguarded, unapplied patches has changed from 1 to 2
148
148
149 should push a.patch, not b.patch
149 should push a.patch, not b.patch
150
150
151 $ hg qpush
151 $ hg qpush
152 applying a.patch
152 applying a.patch
153 now at: a.patch
153 now at: a.patch
154 $ hg qpush
154 $ hg qpush
155 applying c.patch
155 applying c.patch
156 now at: c.patch
156 now at: c.patch
157 $ hg qpop -a
157 $ hg qpop -a
158 popping c.patch
158 popping c.patch
159 popping a.patch
159 popping a.patch
160 patch queue now empty
160 patch queue now empty
161
161
162 $ hg qselect 2
162 $ hg qselect 2
163
163
164 should push b.patch
164 should push b.patch
165
165
166 $ hg qpush
166 $ hg qpush
167 applying b.patch
167 applying b.patch
168 now at: b.patch
168 now at: b.patch
169 $ hg qpush -a
169 $ hg qpush -a
170 applying c.patch
170 applying c.patch
171 now at: c.patch
171 now at: c.patch
172
172
173 Used to be an issue with holes in the patch sequence
173 Used to be an issue with holes in the patch sequence
174 So, put one hole on the base and ask for topmost patch.
174 So, put one hole on the base and ask for topmost patch.
175
175
176 $ hg qtop
176 $ hg qtop
177 c.patch
177 c.patch
178 $ hg qpop -a
178 $ hg qpop -a
179 popping c.patch
179 popping c.patch
180 popping b.patch
180 popping b.patch
181 patch queue now empty
181 patch queue now empty
182
182
183 $ hg qselect 1 2
183 $ hg qselect 1 2
184 number of unguarded, unapplied patches has changed from 2 to 3
184 number of unguarded, unapplied patches has changed from 2 to 3
185
185
186 should push a.patch, b.patch
186 should push a.patch, b.patch
187
187
188 $ hg qpush
188 $ hg qpush
189 applying a.patch
189 applying a.patch
190 now at: a.patch
190 now at: a.patch
191 $ hg qpush
191 $ hg qpush
192 applying b.patch
192 applying b.patch
193 now at: b.patch
193 now at: b.patch
194 $ hg qpop -a
194 $ hg qpop -a
195 popping b.patch
195 popping b.patch
196 popping a.patch
196 popping a.patch
197 patch queue now empty
197 patch queue now empty
198
198
199 $ hg qguard -- a.patch +1 +2 -3
199 $ hg qguard -- a.patch +1 +2 -3
200 $ hg qselect 1 2 3
200 $ hg qselect 1 2 3
201 number of unguarded, unapplied patches has changed from 3 to 2
201 number of unguarded, unapplied patches has changed from 3 to 2
202
202
203
203
204 list patches and guards
204 list patches and guards
205
205
206 $ hg qguard -l
206 $ hg qguard -l
207 a.patch: +1 +2 -3
207 a.patch: +1 +2 -3
208 b.patch: +2
208 b.patch: +2
209 c.patch: unguarded
209 c.patch: unguarded
210
210
211 have at least one patch applied to test coloring
211 have at least one patch applied to test coloring
212
212
213 $ hg qpush
213 $ hg qpush
214 applying b.patch
214 applying b.patch
215 now at: b.patch
215 now at: b.patch
216
216
217 list patches and guards with color
217 list patches and guards with color
218
218
219 $ hg --config extensions.color= qguard --config color.mode=ansi \
219 $ hg --config extensions.color= qguard --config color.mode=ansi \
220 > -l --color=always
220 > -l --color=always
221 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
221 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
222 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
222 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
223 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
223 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
224
224
225 should pop b.patch
225 should pop b.patch
226
226
227 $ hg qpop
227 $ hg qpop
228 popping b.patch
228 popping b.patch
229 patch queue now empty
229 patch queue now empty
230
230
231 list series
231 list series
232
232
233 $ hg qseries -v
233 $ hg qseries -v
234 0 G a.patch
234 0 G a.patch
235 1 U b.patch
235 1 U b.patch
236 2 U c.patch
236 2 U c.patch
237
237
238 list guards
238 list guards
239
239
240 $ hg qselect
240 $ hg qselect
241 1
241 1
242 2
242 2
243 3
243 3
244
244
245 should push b.patch
245 should push b.patch
246
246
247 $ hg qpush
247 $ hg qpush
248 applying b.patch
248 applying b.patch
249 now at: b.patch
249 now at: b.patch
250
250
251 $ hg qpush -a
251 $ hg qpush -a
252 applying c.patch
252 applying c.patch
253 now at: c.patch
253 now at: c.patch
254 $ hg qselect -n --reapply
254 $ hg qselect -n --reapply
255 guards deactivated
255 guards deactivated
256 popping guarded patches
256 popping guarded patches
257 popping c.patch
257 popping c.patch
258 popping b.patch
258 popping b.patch
259 patch queue now empty
259 patch queue now empty
260 reapplying unguarded patches
260 reapplying unguarded patches
261 applying c.patch
261 applying c.patch
262 now at: c.patch
262 now at: c.patch
263
263
264 guards in series file: +1 +2 -3
264 guards in series file: +1 +2 -3
265
265
266 $ hg qselect -s
266 $ hg qselect -s
267 +1
267 +1
268 +2
268 +2
269 -3
269 -3
270
270
271 should show c.patch
271 should show c.patch
272
272
273 $ hg qapplied
273 $ hg qapplied
274 c.patch
274 c.patch
275
275
276 $ hg qrename a.patch new.patch
276 $ hg qrename a.patch new.patch
277
277
278 should show :
278 should show :
279
279
280
280
281 new.patch: +1 +2 -3
281 new.patch: +1 +2 -3
282
282
283
283
284 b.patch: +2
284 b.patch: +2
285
285
286
286
287 c.patch: unguarded
287 c.patch: unguarded
288
288
289 $ hg qguard -l
289 $ hg qguard -l
290 new.patch: +1 +2 -3
290 new.patch: +1 +2 -3
291 b.patch: +2
291 b.patch: +2
292 c.patch: unguarded
292 c.patch: unguarded
293
293
294 $ hg qnew d.patch
294 $ hg qnew d.patch
295 $ hg qpop
295 $ hg qpop
296 popping d.patch
296 popping d.patch
297 now at: c.patch
297 now at: c.patch
298
298
299 should show new.patch and b.patch as Guarded, c.patch as Applied
299 should show new.patch and b.patch as Guarded, c.patch as Applied
300
300
301
301
302 and d.patch as Unapplied
302 and d.patch as Unapplied
303
303
304 $ hg qseries -v
304 $ hg qseries -v
305 0 G new.patch
305 0 G new.patch
306 1 G b.patch
306 1 G b.patch
307 2 A c.patch
307 2 A c.patch
308 3 U d.patch
308 3 U d.patch
309
309
310 qseries again, but with color
310 qseries again, but with color
311
311
312 $ hg --config extensions.color= qseries -v --color=always
312 $ hg --config extensions.color= --config color.mode=ansi qseries -v --color=always
313 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
313 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
314 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
314 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
315 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
315 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
316 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
316 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
317
317
318 $ hg qguard d.patch +2
318 $ hg qguard d.patch +2
319
319
320 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
320 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
321
321
322 $ hg qseries -v
322 $ hg qseries -v
323 0 G new.patch
323 0 G new.patch
324 1 G b.patch
324 1 G b.patch
325 2 A c.patch
325 2 A c.patch
326 3 G d.patch
326 3 G d.patch
327
327
328 $ qappunappv()
328 $ qappunappv()
329 > {
329 > {
330 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
330 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
331 > echo % hg $command
331 > echo % hg $command
332 > hg $command
332 > hg $command
333 > done
333 > done
334 > }
334 > }
335
335
336 $ hg qpop -a
336 $ hg qpop -a
337 popping c.patch
337 popping c.patch
338 patch queue now empty
338 patch queue now empty
339 $ hg qguard -l
339 $ hg qguard -l
340 new.patch: +1 +2 -3
340 new.patch: +1 +2 -3
341 b.patch: +2
341 b.patch: +2
342 c.patch: unguarded
342 c.patch: unguarded
343 d.patch: +2
343 d.patch: +2
344 $ qappunappv
344 $ qappunappv
345 % hg qapplied
345 % hg qapplied
346 % hg qapplied -v
346 % hg qapplied -v
347 % hg qunapplied
347 % hg qunapplied
348 c.patch
348 c.patch
349 % hg qunapplied -v
349 % hg qunapplied -v
350 0 G new.patch
350 0 G new.patch
351 1 G b.patch
351 1 G b.patch
352 2 U c.patch
352 2 U c.patch
353 3 G d.patch
353 3 G d.patch
354 $ hg qselect 1
354 $ hg qselect 1
355 number of unguarded, unapplied patches has changed from 1 to 2
355 number of unguarded, unapplied patches has changed from 1 to 2
356 $ qappunappv
356 $ qappunappv
357 % hg qapplied
357 % hg qapplied
358 % hg qapplied -v
358 % hg qapplied -v
359 % hg qunapplied
359 % hg qunapplied
360 new.patch
360 new.patch
361 c.patch
361 c.patch
362 % hg qunapplied -v
362 % hg qunapplied -v
363 0 U new.patch
363 0 U new.patch
364 1 G b.patch
364 1 G b.patch
365 2 U c.patch
365 2 U c.patch
366 3 G d.patch
366 3 G d.patch
367 $ hg qpush -a
367 $ hg qpush -a
368 applying new.patch
368 applying new.patch
369 skipping b.patch - guarded by ['+2']
369 skipping b.patch - guarded by ['+2']
370 applying c.patch
370 applying c.patch
371 skipping d.patch - guarded by ['+2']
371 skipping d.patch - guarded by ['+2']
372 now at: c.patch
372 now at: c.patch
373 $ qappunappv
373 $ qappunappv
374 % hg qapplied
374 % hg qapplied
375 new.patch
375 new.patch
376 c.patch
376 c.patch
377 % hg qapplied -v
377 % hg qapplied -v
378 0 A new.patch
378 0 A new.patch
379 1 G b.patch
379 1 G b.patch
380 2 A c.patch
380 2 A c.patch
381 % hg qunapplied
381 % hg qunapplied
382 % hg qunapplied -v
382 % hg qunapplied -v
383 3 G d.patch
383 3 G d.patch
384 $ hg qselect 2
384 $ hg qselect 2
385 number of unguarded, unapplied patches has changed from 0 to 1
385 number of unguarded, unapplied patches has changed from 0 to 1
386 number of guarded, applied patches has changed from 1 to 0
386 number of guarded, applied patches has changed from 1 to 0
387 $ qappunappv
387 $ qappunappv
388 % hg qapplied
388 % hg qapplied
389 new.patch
389 new.patch
390 c.patch
390 c.patch
391 % hg qapplied -v
391 % hg qapplied -v
392 0 A new.patch
392 0 A new.patch
393 1 U b.patch
393 1 U b.patch
394 2 A c.patch
394 2 A c.patch
395 % hg qunapplied
395 % hg qunapplied
396 d.patch
396 d.patch
397 % hg qunapplied -v
397 % hg qunapplied -v
398 3 U d.patch
398 3 U d.patch
399
399
400 $ for patch in `hg qseries`; do
400 $ for patch in `hg qseries`; do
401 > echo % hg qapplied $patch
401 > echo % hg qapplied $patch
402 > hg qapplied $patch
402 > hg qapplied $patch
403 > echo % hg qunapplied $patch
403 > echo % hg qunapplied $patch
404 > hg qunapplied $patch
404 > hg qunapplied $patch
405 > done
405 > done
406 % hg qapplied new.patch
406 % hg qapplied new.patch
407 new.patch
407 new.patch
408 % hg qunapplied new.patch
408 % hg qunapplied new.patch
409 b.patch
409 b.patch
410 d.patch
410 d.patch
411 % hg qapplied b.patch
411 % hg qapplied b.patch
412 new.patch
412 new.patch
413 % hg qunapplied b.patch
413 % hg qunapplied b.patch
414 d.patch
414 d.patch
415 % hg qapplied c.patch
415 % hg qapplied c.patch
416 new.patch
416 new.patch
417 c.patch
417 c.patch
418 % hg qunapplied c.patch
418 % hg qunapplied c.patch
419 d.patch
419 d.patch
420 % hg qapplied d.patch
420 % hg qapplied d.patch
421 new.patch
421 new.patch
422 c.patch
422 c.patch
423 % hg qunapplied d.patch
423 % hg qunapplied d.patch
424
424
425
425
426 hg qseries -m: only b.patch should be shown
426 hg qseries -m: only b.patch should be shown
427 the guards file was not ignored in the past
427 the guards file was not ignored in the past
428
428
429 $ hg qdelete -k b.patch
429 $ hg qdelete -k b.patch
430 $ hg qseries -m
430 $ hg qseries -m
431 b.patch
431 b.patch
432
432
433 hg qseries -m with color
433 hg qseries -m with color
434
434
435 $ hg --config extensions.color= qseries -m --color=always
435 $ hg --config extensions.color= --config color.mode=ansi qseries -m --color=always
436 \x1b[0;31;1mb.patch\x1b[0m (esc)
436 \x1b[0;31;1mb.patch\x1b[0m (esc)
@@ -1,1387 +1,1387 b''
1 $ checkundo()
1 $ checkundo()
2 > {
2 > {
3 > if [ -f .hg/store/undo ]; then
3 > if [ -f .hg/store/undo ]; then
4 > echo ".hg/store/undo still exists after $1"
4 > echo ".hg/store/undo still exists after $1"
5 > fi
5 > fi
6 > }
6 > }
7
7
8 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "[extensions]" >> $HGRCPATH
9 $ echo "mq=" >> $HGRCPATH
9 $ echo "mq=" >> $HGRCPATH
10
10
11 $ echo "[mq]" >> $HGRCPATH
11 $ echo "[mq]" >> $HGRCPATH
12 $ echo "plain=true" >> $HGRCPATH
12 $ echo "plain=true" >> $HGRCPATH
13
13
14
14
15 help
15 help
16
16
17 $ hg help mq
17 $ hg help mq
18 mq extension - manage a stack of patches
18 mq extension - manage a stack of patches
19
19
20 This extension lets you work with a stack of patches in a Mercurial
20 This extension lets you work with a stack of patches in a Mercurial
21 repository. It manages two stacks of patches - all known patches, and applied
21 repository. It manages two stacks of patches - all known patches, and applied
22 patches (subset of known patches).
22 patches (subset of known patches).
23
23
24 Known patches are represented as patch files in the .hg/patches directory.
24 Known patches are represented as patch files in the .hg/patches directory.
25 Applied patches are both patch files and changesets.
25 Applied patches are both patch files and changesets.
26
26
27 Common tasks (use "hg help command" for more details):
27 Common tasks (use "hg help command" for more details):
28
28
29 create new patch qnew
29 create new patch qnew
30 import existing patch qimport
30 import existing patch qimport
31
31
32 print patch series qseries
32 print patch series qseries
33 print applied patches qapplied
33 print applied patches qapplied
34
34
35 add known patch to applied stack qpush
35 add known patch to applied stack qpush
36 remove patch from applied stack qpop
36 remove patch from applied stack qpop
37 refresh contents of top applied patch qrefresh
37 refresh contents of top applied patch qrefresh
38
38
39 By default, mq will automatically use git patches when required to avoid
39 By default, mq will automatically use git patches when required to avoid
40 losing file mode changes, copy records, binary files or empty files creations
40 losing file mode changes, copy records, binary files or empty files creations
41 or deletions. This behaviour can be configured with:
41 or deletions. This behaviour can be configured with:
42
42
43 [mq]
43 [mq]
44 git = auto/keep/yes/no
44 git = auto/keep/yes/no
45
45
46 If set to 'keep', mq will obey the [diff] section configuration while
46 If set to 'keep', mq will obey the [diff] section configuration while
47 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
47 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
48 will override the [diff] section and always generate git or regular patches,
48 will override the [diff] section and always generate git or regular patches,
49 possibly losing data in the second case.
49 possibly losing data in the second case.
50
50
51 You will by default be managing a patch queue named "patches". You can create
51 You will by default be managing a patch queue named "patches". You can create
52 other, independent patch queues with the "hg qqueue" command.
52 other, independent patch queues with the "hg qqueue" command.
53
53
54 list of commands:
54 list of commands:
55
55
56 qapplied print the patches already applied
56 qapplied print the patches already applied
57 qclone clone main and patch repository at same time
57 qclone clone main and patch repository at same time
58 qdelete remove patches from queue
58 qdelete remove patches from queue
59 qdiff diff of the current patch and subsequent modifications
59 qdiff diff of the current patch and subsequent modifications
60 qfinish move applied patches into repository history
60 qfinish move applied patches into repository history
61 qfold fold the named patches into the current patch
61 qfold fold the named patches into the current patch
62 qgoto push or pop patches until named patch is at top of stack
62 qgoto push or pop patches until named patch is at top of stack
63 qguard set or print guards for a patch
63 qguard set or print guards for a patch
64 qheader print the header of the topmost or specified patch
64 qheader print the header of the topmost or specified patch
65 qimport import a patch
65 qimport import a patch
66 qnew create a new patch
66 qnew create a new patch
67 qnext print the name of the next patch
67 qnext print the name of the next patch
68 qpop pop the current patch off the stack
68 qpop pop the current patch off the stack
69 qprev print the name of the previous patch
69 qprev print the name of the previous patch
70 qpush push the next patch onto the stack
70 qpush push the next patch onto the stack
71 qqueue manage multiple patch queues
71 qqueue manage multiple patch queues
72 qrefresh update the current patch
72 qrefresh update the current patch
73 qrename rename a patch
73 qrename rename a patch
74 qselect set or print guarded patches to push
74 qselect set or print guarded patches to push
75 qseries print the entire series file
75 qseries print the entire series file
76 qtop print the name of the current patch
76 qtop print the name of the current patch
77 qunapplied print the patches not yet applied
77 qunapplied print the patches not yet applied
78 strip strip changesets and all their descendants from the repository
78 strip strip changesets and all their descendants from the repository
79
79
80 use "hg -v help mq" to show builtin aliases and global options
80 use "hg -v help mq" to show builtin aliases and global options
81
81
82 $ hg init a
82 $ hg init a
83 $ cd a
83 $ cd a
84 $ echo a > a
84 $ echo a > a
85 $ hg ci -Ama
85 $ hg ci -Ama
86 adding a
86 adding a
87
87
88 $ hg clone . ../k
88 $ hg clone . ../k
89 updating to branch default
89 updating to branch default
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91
91
92 $ mkdir b
92 $ mkdir b
93 $ echo z > b/z
93 $ echo z > b/z
94 $ hg ci -Ama
94 $ hg ci -Ama
95 adding b/z
95 adding b/z
96
96
97
97
98 qinit
98 qinit
99
99
100 $ hg qinit
100 $ hg qinit
101
101
102 $ cd ..
102 $ cd ..
103 $ hg init b
103 $ hg init b
104
104
105
105
106 -R qinit
106 -R qinit
107
107
108 $ hg -R b qinit
108 $ hg -R b qinit
109
109
110 $ hg init c
110 $ hg init c
111
111
112
112
113 qinit -c
113 qinit -c
114
114
115 $ hg --cwd c qinit -c
115 $ hg --cwd c qinit -c
116 $ hg -R c/.hg/patches st
116 $ hg -R c/.hg/patches st
117 A .hgignore
117 A .hgignore
118 A series
118 A series
119
119
120
120
121 qinit; qinit -c
121 qinit; qinit -c
122
122
123 $ hg init d
123 $ hg init d
124 $ cd d
124 $ cd d
125 $ hg qinit
125 $ hg qinit
126 $ hg qinit -c
126 $ hg qinit -c
127
127
128 qinit -c should create both files if they don't exist
128 qinit -c should create both files if they don't exist
129
129
130 $ cat .hg/patches/.hgignore
130 $ cat .hg/patches/.hgignore
131 ^\.hg
131 ^\.hg
132 ^\.mq
132 ^\.mq
133 syntax: glob
133 syntax: glob
134 status
134 status
135 guards
135 guards
136 $ cat .hg/patches/series
136 $ cat .hg/patches/series
137 $ hg qinit -c
137 $ hg qinit -c
138 abort: repository $TESTTMP/d/.hg/patches already exists!
138 abort: repository $TESTTMP/d/.hg/patches already exists!
139 [255]
139 [255]
140 $ cd ..
140 $ cd ..
141
141
142 $ echo '% qinit; <stuff>; qinit -c'
142 $ echo '% qinit; <stuff>; qinit -c'
143 % qinit; <stuff>; qinit -c
143 % qinit; <stuff>; qinit -c
144 $ hg init e
144 $ hg init e
145 $ cd e
145 $ cd e
146 $ hg qnew A
146 $ hg qnew A
147 $ checkundo qnew
147 $ checkundo qnew
148 $ echo foo > foo
148 $ echo foo > foo
149 $ hg add foo
149 $ hg add foo
150 $ hg qrefresh
150 $ hg qrefresh
151 $ hg qnew B
151 $ hg qnew B
152 $ echo >> foo
152 $ echo >> foo
153 $ hg qrefresh
153 $ hg qrefresh
154 $ echo status >> .hg/patches/.hgignore
154 $ echo status >> .hg/patches/.hgignore
155 $ echo bleh >> .hg/patches/.hgignore
155 $ echo bleh >> .hg/patches/.hgignore
156 $ hg qinit -c
156 $ hg qinit -c
157 adding .hg/patches/A
157 adding .hg/patches/A
158 adding .hg/patches/B
158 adding .hg/patches/B
159 $ hg -R .hg/patches status
159 $ hg -R .hg/patches status
160 A .hgignore
160 A .hgignore
161 A A
161 A A
162 A B
162 A B
163 A series
163 A series
164
164
165 qinit -c shouldn't touch these files if they already exist
165 qinit -c shouldn't touch these files if they already exist
166
166
167 $ cat .hg/patches/.hgignore
167 $ cat .hg/patches/.hgignore
168 status
168 status
169 bleh
169 bleh
170 $ cat .hg/patches/series
170 $ cat .hg/patches/series
171 A
171 A
172 B
172 B
173
173
174 add an untracked file
174 add an untracked file
175
175
176 $ echo >> .hg/patches/flaf
176 $ echo >> .hg/patches/flaf
177
177
178 status --mq with color (issue2096)
178 status --mq with color (issue2096)
179
179
180 $ hg status --mq --config extensions.color= --color=always
180 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
181 \x1b[0;32;1mA .hgignore\x1b[0m (esc)
181 \x1b[0;32;1mA .hgignore\x1b[0m (esc)
182 \x1b[0;32;1mA A\x1b[0m (esc)
182 \x1b[0;32;1mA A\x1b[0m (esc)
183 \x1b[0;32;1mA B\x1b[0m (esc)
183 \x1b[0;32;1mA B\x1b[0m (esc)
184 \x1b[0;32;1mA series\x1b[0m (esc)
184 \x1b[0;32;1mA series\x1b[0m (esc)
185 \x1b[0;35;1;4m? flaf\x1b[0m (esc)
185 \x1b[0;35;1;4m? flaf\x1b[0m (esc)
186
186
187 try the --mq option on a command provided by an extension
187 try the --mq option on a command provided by an extension
188
188
189 $ hg purge --mq --verbose --config extensions.purge=
189 $ hg purge --mq --verbose --config extensions.purge=
190 Removing file flaf
190 Removing file flaf
191
191
192 $ cd ..
192 $ cd ..
193
193
194 init --mq without repo
194 init --mq without repo
195
195
196 $ mkdir f
196 $ mkdir f
197 $ cd f
197 $ cd f
198 $ hg init --mq
198 $ hg init --mq
199 abort: there is no Mercurial repository here (.hg not found)
199 abort: there is no Mercurial repository here (.hg not found)
200 [255]
200 [255]
201 $ cd ..
201 $ cd ..
202
202
203 init --mq with repo path
203 init --mq with repo path
204
204
205 $ hg init g
205 $ hg init g
206 $ hg init --mq g
206 $ hg init --mq g
207 $ test -d g/.hg/patches/.hg
207 $ test -d g/.hg/patches/.hg
208
208
209 init --mq with nonexistent directory
209 init --mq with nonexistent directory
210
210
211 $ hg init --mq nonexistentdir
211 $ hg init --mq nonexistentdir
212 abort: repository nonexistentdir not found!
212 abort: repository nonexistentdir not found!
213 [255]
213 [255]
214
214
215
215
216 init --mq with bundle (non "local")
216 init --mq with bundle (non "local")
217
217
218 $ hg -R a bundle --all a.bundle >/dev/null
218 $ hg -R a bundle --all a.bundle >/dev/null
219 $ hg init --mq a.bundle
219 $ hg init --mq a.bundle
220 abort: only a local queue repository may be initialized
220 abort: only a local queue repository may be initialized
221 [255]
221 [255]
222
222
223 $ cd a
223 $ cd a
224
224
225 $ hg qnew -m 'foo bar' test.patch
225 $ hg qnew -m 'foo bar' test.patch
226
226
227 $ echo '# comment' > .hg/patches/series.tmp
227 $ echo '# comment' > .hg/patches/series.tmp
228 $ echo >> .hg/patches/series.tmp # empty line
228 $ echo >> .hg/patches/series.tmp # empty line
229 $ cat .hg/patches/series >> .hg/patches/series.tmp
229 $ cat .hg/patches/series >> .hg/patches/series.tmp
230 $ mv .hg/patches/series.tmp .hg/patches/series
230 $ mv .hg/patches/series.tmp .hg/patches/series
231
231
232
232
233 qrefresh
233 qrefresh
234
234
235 $ echo a >> a
235 $ echo a >> a
236 $ hg qrefresh
236 $ hg qrefresh
237 $ cat .hg/patches/test.patch
237 $ cat .hg/patches/test.patch
238 foo bar
238 foo bar
239
239
240 diff -r [a-f0-9]* a (re)
240 diff -r [a-f0-9]* a (re)
241 --- a/a\t(?P<date>.*) (re)
241 --- a/a\t(?P<date>.*) (re)
242 \+\+\+ b/a\t(?P<date2>.*) (re)
242 \+\+\+ b/a\t(?P<date2>.*) (re)
243 @@ -1,1 +1,2 @@
243 @@ -1,1 +1,2 @@
244 a
244 a
245 +a
245 +a
246
246
247 empty qrefresh
247 empty qrefresh
248
248
249 $ hg qrefresh -X a
249 $ hg qrefresh -X a
250
250
251 revision:
251 revision:
252
252
253 $ hg diff -r -2 -r -1
253 $ hg diff -r -2 -r -1
254
254
255 patch:
255 patch:
256
256
257 $ cat .hg/patches/test.patch
257 $ cat .hg/patches/test.patch
258 foo bar
258 foo bar
259
259
260
260
261 working dir diff:
261 working dir diff:
262
262
263 $ hg diff --nodates -q
263 $ hg diff --nodates -q
264 --- a/a
264 --- a/a
265 +++ b/a
265 +++ b/a
266 @@ -1,1 +1,2 @@
266 @@ -1,1 +1,2 @@
267 a
267 a
268 +a
268 +a
269
269
270 restore things
270 restore things
271
271
272 $ hg qrefresh
272 $ hg qrefresh
273 $ checkundo qrefresh
273 $ checkundo qrefresh
274
274
275
275
276 qpop
276 qpop
277
277
278 $ hg qpop
278 $ hg qpop
279 popping test.patch
279 popping test.patch
280 patch queue now empty
280 patch queue now empty
281 $ checkundo qpop
281 $ checkundo qpop
282
282
283
283
284 qpush with dump of tag cache
284 qpush with dump of tag cache
285 Dump the tag cache to ensure that it has exactly one head after qpush.
285 Dump the tag cache to ensure that it has exactly one head after qpush.
286
286
287 $ rm -f .hg/cache/tags
287 $ rm -f .hg/cache/tags
288 $ hg tags > /dev/null
288 $ hg tags > /dev/null
289
289
290 .hg/cache/tags (pre qpush):
290 .hg/cache/tags (pre qpush):
291
291
292 $ cat .hg/cache/tags
292 $ cat .hg/cache/tags
293 1 [\da-f]{40} (re)
293 1 [\da-f]{40} (re)
294
294
295 $ hg qpush
295 $ hg qpush
296 applying test.patch
296 applying test.patch
297 now at: test.patch
297 now at: test.patch
298 $ hg tags > /dev/null
298 $ hg tags > /dev/null
299
299
300 .hg/cache/tags (post qpush):
300 .hg/cache/tags (post qpush):
301
301
302 $ cat .hg/cache/tags
302 $ cat .hg/cache/tags
303 2 [\da-f]{40} (re)
303 2 [\da-f]{40} (re)
304
304
305 $ checkundo qpush
305 $ checkundo qpush
306 $ cd ..
306 $ cd ..
307
307
308
308
309 pop/push outside repo
309 pop/push outside repo
310 $ hg -R a qpop
310 $ hg -R a qpop
311 popping test.patch
311 popping test.patch
312 patch queue now empty
312 patch queue now empty
313 $ hg -R a qpush
313 $ hg -R a qpush
314 applying test.patch
314 applying test.patch
315 now at: test.patch
315 now at: test.patch
316
316
317 $ cd a
317 $ cd a
318 $ hg qnew test2.patch
318 $ hg qnew test2.patch
319
319
320 qrefresh in subdir
320 qrefresh in subdir
321
321
322 $ cd b
322 $ cd b
323 $ echo a > a
323 $ echo a > a
324 $ hg add a
324 $ hg add a
325 $ hg qrefresh
325 $ hg qrefresh
326
326
327 pop/push -a in subdir
327 pop/push -a in subdir
328
328
329 $ hg qpop -a
329 $ hg qpop -a
330 popping test2.patch
330 popping test2.patch
331 popping test.patch
331 popping test.patch
332 patch queue now empty
332 patch queue now empty
333 $ hg --traceback qpush -a
333 $ hg --traceback qpush -a
334 applying test.patch
334 applying test.patch
335 applying test2.patch
335 applying test2.patch
336 now at: test2.patch
336 now at: test2.patch
337
337
338
338
339 setting columns & formatted tests truncating (issue1912)
339 setting columns & formatted tests truncating (issue1912)
340
340
341 $ COLUMNS=4 hg qseries --config ui.formatted=true
341 $ COLUMNS=4 hg qseries --config ui.formatted=true
342 test.patch
342 test.patch
343 test2.patch
343 test2.patch
344 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
344 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
345 0 A test.patch: f...
345 0 A test.patch: f...
346 1 A test2.patch:
346 1 A test2.patch:
347 $ hg qpop
347 $ hg qpop
348 popping test2.patch
348 popping test2.patch
349 now at: test.patch
349 now at: test.patch
350 $ hg qseries -vs
350 $ hg qseries -vs
351 0 A test.patch: foo bar
351 0 A test.patch: foo bar
352 1 U test2.patch:
352 1 U test2.patch:
353 $ hg sum | grep mq
353 $ hg sum | grep mq
354 mq: 1 applied, 1 unapplied
354 mq: 1 applied, 1 unapplied
355 $ hg qpush
355 $ hg qpush
356 applying test2.patch
356 applying test2.patch
357 now at: test2.patch
357 now at: test2.patch
358 $ hg sum | grep mq
358 $ hg sum | grep mq
359 mq: 2 applied
359 mq: 2 applied
360 $ hg qapplied
360 $ hg qapplied
361 test.patch
361 test.patch
362 test2.patch
362 test2.patch
363 $ hg qtop
363 $ hg qtop
364 test2.patch
364 test2.patch
365
365
366
366
367 prev
367 prev
368
368
369 $ hg qapp -1
369 $ hg qapp -1
370 test.patch
370 test.patch
371
371
372 next
372 next
373
373
374 $ hg qunapp -1
374 $ hg qunapp -1
375 all patches applied
375 all patches applied
376 [1]
376 [1]
377
377
378 $ hg qpop
378 $ hg qpop
379 popping test2.patch
379 popping test2.patch
380 now at: test.patch
380 now at: test.patch
381
381
382 commit should fail
382 commit should fail
383
383
384 $ hg commit
384 $ hg commit
385 abort: cannot commit over an applied mq patch
385 abort: cannot commit over an applied mq patch
386 [255]
386 [255]
387
387
388 push should fail
388 push should fail
389
389
390 $ hg push ../../k
390 $ hg push ../../k
391 pushing to ../../k
391 pushing to ../../k
392 abort: source has mq patches applied
392 abort: source has mq patches applied
393 [255]
393 [255]
394
394
395
395
396 import should fail
396 import should fail
397
397
398 $ hg st .
398 $ hg st .
399 $ echo foo >> ../a
399 $ echo foo >> ../a
400 $ hg diff > ../../import.diff
400 $ hg diff > ../../import.diff
401 $ hg revert --no-backup ../a
401 $ hg revert --no-backup ../a
402 $ hg import ../../import.diff
402 $ hg import ../../import.diff
403 abort: cannot import over an applied patch
403 abort: cannot import over an applied patch
404 [255]
404 [255]
405 $ hg st
405 $ hg st
406
406
407 import --no-commit should succeed
407 import --no-commit should succeed
408
408
409 $ hg import --no-commit ../../import.diff
409 $ hg import --no-commit ../../import.diff
410 applying ../../import.diff
410 applying ../../import.diff
411 $ hg st
411 $ hg st
412 M a
412 M a
413 $ hg revert --no-backup ../a
413 $ hg revert --no-backup ../a
414
414
415
415
416 qunapplied
416 qunapplied
417
417
418 $ hg qunapplied
418 $ hg qunapplied
419 test2.patch
419 test2.patch
420
420
421
421
422 qpush/qpop with index
422 qpush/qpop with index
423
423
424 $ hg qnew test1b.patch
424 $ hg qnew test1b.patch
425 $ echo 1b > 1b
425 $ echo 1b > 1b
426 $ hg add 1b
426 $ hg add 1b
427 $ hg qrefresh
427 $ hg qrefresh
428 $ hg qpush 2
428 $ hg qpush 2
429 applying test2.patch
429 applying test2.patch
430 now at: test2.patch
430 now at: test2.patch
431 $ hg qpop 0
431 $ hg qpop 0
432 popping test2.patch
432 popping test2.patch
433 popping test1b.patch
433 popping test1b.patch
434 now at: test.patch
434 now at: test.patch
435 $ hg qpush test.patch+1
435 $ hg qpush test.patch+1
436 applying test1b.patch
436 applying test1b.patch
437 now at: test1b.patch
437 now at: test1b.patch
438 $ hg qpush test.patch+2
438 $ hg qpush test.patch+2
439 applying test2.patch
439 applying test2.patch
440 now at: test2.patch
440 now at: test2.patch
441 $ hg qpop test2.patch-1
441 $ hg qpop test2.patch-1
442 popping test2.patch
442 popping test2.patch
443 now at: test1b.patch
443 now at: test1b.patch
444 $ hg qpop test2.patch-2
444 $ hg qpop test2.patch-2
445 popping test1b.patch
445 popping test1b.patch
446 now at: test.patch
446 now at: test.patch
447 $ hg qpush test1b.patch+1
447 $ hg qpush test1b.patch+1
448 applying test1b.patch
448 applying test1b.patch
449 applying test2.patch
449 applying test2.patch
450 now at: test2.patch
450 now at: test2.patch
451
451
452
452
453 qpush --move
453 qpush --move
454
454
455 $ hg qpop -a
455 $ hg qpop -a
456 popping test2.patch
456 popping test2.patch
457 popping test1b.patch
457 popping test1b.patch
458 popping test.patch
458 popping test.patch
459 patch queue now empty
459 patch queue now empty
460 $ hg qguard test1b.patch -- -negguard
460 $ hg qguard test1b.patch -- -negguard
461 $ hg qguard test2.patch -- +posguard
461 $ hg qguard test2.patch -- +posguard
462 $ hg qpush --move test2.patch # can't move guarded patch
462 $ hg qpush --move test2.patch # can't move guarded patch
463 cannot push 'test2.patch' - guarded by ['+posguard']
463 cannot push 'test2.patch' - guarded by ['+posguard']
464 [1]
464 [1]
465 $ hg qselect posguard
465 $ hg qselect posguard
466 number of unguarded, unapplied patches has changed from 2 to 3
466 number of unguarded, unapplied patches has changed from 2 to 3
467 $ hg qpush --move test2.patch # move to front
467 $ hg qpush --move test2.patch # move to front
468 applying test2.patch
468 applying test2.patch
469 now at: test2.patch
469 now at: test2.patch
470 $ hg qpush --move test1b.patch # negative guard unselected
470 $ hg qpush --move test1b.patch # negative guard unselected
471 applying test1b.patch
471 applying test1b.patch
472 now at: test1b.patch
472 now at: test1b.patch
473 $ hg qpush --move test.patch # noop move
473 $ hg qpush --move test.patch # noop move
474 applying test.patch
474 applying test.patch
475 now at: test.patch
475 now at: test.patch
476 $ hg qseries -v
476 $ hg qseries -v
477 0 A test2.patch
477 0 A test2.patch
478 1 A test1b.patch
478 1 A test1b.patch
479 2 A test.patch
479 2 A test.patch
480 $ hg qpop -a
480 $ hg qpop -a
481 popping test.patch
481 popping test.patch
482 popping test1b.patch
482 popping test1b.patch
483 popping test2.patch
483 popping test2.patch
484 patch queue now empty
484 patch queue now empty
485
485
486 cleaning up
486 cleaning up
487
487
488 $ hg qselect --none
488 $ hg qselect --none
489 guards deactivated
489 guards deactivated
490 number of unguarded, unapplied patches has changed from 3 to 2
490 number of unguarded, unapplied patches has changed from 3 to 2
491 $ hg qguard --none test1b.patch
491 $ hg qguard --none test1b.patch
492 $ hg qguard --none test2.patch
492 $ hg qguard --none test2.patch
493 $ hg qpush --move test.patch
493 $ hg qpush --move test.patch
494 applying test.patch
494 applying test.patch
495 now at: test.patch
495 now at: test.patch
496 $ hg qpush --move test1b.patch
496 $ hg qpush --move test1b.patch
497 applying test1b.patch
497 applying test1b.patch
498 now at: test1b.patch
498 now at: test1b.patch
499 $ hg qpush --move bogus # nonexistent patch
499 $ hg qpush --move bogus # nonexistent patch
500 abort: patch bogus not in series
500 abort: patch bogus not in series
501 [255]
501 [255]
502 $ hg qpush --move # no patch
502 $ hg qpush --move # no patch
503 abort: please specify the patch to move
503 abort: please specify the patch to move
504 [255]
504 [255]
505 $ hg qpush --move test.patch # already applied
505 $ hg qpush --move test.patch # already applied
506 abort: cannot push to a previous patch: test.patch
506 abort: cannot push to a previous patch: test.patch
507 [255]
507 [255]
508 $ hg qpush
508 $ hg qpush
509 applying test2.patch
509 applying test2.patch
510 now at: test2.patch
510 now at: test2.patch
511
511
512
512
513 series after move
513 series after move
514
514
515 $ cat `hg root`/.hg/patches/series
515 $ cat `hg root`/.hg/patches/series
516 test.patch
516 test.patch
517 test1b.patch
517 test1b.patch
518 test2.patch
518 test2.patch
519 # comment
519 # comment
520
520
521
521
522
522
523 pop, qapplied, qunapplied
523 pop, qapplied, qunapplied
524
524
525 $ hg qseries -v
525 $ hg qseries -v
526 0 A test.patch
526 0 A test.patch
527 1 A test1b.patch
527 1 A test1b.patch
528 2 A test2.patch
528 2 A test2.patch
529
529
530 qapplied -1 test.patch
530 qapplied -1 test.patch
531
531
532 $ hg qapplied -1 test.patch
532 $ hg qapplied -1 test.patch
533 only one patch applied
533 only one patch applied
534 [1]
534 [1]
535
535
536 qapplied -1 test1b.patch
536 qapplied -1 test1b.patch
537
537
538 $ hg qapplied -1 test1b.patch
538 $ hg qapplied -1 test1b.patch
539 test.patch
539 test.patch
540
540
541 qapplied -1 test2.patch
541 qapplied -1 test2.patch
542
542
543 $ hg qapplied -1 test2.patch
543 $ hg qapplied -1 test2.patch
544 test1b.patch
544 test1b.patch
545
545
546 qapplied -1
546 qapplied -1
547
547
548 $ hg qapplied -1
548 $ hg qapplied -1
549 test1b.patch
549 test1b.patch
550
550
551 qapplied
551 qapplied
552
552
553 $ hg qapplied
553 $ hg qapplied
554 test.patch
554 test.patch
555 test1b.patch
555 test1b.patch
556 test2.patch
556 test2.patch
557
557
558 qapplied test1b.patch
558 qapplied test1b.patch
559
559
560 $ hg qapplied test1b.patch
560 $ hg qapplied test1b.patch
561 test.patch
561 test.patch
562 test1b.patch
562 test1b.patch
563
563
564 qunapplied -1
564 qunapplied -1
565
565
566 $ hg qunapplied -1
566 $ hg qunapplied -1
567 all patches applied
567 all patches applied
568 [1]
568 [1]
569
569
570 qunapplied
570 qunapplied
571
571
572 $ hg qunapplied
572 $ hg qunapplied
573
573
574 popping
574 popping
575
575
576 $ hg qpop
576 $ hg qpop
577 popping test2.patch
577 popping test2.patch
578 now at: test1b.patch
578 now at: test1b.patch
579
579
580 qunapplied -1
580 qunapplied -1
581
581
582 $ hg qunapplied -1
582 $ hg qunapplied -1
583 test2.patch
583 test2.patch
584
584
585 qunapplied
585 qunapplied
586
586
587 $ hg qunapplied
587 $ hg qunapplied
588 test2.patch
588 test2.patch
589
589
590 qunapplied test2.patch
590 qunapplied test2.patch
591
591
592 $ hg qunapplied test2.patch
592 $ hg qunapplied test2.patch
593
593
594 qunapplied -1 test2.patch
594 qunapplied -1 test2.patch
595
595
596 $ hg qunapplied -1 test2.patch
596 $ hg qunapplied -1 test2.patch
597 all patches applied
597 all patches applied
598 [1]
598 [1]
599
599
600 popping -a
600 popping -a
601
601
602 $ hg qpop -a
602 $ hg qpop -a
603 popping test1b.patch
603 popping test1b.patch
604 popping test.patch
604 popping test.patch
605 patch queue now empty
605 patch queue now empty
606
606
607 qapplied
607 qapplied
608
608
609 $ hg qapplied
609 $ hg qapplied
610
610
611 qapplied -1
611 qapplied -1
612
612
613 $ hg qapplied -1
613 $ hg qapplied -1
614 no patches applied
614 no patches applied
615 [1]
615 [1]
616 $ hg qpush
616 $ hg qpush
617 applying test.patch
617 applying test.patch
618 now at: test.patch
618 now at: test.patch
619
619
620
620
621 push should succeed
621 push should succeed
622
622
623 $ hg qpop -a
623 $ hg qpop -a
624 popping test.patch
624 popping test.patch
625 patch queue now empty
625 patch queue now empty
626 $ hg push ../../k
626 $ hg push ../../k
627 pushing to ../../k
627 pushing to ../../k
628 searching for changes
628 searching for changes
629 adding changesets
629 adding changesets
630 adding manifests
630 adding manifests
631 adding file changes
631 adding file changes
632 added 1 changesets with 1 changes to 1 files
632 added 1 changesets with 1 changes to 1 files
633
633
634
634
635 we want to start with some patches applied
635 we want to start with some patches applied
636
636
637 $ hg qpush -a
637 $ hg qpush -a
638 applying test.patch
638 applying test.patch
639 applying test1b.patch
639 applying test1b.patch
640 applying test2.patch
640 applying test2.patch
641 now at: test2.patch
641 now at: test2.patch
642
642
643 % pops all patches and succeeds
643 % pops all patches and succeeds
644
644
645 $ hg qpop -a
645 $ hg qpop -a
646 popping test2.patch
646 popping test2.patch
647 popping test1b.patch
647 popping test1b.patch
648 popping test.patch
648 popping test.patch
649 patch queue now empty
649 patch queue now empty
650
650
651 % does nothing and succeeds
651 % does nothing and succeeds
652
652
653 $ hg qpop -a
653 $ hg qpop -a
654 no patches applied
654 no patches applied
655
655
656 % fails - nothing else to pop
656 % fails - nothing else to pop
657
657
658 $ hg qpop
658 $ hg qpop
659 no patches applied
659 no patches applied
660 [1]
660 [1]
661
661
662 % pushes a patch and succeeds
662 % pushes a patch and succeeds
663
663
664 $ hg qpush
664 $ hg qpush
665 applying test.patch
665 applying test.patch
666 now at: test.patch
666 now at: test.patch
667
667
668 % pops a patch and succeeds
668 % pops a patch and succeeds
669
669
670 $ hg qpop
670 $ hg qpop
671 popping test.patch
671 popping test.patch
672 patch queue now empty
672 patch queue now empty
673
673
674 % pushes up to test1b.patch and succeeds
674 % pushes up to test1b.patch and succeeds
675
675
676 $ hg qpush test1b.patch
676 $ hg qpush test1b.patch
677 applying test.patch
677 applying test.patch
678 applying test1b.patch
678 applying test1b.patch
679 now at: test1b.patch
679 now at: test1b.patch
680
680
681 % does nothing and succeeds
681 % does nothing and succeeds
682
682
683 $ hg qpush test1b.patch
683 $ hg qpush test1b.patch
684 qpush: test1b.patch is already at the top
684 qpush: test1b.patch is already at the top
685
685
686 % does nothing and succeeds
686 % does nothing and succeeds
687
687
688 $ hg qpop test1b.patch
688 $ hg qpop test1b.patch
689 qpop: test1b.patch is already at the top
689 qpop: test1b.patch is already at the top
690
690
691 % fails - can't push to this patch
691 % fails - can't push to this patch
692
692
693 $ hg qpush test.patch
693 $ hg qpush test.patch
694 abort: cannot push to a previous patch: test.patch
694 abort: cannot push to a previous patch: test.patch
695 [255]
695 [255]
696
696
697 % fails - can't pop to this patch
697 % fails - can't pop to this patch
698
698
699 $ hg qpop test2.patch
699 $ hg qpop test2.patch
700 abort: patch test2.patch is not applied
700 abort: patch test2.patch is not applied
701 [255]
701 [255]
702
702
703 % pops up to test.patch and succeeds
703 % pops up to test.patch and succeeds
704
704
705 $ hg qpop test.patch
705 $ hg qpop test.patch
706 popping test1b.patch
706 popping test1b.patch
707 now at: test.patch
707 now at: test.patch
708
708
709 % pushes all patches and succeeds
709 % pushes all patches and succeeds
710
710
711 $ hg qpush -a
711 $ hg qpush -a
712 applying test1b.patch
712 applying test1b.patch
713 applying test2.patch
713 applying test2.patch
714 now at: test2.patch
714 now at: test2.patch
715
715
716 % does nothing and succeeds
716 % does nothing and succeeds
717
717
718 $ hg qpush -a
718 $ hg qpush -a
719 all patches are currently applied
719 all patches are currently applied
720
720
721 % fails - nothing else to push
721 % fails - nothing else to push
722
722
723 $ hg qpush
723 $ hg qpush
724 patch series already fully applied
724 patch series already fully applied
725 [1]
725 [1]
726
726
727 % does nothing and succeeds
727 % does nothing and succeeds
728
728
729 $ hg qpush test2.patch
729 $ hg qpush test2.patch
730 qpush: test2.patch is already at the top
730 qpush: test2.patch is already at the top
731
731
732 strip
732 strip
733
733
734 $ cd ../../b
734 $ cd ../../b
735 $ echo x>x
735 $ echo x>x
736 $ hg ci -Ama
736 $ hg ci -Ama
737 adding x
737 adding x
738 $ hg strip tip
738 $ hg strip tip
739 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
739 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
740 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
740 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
741 $ hg unbundle .hg/strip-backup/*
741 $ hg unbundle .hg/strip-backup/*
742 adding changesets
742 adding changesets
743 adding manifests
743 adding manifests
744 adding file changes
744 adding file changes
745 added 1 changesets with 1 changes to 1 files
745 added 1 changesets with 1 changes to 1 files
746 (run 'hg update' to get a working copy)
746 (run 'hg update' to get a working copy)
747
747
748
748
749 strip with local changes, should complain
749 strip with local changes, should complain
750
750
751 $ hg up
751 $ hg up
752 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
752 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
753 $ echo y>y
753 $ echo y>y
754 $ hg add y
754 $ hg add y
755 $ hg strip tip
755 $ hg strip tip
756 abort: local changes found
756 abort: local changes found
757 [255]
757 [255]
758
758
759 --force strip with local changes
759 --force strip with local changes
760
760
761 $ hg strip -f tip
761 $ hg strip -f tip
762 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
762 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
763 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
763 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
764
764
765
765
766 cd b; hg qrefresh
766 cd b; hg qrefresh
767
767
768 $ hg init refresh
768 $ hg init refresh
769 $ cd refresh
769 $ cd refresh
770 $ echo a > a
770 $ echo a > a
771 $ hg ci -Ama
771 $ hg ci -Ama
772 adding a
772 adding a
773 $ hg qnew -mfoo foo
773 $ hg qnew -mfoo foo
774 $ echo a >> a
774 $ echo a >> a
775 $ hg qrefresh
775 $ hg qrefresh
776 $ mkdir b
776 $ mkdir b
777 $ cd b
777 $ cd b
778 $ echo f > f
778 $ echo f > f
779 $ hg add f
779 $ hg add f
780 $ hg qrefresh
780 $ hg qrefresh
781 $ cat ../.hg/patches/foo
781 $ cat ../.hg/patches/foo
782 foo
782 foo
783
783
784 diff -r cb9a9f314b8b a
784 diff -r cb9a9f314b8b a
785 --- a/a\t(?P<date>.*) (re)
785 --- a/a\t(?P<date>.*) (re)
786 \+\+\+ b/a\t(?P<date>.*) (re)
786 \+\+\+ b/a\t(?P<date>.*) (re)
787 @@ -1,1 +1,2 @@
787 @@ -1,1 +1,2 @@
788 a
788 a
789 +a
789 +a
790 diff -r cb9a9f314b8b b/f
790 diff -r cb9a9f314b8b b/f
791 --- /dev/null\t(?P<date>.*) (re)
791 --- /dev/null\t(?P<date>.*) (re)
792 \+\+\+ b/b/f\t(?P<date>.*) (re)
792 \+\+\+ b/b/f\t(?P<date>.*) (re)
793 @@ -0,0 +1,1 @@
793 @@ -0,0 +1,1 @@
794 +f
794 +f
795
795
796 hg qrefresh .
796 hg qrefresh .
797
797
798 $ hg qrefresh .
798 $ hg qrefresh .
799 $ cat ../.hg/patches/foo
799 $ cat ../.hg/patches/foo
800 foo
800 foo
801
801
802 diff -r cb9a9f314b8b b/f
802 diff -r cb9a9f314b8b b/f
803 --- /dev/null\t(?P<date>.*) (re)
803 --- /dev/null\t(?P<date>.*) (re)
804 \+\+\+ b/b/f\t(?P<date>.*) (re)
804 \+\+\+ b/b/f\t(?P<date>.*) (re)
805 @@ -0,0 +1,1 @@
805 @@ -0,0 +1,1 @@
806 +f
806 +f
807 $ hg status
807 $ hg status
808 M a
808 M a
809
809
810
810
811 qpush failure
811 qpush failure
812
812
813 $ cd ..
813 $ cd ..
814 $ hg qrefresh
814 $ hg qrefresh
815 $ hg qnew -mbar bar
815 $ hg qnew -mbar bar
816 $ echo foo > foo
816 $ echo foo > foo
817 $ echo bar > bar
817 $ echo bar > bar
818 $ hg add foo bar
818 $ hg add foo bar
819 $ hg qrefresh
819 $ hg qrefresh
820 $ hg qpop -a
820 $ hg qpop -a
821 popping bar
821 popping bar
822 popping foo
822 popping foo
823 patch queue now empty
823 patch queue now empty
824 $ echo bar > foo
824 $ echo bar > foo
825 $ hg qpush -a
825 $ hg qpush -a
826 applying foo
826 applying foo
827 applying bar
827 applying bar
828 file foo already exists
828 file foo already exists
829 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
829 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
830 patch failed, unable to continue (try -v)
830 patch failed, unable to continue (try -v)
831 patch failed, rejects left in working dir
831 patch failed, rejects left in working dir
832 errors during apply, please fix and refresh bar
832 errors during apply, please fix and refresh bar
833 [2]
833 [2]
834 $ hg st
834 $ hg st
835 ? foo
835 ? foo
836 ? foo.rej
836 ? foo.rej
837
837
838
838
839 mq tags
839 mq tags
840
840
841 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
841 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
842 0 qparent
842 0 qparent
843 1 foo qbase
843 1 foo qbase
844 2 bar qtip tip
844 2 bar qtip tip
845
845
846
846
847 bad node in status
847 bad node in status
848
848
849 $ hg qpop
849 $ hg qpop
850 popping bar
850 popping bar
851 now at: foo
851 now at: foo
852 $ hg strip -qn tip
852 $ hg strip -qn tip
853 $ hg tip
853 $ hg tip
854 changeset: 0:cb9a9f314b8b
854 changeset: 0:cb9a9f314b8b
855 tag: tip
855 tag: tip
856 user: test
856 user: test
857 date: Thu Jan 01 00:00:00 1970 +0000
857 date: Thu Jan 01 00:00:00 1970 +0000
858 summary: a
858 summary: a
859
859
860 $ hg branches
860 $ hg branches
861 default 0:cb9a9f314b8b
861 default 0:cb9a9f314b8b
862 $ hg qpop
862 $ hg qpop
863 no patches applied
863 no patches applied
864 [1]
864 [1]
865
865
866 $ cat >>$HGRCPATH <<EOF
866 $ cat >>$HGRCPATH <<EOF
867 > [diff]
867 > [diff]
868 > git = True
868 > git = True
869 > EOF
869 > EOF
870 $ cd ..
870 $ cd ..
871 $ hg init git
871 $ hg init git
872 $ cd git
872 $ cd git
873 $ hg qinit
873 $ hg qinit
874
874
875 $ hg qnew -m'new file' new
875 $ hg qnew -m'new file' new
876 $ echo foo > new
876 $ echo foo > new
877 $ chmod +x new
877 $ chmod +x new
878 $ hg add new
878 $ hg add new
879 $ hg qrefresh
879 $ hg qrefresh
880 $ cat .hg/patches/new
880 $ cat .hg/patches/new
881 new file
881 new file
882
882
883 diff --git a/new b/new
883 diff --git a/new b/new
884 new file mode 100755
884 new file mode 100755
885 --- /dev/null
885 --- /dev/null
886 +++ b/new
886 +++ b/new
887 @@ -0,0 +1,1 @@
887 @@ -0,0 +1,1 @@
888 +foo
888 +foo
889
889
890 $ hg qnew -m'copy file' copy
890 $ hg qnew -m'copy file' copy
891 $ hg cp new copy
891 $ hg cp new copy
892 $ hg qrefresh
892 $ hg qrefresh
893 $ cat .hg/patches/copy
893 $ cat .hg/patches/copy
894 copy file
894 copy file
895
895
896 diff --git a/new b/copy
896 diff --git a/new b/copy
897 copy from new
897 copy from new
898 copy to copy
898 copy to copy
899
899
900 $ hg qpop
900 $ hg qpop
901 popping copy
901 popping copy
902 now at: new
902 now at: new
903 $ hg qpush
903 $ hg qpush
904 applying copy
904 applying copy
905 now at: copy
905 now at: copy
906 $ hg qdiff
906 $ hg qdiff
907 diff --git a/new b/copy
907 diff --git a/new b/copy
908 copy from new
908 copy from new
909 copy to copy
909 copy to copy
910 $ cat >>$HGRCPATH <<EOF
910 $ cat >>$HGRCPATH <<EOF
911 > [diff]
911 > [diff]
912 > git = False
912 > git = False
913 > EOF
913 > EOF
914 $ hg qdiff --git
914 $ hg qdiff --git
915 diff --git a/new b/copy
915 diff --git a/new b/copy
916 copy from new
916 copy from new
917 copy to copy
917 copy to copy
918 $ cd ..
918 $ cd ..
919
919
920 empty lines in status
920 empty lines in status
921
921
922 $ hg init emptystatus
922 $ hg init emptystatus
923 $ cd emptystatus
923 $ cd emptystatus
924 $ hg qinit
924 $ hg qinit
925 $ printf '\n\n' > .hg/patches/status
925 $ printf '\n\n' > .hg/patches/status
926 $ hg qser
926 $ hg qser
927 $ cd ..
927 $ cd ..
928
928
929 bad line in status (without ":")
929 bad line in status (without ":")
930
930
931 $ hg init badstatus
931 $ hg init badstatus
932 $ cd badstatus
932 $ cd badstatus
933 $ hg qinit
933 $ hg qinit
934 $ printf 'babar has no colon in this line\n' > .hg/patches/status
934 $ printf 'babar has no colon in this line\n' > .hg/patches/status
935 $ hg qser
935 $ hg qser
936 malformated mq status line: ['babar has no colon in this line']
936 malformated mq status line: ['babar has no colon in this line']
937 $ cd ..
937 $ cd ..
938
938
939
939
940 test file addition in slow path
940 test file addition in slow path
941
941
942 $ hg init slow
942 $ hg init slow
943 $ cd slow
943 $ cd slow
944 $ hg qinit
944 $ hg qinit
945 $ echo foo > foo
945 $ echo foo > foo
946 $ hg add foo
946 $ hg add foo
947 $ hg ci -m 'add foo'
947 $ hg ci -m 'add foo'
948 $ hg qnew bar
948 $ hg qnew bar
949 $ echo bar > bar
949 $ echo bar > bar
950 $ hg add bar
950 $ hg add bar
951 $ hg mv foo baz
951 $ hg mv foo baz
952 $ hg qrefresh --git
952 $ hg qrefresh --git
953 $ hg up -C 0
953 $ hg up -C 0
954 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
954 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
955 $ echo >> foo
955 $ echo >> foo
956 $ hg ci -m 'change foo'
956 $ hg ci -m 'change foo'
957 created new head
957 created new head
958 $ hg up -C 1
958 $ hg up -C 1
959 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
959 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
960 $ hg qrefresh --git
960 $ hg qrefresh --git
961 $ cat .hg/patches/bar
961 $ cat .hg/patches/bar
962 diff --git a/bar b/bar
962 diff --git a/bar b/bar
963 new file mode 100644
963 new file mode 100644
964 --- /dev/null
964 --- /dev/null
965 +++ b/bar
965 +++ b/bar
966 @@ -0,0 +1,1 @@
966 @@ -0,0 +1,1 @@
967 +bar
967 +bar
968 diff --git a/foo b/baz
968 diff --git a/foo b/baz
969 rename from foo
969 rename from foo
970 rename to baz
970 rename to baz
971 $ hg log -v --template '{rev} {file_copies}\n' -r .
971 $ hg log -v --template '{rev} {file_copies}\n' -r .
972 2 baz (foo)
972 2 baz (foo)
973 $ hg qrefresh --git
973 $ hg qrefresh --git
974 $ cat .hg/patches/bar
974 $ cat .hg/patches/bar
975 diff --git a/bar b/bar
975 diff --git a/bar b/bar
976 new file mode 100644
976 new file mode 100644
977 --- /dev/null
977 --- /dev/null
978 +++ b/bar
978 +++ b/bar
979 @@ -0,0 +1,1 @@
979 @@ -0,0 +1,1 @@
980 +bar
980 +bar
981 diff --git a/foo b/baz
981 diff --git a/foo b/baz
982 rename from foo
982 rename from foo
983 rename to baz
983 rename to baz
984 $ hg log -v --template '{rev} {file_copies}\n' -r .
984 $ hg log -v --template '{rev} {file_copies}\n' -r .
985 2 baz (foo)
985 2 baz (foo)
986 $ hg qrefresh
986 $ hg qrefresh
987 $ grep 'diff --git' .hg/patches/bar
987 $ grep 'diff --git' .hg/patches/bar
988 diff --git a/bar b/bar
988 diff --git a/bar b/bar
989 diff --git a/foo b/baz
989 diff --git a/foo b/baz
990
990
991
991
992 test file move chains in the slow path
992 test file move chains in the slow path
993
993
994 $ hg up -C 1
994 $ hg up -C 1
995 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
995 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
996 $ echo >> foo
996 $ echo >> foo
997 $ hg ci -m 'change foo again'
997 $ hg ci -m 'change foo again'
998 $ hg up -C 2
998 $ hg up -C 2
999 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
999 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1000 $ hg mv bar quux
1000 $ hg mv bar quux
1001 $ hg mv baz bleh
1001 $ hg mv baz bleh
1002 $ hg qrefresh --git
1002 $ hg qrefresh --git
1003 $ cat .hg/patches/bar
1003 $ cat .hg/patches/bar
1004 diff --git a/foo b/bleh
1004 diff --git a/foo b/bleh
1005 rename from foo
1005 rename from foo
1006 rename to bleh
1006 rename to bleh
1007 diff --git a/quux b/quux
1007 diff --git a/quux b/quux
1008 new file mode 100644
1008 new file mode 100644
1009 --- /dev/null
1009 --- /dev/null
1010 +++ b/quux
1010 +++ b/quux
1011 @@ -0,0 +1,1 @@
1011 @@ -0,0 +1,1 @@
1012 +bar
1012 +bar
1013 $ hg log -v --template '{rev} {file_copies}\n' -r .
1013 $ hg log -v --template '{rev} {file_copies}\n' -r .
1014 3 bleh (foo)
1014 3 bleh (foo)
1015 $ hg mv quux fred
1015 $ hg mv quux fred
1016 $ hg mv bleh barney
1016 $ hg mv bleh barney
1017 $ hg qrefresh --git
1017 $ hg qrefresh --git
1018 $ cat .hg/patches/bar
1018 $ cat .hg/patches/bar
1019 diff --git a/foo b/barney
1019 diff --git a/foo b/barney
1020 rename from foo
1020 rename from foo
1021 rename to barney
1021 rename to barney
1022 diff --git a/fred b/fred
1022 diff --git a/fred b/fred
1023 new file mode 100644
1023 new file mode 100644
1024 --- /dev/null
1024 --- /dev/null
1025 +++ b/fred
1025 +++ b/fred
1026 @@ -0,0 +1,1 @@
1026 @@ -0,0 +1,1 @@
1027 +bar
1027 +bar
1028 $ hg log -v --template '{rev} {file_copies}\n' -r .
1028 $ hg log -v --template '{rev} {file_copies}\n' -r .
1029 3 barney (foo)
1029 3 barney (foo)
1030
1030
1031
1031
1032 refresh omitting an added file
1032 refresh omitting an added file
1033
1033
1034 $ hg qnew baz
1034 $ hg qnew baz
1035 $ echo newfile > newfile
1035 $ echo newfile > newfile
1036 $ hg add newfile
1036 $ hg add newfile
1037 $ hg qrefresh
1037 $ hg qrefresh
1038 $ hg st -A newfile
1038 $ hg st -A newfile
1039 C newfile
1039 C newfile
1040 $ hg qrefresh -X newfile
1040 $ hg qrefresh -X newfile
1041 $ hg st -A newfile
1041 $ hg st -A newfile
1042 A newfile
1042 A newfile
1043 $ hg revert newfile
1043 $ hg revert newfile
1044 $ rm newfile
1044 $ rm newfile
1045 $ hg qpop
1045 $ hg qpop
1046 popping baz
1046 popping baz
1047 now at: bar
1047 now at: bar
1048 $ hg qdel baz
1048 $ hg qdel baz
1049
1049
1050
1050
1051 create a git patch
1051 create a git patch
1052
1052
1053 $ echo a > alexander
1053 $ echo a > alexander
1054 $ hg add alexander
1054 $ hg add alexander
1055 $ hg qnew -f --git addalexander
1055 $ hg qnew -f --git addalexander
1056 $ grep diff .hg/patches/addalexander
1056 $ grep diff .hg/patches/addalexander
1057 diff --git a/alexander b/alexander
1057 diff --git a/alexander b/alexander
1058
1058
1059
1059
1060 create a git binary patch
1060 create a git binary patch
1061
1061
1062 $ cat > writebin.py <<EOF
1062 $ cat > writebin.py <<EOF
1063 > import sys
1063 > import sys
1064 > path = sys.argv[1]
1064 > path = sys.argv[1]
1065 > open(path, 'wb').write('BIN\x00ARY')
1065 > open(path, 'wb').write('BIN\x00ARY')
1066 > EOF
1066 > EOF
1067 $ python writebin.py bucephalus
1067 $ python writebin.py bucephalus
1068
1068
1069 $ python "$TESTDIR/md5sum.py" bucephalus
1069 $ python "$TESTDIR/md5sum.py" bucephalus
1070 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1070 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1071 $ hg add bucephalus
1071 $ hg add bucephalus
1072 $ hg qnew -f --git addbucephalus
1072 $ hg qnew -f --git addbucephalus
1073 $ grep diff .hg/patches/addbucephalus
1073 $ grep diff .hg/patches/addbucephalus
1074 diff --git a/bucephalus b/bucephalus
1074 diff --git a/bucephalus b/bucephalus
1075
1075
1076
1076
1077 check binary patches can be popped and pushed
1077 check binary patches can be popped and pushed
1078
1078
1079 $ hg qpop
1079 $ hg qpop
1080 popping addbucephalus
1080 popping addbucephalus
1081 now at: addalexander
1081 now at: addalexander
1082 $ test -f bucephalus && echo % bucephalus should not be there
1082 $ test -f bucephalus && echo % bucephalus should not be there
1083 [1]
1083 [1]
1084 $ hg qpush
1084 $ hg qpush
1085 applying addbucephalus
1085 applying addbucephalus
1086 now at: addbucephalus
1086 now at: addbucephalus
1087 $ test -f bucephalus
1087 $ test -f bucephalus
1088 $ python "$TESTDIR/md5sum.py" bucephalus
1088 $ python "$TESTDIR/md5sum.py" bucephalus
1089 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1089 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1090
1090
1091
1091
1092
1092
1093 strip again
1093 strip again
1094
1094
1095 $ cd ..
1095 $ cd ..
1096 $ hg init strip
1096 $ hg init strip
1097 $ cd strip
1097 $ cd strip
1098 $ touch foo
1098 $ touch foo
1099 $ hg add foo
1099 $ hg add foo
1100 $ hg ci -m 'add foo'
1100 $ hg ci -m 'add foo'
1101 $ echo >> foo
1101 $ echo >> foo
1102 $ hg ci -m 'change foo 1'
1102 $ hg ci -m 'change foo 1'
1103 $ hg up -C 0
1103 $ hg up -C 0
1104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1105 $ echo 1 >> foo
1105 $ echo 1 >> foo
1106 $ hg ci -m 'change foo 2'
1106 $ hg ci -m 'change foo 2'
1107 created new head
1107 created new head
1108 $ HGMERGE=true hg merge
1108 $ HGMERGE=true hg merge
1109 merging foo
1109 merging foo
1110 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1110 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1111 (branch merge, don't forget to commit)
1111 (branch merge, don't forget to commit)
1112 $ hg ci -m merge
1112 $ hg ci -m merge
1113 $ hg log
1113 $ hg log
1114 changeset: 3:99615015637b
1114 changeset: 3:99615015637b
1115 tag: tip
1115 tag: tip
1116 parent: 2:20cbbe65cff7
1116 parent: 2:20cbbe65cff7
1117 parent: 1:d2871fc282d4
1117 parent: 1:d2871fc282d4
1118 user: test
1118 user: test
1119 date: Thu Jan 01 00:00:00 1970 +0000
1119 date: Thu Jan 01 00:00:00 1970 +0000
1120 summary: merge
1120 summary: merge
1121
1121
1122 changeset: 2:20cbbe65cff7
1122 changeset: 2:20cbbe65cff7
1123 parent: 0:53245c60e682
1123 parent: 0:53245c60e682
1124 user: test
1124 user: test
1125 date: Thu Jan 01 00:00:00 1970 +0000
1125 date: Thu Jan 01 00:00:00 1970 +0000
1126 summary: change foo 2
1126 summary: change foo 2
1127
1127
1128 changeset: 1:d2871fc282d4
1128 changeset: 1:d2871fc282d4
1129 user: test
1129 user: test
1130 date: Thu Jan 01 00:00:00 1970 +0000
1130 date: Thu Jan 01 00:00:00 1970 +0000
1131 summary: change foo 1
1131 summary: change foo 1
1132
1132
1133 changeset: 0:53245c60e682
1133 changeset: 0:53245c60e682
1134 user: test
1134 user: test
1135 date: Thu Jan 01 00:00:00 1970 +0000
1135 date: Thu Jan 01 00:00:00 1970 +0000
1136 summary: add foo
1136 summary: add foo
1137
1137
1138 $ hg strip 1
1138 $ hg strip 1
1139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1140 saved backup bundle to $TESTTMP/b/strip/.hg/strip-backup/*-backup.hg (glob)
1140 saved backup bundle to $TESTTMP/b/strip/.hg/strip-backup/*-backup.hg (glob)
1141 $ checkundo strip
1141 $ checkundo strip
1142 $ hg log
1142 $ hg log
1143 changeset: 1:20cbbe65cff7
1143 changeset: 1:20cbbe65cff7
1144 tag: tip
1144 tag: tip
1145 user: test
1145 user: test
1146 date: Thu Jan 01 00:00:00 1970 +0000
1146 date: Thu Jan 01 00:00:00 1970 +0000
1147 summary: change foo 2
1147 summary: change foo 2
1148
1148
1149 changeset: 0:53245c60e682
1149 changeset: 0:53245c60e682
1150 user: test
1150 user: test
1151 date: Thu Jan 01 00:00:00 1970 +0000
1151 date: Thu Jan 01 00:00:00 1970 +0000
1152 summary: add foo
1152 summary: add foo
1153
1153
1154 $ cd ..
1154 $ cd ..
1155
1155
1156
1156
1157 qclone
1157 qclone
1158
1158
1159 $ qlog()
1159 $ qlog()
1160 > {
1160 > {
1161 > echo 'main repo:'
1161 > echo 'main repo:'
1162 > hg log --template ' rev {rev}: {desc}\n'
1162 > hg log --template ' rev {rev}: {desc}\n'
1163 > echo 'patch repo:'
1163 > echo 'patch repo:'
1164 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1164 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1165 > }
1165 > }
1166 $ hg init qclonesource
1166 $ hg init qclonesource
1167 $ cd qclonesource
1167 $ cd qclonesource
1168 $ echo foo > foo
1168 $ echo foo > foo
1169 $ hg add foo
1169 $ hg add foo
1170 $ hg ci -m 'add foo'
1170 $ hg ci -m 'add foo'
1171 $ hg qinit
1171 $ hg qinit
1172 $ hg qnew patch1
1172 $ hg qnew patch1
1173 $ echo bar >> foo
1173 $ echo bar >> foo
1174 $ hg qrefresh -m 'change foo'
1174 $ hg qrefresh -m 'change foo'
1175 $ cd ..
1175 $ cd ..
1176
1176
1177
1177
1178 repo with unversioned patch dir
1178 repo with unversioned patch dir
1179
1179
1180 $ hg qclone qclonesource failure
1180 $ hg qclone qclonesource failure
1181 abort: versioned patch repository not found (see init --mq)
1181 abort: versioned patch repository not found (see init --mq)
1182 [255]
1182 [255]
1183
1183
1184 $ cd qclonesource
1184 $ cd qclonesource
1185 $ hg qinit -c
1185 $ hg qinit -c
1186 adding .hg/patches/patch1
1186 adding .hg/patches/patch1
1187 $ hg qci -m checkpoint
1187 $ hg qci -m checkpoint
1188 $ qlog
1188 $ qlog
1189 main repo:
1189 main repo:
1190 rev 1: change foo
1190 rev 1: change foo
1191 rev 0: add foo
1191 rev 0: add foo
1192 patch repo:
1192 patch repo:
1193 rev 0: checkpoint
1193 rev 0: checkpoint
1194 $ cd ..
1194 $ cd ..
1195
1195
1196
1196
1197 repo with patches applied
1197 repo with patches applied
1198
1198
1199 $ hg qclone qclonesource qclonedest
1199 $ hg qclone qclonesource qclonedest
1200 updating to branch default
1200 updating to branch default
1201 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1201 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1203 $ cd qclonedest
1203 $ cd qclonedest
1204 $ qlog
1204 $ qlog
1205 main repo:
1205 main repo:
1206 rev 0: add foo
1206 rev 0: add foo
1207 patch repo:
1207 patch repo:
1208 rev 0: checkpoint
1208 rev 0: checkpoint
1209 $ cd ..
1209 $ cd ..
1210
1210
1211
1211
1212 repo with patches unapplied
1212 repo with patches unapplied
1213
1213
1214 $ cd qclonesource
1214 $ cd qclonesource
1215 $ hg qpop -a
1215 $ hg qpop -a
1216 popping patch1
1216 popping patch1
1217 patch queue now empty
1217 patch queue now empty
1218 $ qlog
1218 $ qlog
1219 main repo:
1219 main repo:
1220 rev 0: add foo
1220 rev 0: add foo
1221 patch repo:
1221 patch repo:
1222 rev 0: checkpoint
1222 rev 0: checkpoint
1223 $ cd ..
1223 $ cd ..
1224 $ hg qclone qclonesource qclonedest2
1224 $ hg qclone qclonesource qclonedest2
1225 updating to branch default
1225 updating to branch default
1226 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1226 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1228 $ cd qclonedest2
1228 $ cd qclonedest2
1229 $ qlog
1229 $ qlog
1230 main repo:
1230 main repo:
1231 rev 0: add foo
1231 rev 0: add foo
1232 patch repo:
1232 patch repo:
1233 rev 0: checkpoint
1233 rev 0: checkpoint
1234 $ cd ..
1234 $ cd ..
1235
1235
1236
1236
1237 Issue1033: test applying on an empty file
1237 Issue1033: test applying on an empty file
1238
1238
1239 $ hg init empty
1239 $ hg init empty
1240 $ cd empty
1240 $ cd empty
1241 $ touch a
1241 $ touch a
1242 $ hg ci -Am addempty
1242 $ hg ci -Am addempty
1243 adding a
1243 adding a
1244 $ echo a > a
1244 $ echo a > a
1245 $ hg qnew -f -e changea
1245 $ hg qnew -f -e changea
1246 $ hg qpop
1246 $ hg qpop
1247 popping changea
1247 popping changea
1248 patch queue now empty
1248 patch queue now empty
1249 $ hg qpush
1249 $ hg qpush
1250 applying changea
1250 applying changea
1251 now at: changea
1251 now at: changea
1252 $ cd ..
1252 $ cd ..
1253
1253
1254
1254
1255 test qpush with --force, issue1087
1255 test qpush with --force, issue1087
1256
1256
1257 $ hg init forcepush
1257 $ hg init forcepush
1258 $ cd forcepush
1258 $ cd forcepush
1259 $ echo hello > hello.txt
1259 $ echo hello > hello.txt
1260 $ echo bye > bye.txt
1260 $ echo bye > bye.txt
1261 $ hg ci -Ama
1261 $ hg ci -Ama
1262 adding bye.txt
1262 adding bye.txt
1263 adding hello.txt
1263 adding hello.txt
1264 $ hg qnew -d '0 0' empty
1264 $ hg qnew -d '0 0' empty
1265 $ hg qpop
1265 $ hg qpop
1266 popping empty
1266 popping empty
1267 patch queue now empty
1267 patch queue now empty
1268 $ echo world >> hello.txt
1268 $ echo world >> hello.txt
1269
1269
1270
1270
1271 qpush should fail, local changes
1271 qpush should fail, local changes
1272
1272
1273 $ hg qpush
1273 $ hg qpush
1274 abort: local changes found, refresh first
1274 abort: local changes found, refresh first
1275 [255]
1275 [255]
1276
1276
1277
1277
1278 apply force, should not discard changes with empty patch
1278 apply force, should not discard changes with empty patch
1279
1279
1280 $ hg qpush -f
1280 $ hg qpush -f
1281 applying empty
1281 applying empty
1282 patch empty is empty
1282 patch empty is empty
1283 now at: empty
1283 now at: empty
1284 $ hg diff --config diff.nodates=True
1284 $ hg diff --config diff.nodates=True
1285 diff -r bf5fc3f07a0a hello.txt
1285 diff -r bf5fc3f07a0a hello.txt
1286 --- a/hello.txt
1286 --- a/hello.txt
1287 +++ b/hello.txt
1287 +++ b/hello.txt
1288 @@ -1,1 +1,2 @@
1288 @@ -1,1 +1,2 @@
1289 hello
1289 hello
1290 +world
1290 +world
1291 $ hg qdiff --config diff.nodates=True
1291 $ hg qdiff --config diff.nodates=True
1292 diff -r 9ecee4f634e3 hello.txt
1292 diff -r 9ecee4f634e3 hello.txt
1293 --- a/hello.txt
1293 --- a/hello.txt
1294 +++ b/hello.txt
1294 +++ b/hello.txt
1295 @@ -1,1 +1,2 @@
1295 @@ -1,1 +1,2 @@
1296 hello
1296 hello
1297 +world
1297 +world
1298 $ hg log -l1 -p
1298 $ hg log -l1 -p
1299 changeset: 1:bf5fc3f07a0a
1299 changeset: 1:bf5fc3f07a0a
1300 tag: empty
1300 tag: empty
1301 tag: qbase
1301 tag: qbase
1302 tag: qtip
1302 tag: qtip
1303 tag: tip
1303 tag: tip
1304 user: test
1304 user: test
1305 date: Thu Jan 01 00:00:00 1970 +0000
1305 date: Thu Jan 01 00:00:00 1970 +0000
1306 summary: imported patch empty
1306 summary: imported patch empty
1307
1307
1308
1308
1309 $ hg qref -d '0 0'
1309 $ hg qref -d '0 0'
1310 $ hg qpop
1310 $ hg qpop
1311 popping empty
1311 popping empty
1312 patch queue now empty
1312 patch queue now empty
1313 $ echo universe >> hello.txt
1313 $ echo universe >> hello.txt
1314 $ echo universe >> bye.txt
1314 $ echo universe >> bye.txt
1315
1315
1316
1316
1317 qpush should fail, local changes
1317 qpush should fail, local changes
1318
1318
1319 $ hg qpush
1319 $ hg qpush
1320 abort: local changes found, refresh first
1320 abort: local changes found, refresh first
1321 [255]
1321 [255]
1322
1322
1323
1323
1324 apply force, should discard changes in hello, but not bye
1324 apply force, should discard changes in hello, but not bye
1325
1325
1326 $ hg qpush -f
1326 $ hg qpush -f
1327 applying empty
1327 applying empty
1328 now at: empty
1328 now at: empty
1329 $ hg st
1329 $ hg st
1330 M bye.txt
1330 M bye.txt
1331 $ hg diff --config diff.nodates=True
1331 $ hg diff --config diff.nodates=True
1332 diff -r ba252371dbc1 bye.txt
1332 diff -r ba252371dbc1 bye.txt
1333 --- a/bye.txt
1333 --- a/bye.txt
1334 +++ b/bye.txt
1334 +++ b/bye.txt
1335 @@ -1,1 +1,2 @@
1335 @@ -1,1 +1,2 @@
1336 bye
1336 bye
1337 +universe
1337 +universe
1338 $ hg qdiff --config diff.nodates=True
1338 $ hg qdiff --config diff.nodates=True
1339 diff -r 9ecee4f634e3 bye.txt
1339 diff -r 9ecee4f634e3 bye.txt
1340 --- a/bye.txt
1340 --- a/bye.txt
1341 +++ b/bye.txt
1341 +++ b/bye.txt
1342 @@ -1,1 +1,2 @@
1342 @@ -1,1 +1,2 @@
1343 bye
1343 bye
1344 +universe
1344 +universe
1345 diff -r 9ecee4f634e3 hello.txt
1345 diff -r 9ecee4f634e3 hello.txt
1346 --- a/hello.txt
1346 --- a/hello.txt
1347 +++ b/hello.txt
1347 +++ b/hello.txt
1348 @@ -1,1 +1,3 @@
1348 @@ -1,1 +1,3 @@
1349 hello
1349 hello
1350 +world
1350 +world
1351 +universe
1351 +universe
1352
1352
1353
1353
1354 test popping revisions not in working dir ancestry
1354 test popping revisions not in working dir ancestry
1355
1355
1356 $ hg qseries -v
1356 $ hg qseries -v
1357 0 A empty
1357 0 A empty
1358 $ hg up qparent
1358 $ hg up qparent
1359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1360 $ hg qpop
1360 $ hg qpop
1361 popping empty
1361 popping empty
1362 patch queue now empty
1362 patch queue now empty
1363
1363
1364 $ cd ..
1364 $ cd ..
1365 $ hg init deletion-order
1365 $ hg init deletion-order
1366 $ cd deletion-order
1366 $ cd deletion-order
1367
1367
1368 $ touch a
1368 $ touch a
1369 $ hg ci -Aqm0
1369 $ hg ci -Aqm0
1370
1370
1371 $ hg qnew rename-dir
1371 $ hg qnew rename-dir
1372 $ hg rm a
1372 $ hg rm a
1373 $ hg qrefresh
1373 $ hg qrefresh
1374
1374
1375 $ mkdir a b
1375 $ mkdir a b
1376 $ touch a/a b/b
1376 $ touch a/a b/b
1377 $ hg add -q a b
1377 $ hg add -q a b
1378 $ hg qrefresh
1378 $ hg qrefresh
1379
1379
1380
1380
1381 test popping must remove files added in subdirectories first
1381 test popping must remove files added in subdirectories first
1382
1382
1383 $ hg qpop
1383 $ hg qpop
1384 popping rename-dir
1384 popping rename-dir
1385 patch queue now empty
1385 patch queue now empty
1386 $ cd ..
1386 $ cd ..
1387
1387
@@ -1,279 +1,292 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "color=" >> $HGRCPATH
2 $ echo "color=" >> $HGRCPATH
3 $ echo "[color]" >> $HGRCPATH
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode=ansi" >> $HGRCPATH
4 $ echo "mode=ansi" >> $HGRCPATH
5
5
6 $ hg init repo1
6 $ hg init repo1
7 $ cd repo1
7 $ cd repo1
8 $ mkdir a b a/1 b/1 b/2
8 $ mkdir a b a/1 b/1 b/2
9 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
9 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
10
10
11 hg status in repo root:
11 hg status in repo root:
12
12
13 $ hg status --color=always
13 $ hg status --color=always
14 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
14 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
15 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
15 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
16 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
16 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
17 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
17 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
18 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
18 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
19 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
19 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
20
20
21 hg status . in repo root:
21 hg status . in repo root:
22
22
23 $ hg status --color=always .
23 $ hg status --color=always .
24 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
24 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
25 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
25 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
26 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
26 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
27 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
27 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
28 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
28 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
29 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
29 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
30
30
31 $ hg status --color=always --cwd a
31 $ hg status --color=always --cwd a
32 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
32 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
33 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
33 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
34 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
34 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
35 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
35 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
36 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
36 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
37 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
37 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
38 $ hg status --color=always --cwd a .
38 $ hg status --color=always --cwd a .
39 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
39 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
40 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
40 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
41 $ hg status --color=always --cwd a ..
41 $ hg status --color=always --cwd a ..
42 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
42 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
43 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
43 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
44 \x1b[0;35;1;4m? ../b/1/in_b_1\x1b[0m (esc)
44 \x1b[0;35;1;4m? ../b/1/in_b_1\x1b[0m (esc)
45 \x1b[0;35;1;4m? ../b/2/in_b_2\x1b[0m (esc)
45 \x1b[0;35;1;4m? ../b/2/in_b_2\x1b[0m (esc)
46 \x1b[0;35;1;4m? ../b/in_b\x1b[0m (esc)
46 \x1b[0;35;1;4m? ../b/in_b\x1b[0m (esc)
47 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
47 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
48
48
49 $ hg status --color=always --cwd b
49 $ hg status --color=always --cwd b
50 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
50 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
51 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
51 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
52 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
52 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
53 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
53 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
54 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
54 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
55 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
55 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
56 $ hg status --color=always --cwd b .
56 $ hg status --color=always --cwd b .
57 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
57 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
58 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
58 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
59 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
59 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
60 $ hg status --color=always --cwd b ..
60 $ hg status --color=always --cwd b ..
61 \x1b[0;35;1;4m? ../a/1/in_a_1\x1b[0m (esc)
61 \x1b[0;35;1;4m? ../a/1/in_a_1\x1b[0m (esc)
62 \x1b[0;35;1;4m? ../a/in_a\x1b[0m (esc)
62 \x1b[0;35;1;4m? ../a/in_a\x1b[0m (esc)
63 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
63 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
64 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
64 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
65 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
65 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
66 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
66 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
67
67
68 $ hg status --color=always --cwd a/1
68 $ hg status --color=always --cwd a/1
69 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
69 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
70 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
70 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
71 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
71 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
72 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
72 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
73 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
73 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
74 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
74 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
75 $ hg status --color=always --cwd a/1 .
75 $ hg status --color=always --cwd a/1 .
76 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
76 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
77 $ hg status --color=always --cwd a/1 ..
77 $ hg status --color=always --cwd a/1 ..
78 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
78 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
79 \x1b[0;35;1;4m? ../in_a\x1b[0m (esc)
79 \x1b[0;35;1;4m? ../in_a\x1b[0m (esc)
80
80
81 $ hg status --color=always --cwd b/1
81 $ hg status --color=always --cwd b/1
82 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
82 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
83 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
83 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
84 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
84 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
85 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
85 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
86 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
86 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
87 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
87 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
88 $ hg status --color=always --cwd b/1 .
88 $ hg status --color=always --cwd b/1 .
89 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
89 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
90 $ hg status --color=always --cwd b/1 ..
90 $ hg status --color=always --cwd b/1 ..
91 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
91 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
92 \x1b[0;35;1;4m? ../2/in_b_2\x1b[0m (esc)
92 \x1b[0;35;1;4m? ../2/in_b_2\x1b[0m (esc)
93 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
93 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
94
94
95 $ hg status --color=always --cwd b/2
95 $ hg status --color=always --cwd b/2
96 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
96 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
97 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
97 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
98 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
98 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
99 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
99 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
100 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
100 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
101 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
101 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
102 $ hg status --color=always --cwd b/2 .
102 $ hg status --color=always --cwd b/2 .
103 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
103 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
104 $ hg status --color=always --cwd b/2 ..
104 $ hg status --color=always --cwd b/2 ..
105 \x1b[0;35;1;4m? ../1/in_b_1\x1b[0m (esc)
105 \x1b[0;35;1;4m? ../1/in_b_1\x1b[0m (esc)
106 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
106 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
107 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
107 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
108 $ cd ..
108 $ cd ..
109
109
110 $ hg init repo2
110 $ hg init repo2
111 $ cd repo2
111 $ cd repo2
112 $ touch modified removed deleted ignored
112 $ touch modified removed deleted ignored
113 $ echo "^ignored$" > .hgignore
113 $ echo "^ignored$" > .hgignore
114 $ hg ci -A -m 'initial checkin'
114 $ hg ci -A -m 'initial checkin'
115 adding .hgignore
115 adding .hgignore
116 adding deleted
116 adding deleted
117 adding modified
117 adding modified
118 adding removed
118 adding removed
119 $ touch modified added unknown ignored
119 $ touch modified added unknown ignored
120 $ hg add added
120 $ hg add added
121 $ hg remove removed
121 $ hg remove removed
122 $ rm deleted
122 $ rm deleted
123
123
124 hg status:
124 hg status:
125
125
126 $ hg status --color=always
126 $ hg status --color=always
127 \x1b[0;32;1mA added\x1b[0m (esc)
127 \x1b[0;32;1mA added\x1b[0m (esc)
128 \x1b[0;31;1mR removed\x1b[0m (esc)
128 \x1b[0;31;1mR removed\x1b[0m (esc)
129 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
129 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
130 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
130 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
131
131
132 hg status modified added removed deleted unknown never-existed ignored:
132 hg status modified added removed deleted unknown never-existed ignored:
133
133
134 $ hg status --color=always modified added removed deleted unknown never-existed ignored
134 $ hg status --color=always modified added removed deleted unknown never-existed ignored
135 never-existed: No such file or directory
135 never-existed: No such file or directory
136 \x1b[0;32;1mA added\x1b[0m (esc)
136 \x1b[0;32;1mA added\x1b[0m (esc)
137 \x1b[0;31;1mR removed\x1b[0m (esc)
137 \x1b[0;31;1mR removed\x1b[0m (esc)
138 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
138 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
139 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
139 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
140
140
141 $ hg copy modified copied
141 $ hg copy modified copied
142
142
143 hg status -C:
143 hg status -C:
144
144
145 $ hg status --color=always -C
145 $ hg status --color=always -C
146 \x1b[0;32;1mA added\x1b[0m (esc)
146 \x1b[0;32;1mA added\x1b[0m (esc)
147 \x1b[0;32;1mA copied\x1b[0m (esc)
147 \x1b[0;32;1mA copied\x1b[0m (esc)
148 \x1b[0;0m modified\x1b[0m (esc)
148 \x1b[0;0m modified\x1b[0m (esc)
149 \x1b[0;31;1mR removed\x1b[0m (esc)
149 \x1b[0;31;1mR removed\x1b[0m (esc)
150 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
150 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
151 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
151 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
152
152
153 hg status -A:
153 hg status -A:
154
154
155 $ hg status --color=always -A
155 $ hg status --color=always -A
156 \x1b[0;32;1mA added\x1b[0m (esc)
156 \x1b[0;32;1mA added\x1b[0m (esc)
157 \x1b[0;32;1mA copied\x1b[0m (esc)
157 \x1b[0;32;1mA copied\x1b[0m (esc)
158 \x1b[0;0m modified\x1b[0m (esc)
158 \x1b[0;0m modified\x1b[0m (esc)
159 \x1b[0;31;1mR removed\x1b[0m (esc)
159 \x1b[0;31;1mR removed\x1b[0m (esc)
160 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
160 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
161 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
161 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
162 \x1b[0;30;1mI ignored\x1b[0m (esc)
162 \x1b[0;30;1mI ignored\x1b[0m (esc)
163 \x1b[0;0mC .hgignore\x1b[0m (esc)
163 \x1b[0;0mC .hgignore\x1b[0m (esc)
164 \x1b[0;0mC modified\x1b[0m (esc)
164 \x1b[0;0mC modified\x1b[0m (esc)
165
165
166 hg status -A (with terminfo color):
167
168 $ TERM=xterm hg status --config color.mode=terminfo --color=always -A
169 \x1b(B\x1b[m\x1b[32m\x1b[1mA added\x1b(B\x1b[m (esc)
170 \x1b(B\x1b[m\x1b[32m\x1b[1mA copied\x1b(B\x1b[m (esc)
171 \x1b(B\x1b[m\x1b(B\x1b[m modified\x1b(B\x1b[m (esc)
172 \x1b(B\x1b[m\x1b[31m\x1b[1mR removed\x1b(B\x1b[m (esc)
173 \x1b(B\x1b[m\x1b[36m\x1b[1m\x1b[4m! deleted\x1b(B\x1b[m (esc)
174 \x1b(B\x1b[m\x1b[35m\x1b[1m\x1b[4m? unknown\x1b(B\x1b[m (esc)
175 \x1b(B\x1b[m\x1b[30m\x1b[1mI ignored\x1b(B\x1b[m (esc)
176 \x1b(B\x1b[m\x1b(B\x1b[mC .hgignore\x1b(B\x1b[m (esc)
177 \x1b(B\x1b[m\x1b(B\x1b[mC modified\x1b(B\x1b[m (esc)
178
166
179
167 $ echo "^ignoreddir$" > .hgignore
180 $ echo "^ignoreddir$" > .hgignore
168 $ mkdir ignoreddir
181 $ mkdir ignoreddir
169 $ touch ignoreddir/file
182 $ touch ignoreddir/file
170
183
171 hg status ignoreddir/file:
184 hg status ignoreddir/file:
172
185
173 $ hg status --color=always ignoreddir/file
186 $ hg status --color=always ignoreddir/file
174
187
175 hg status -i ignoreddir/file:
188 hg status -i ignoreddir/file:
176
189
177 $ hg status --color=always -i ignoreddir/file
190 $ hg status --color=always -i ignoreddir/file
178 \x1b[0;30;1mI ignoreddir/file\x1b[0m (esc)
191 \x1b[0;30;1mI ignoreddir/file\x1b[0m (esc)
179 $ cd ..
192 $ cd ..
180
193
181 check 'status -q' and some combinations
194 check 'status -q' and some combinations
182
195
183 $ hg init repo3
196 $ hg init repo3
184 $ cd repo3
197 $ cd repo3
185 $ touch modified removed deleted ignored
198 $ touch modified removed deleted ignored
186 $ echo "^ignored$" > .hgignore
199 $ echo "^ignored$" > .hgignore
187 $ hg commit -A -m 'initial checkin'
200 $ hg commit -A -m 'initial checkin'
188 adding .hgignore
201 adding .hgignore
189 adding deleted
202 adding deleted
190 adding modified
203 adding modified
191 adding removed
204 adding removed
192 $ touch added unknown ignored
205 $ touch added unknown ignored
193 $ hg add added
206 $ hg add added
194 $ echo "test" >> modified
207 $ echo "test" >> modified
195 $ hg remove removed
208 $ hg remove removed
196 $ rm deleted
209 $ rm deleted
197 $ hg copy modified copied
210 $ hg copy modified copied
198
211
199 test unknown color
212 test unknown color
200
213
201 $ hg --config color.status.modified=periwinkle status --color=always
214 $ hg --config color.status.modified=periwinkle status --color=always
202 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
215 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
203 M modified
216 M modified
204 \x1b[0;32;1mA added\x1b[0m (esc)
217 \x1b[0;32;1mA added\x1b[0m (esc)
205 \x1b[0;32;1mA copied\x1b[0m (esc)
218 \x1b[0;32;1mA copied\x1b[0m (esc)
206 \x1b[0;31;1mR removed\x1b[0m (esc)
219 \x1b[0;31;1mR removed\x1b[0m (esc)
207 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
220 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
208 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
221 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
209
222
210 Run status with 2 different flags.
223 Run status with 2 different flags.
211 Check if result is the same or different.
224 Check if result is the same or different.
212 If result is not as expected, raise error
225 If result is not as expected, raise error
213
226
214 $ assert() {
227 $ assert() {
215 > hg status --color=always $1 > ../a
228 > hg status --color=always $1 > ../a
216 > hg status --color=always $2 > ../b
229 > hg status --color=always $2 > ../b
217 > if diff ../a ../b > /dev/null; then
230 > if diff ../a ../b > /dev/null; then
218 > out=0
231 > out=0
219 > else
232 > else
220 > out=1
233 > out=1
221 > fi
234 > fi
222 > if [ $3 -eq 0 ]; then
235 > if [ $3 -eq 0 ]; then
223 > df="same"
236 > df="same"
224 > else
237 > else
225 > df="different"
238 > df="different"
226 > fi
239 > fi
227 > if [ $out -ne $3 ]; then
240 > if [ $out -ne $3 ]; then
228 > echo "Error on $1 and $2, should be $df."
241 > echo "Error on $1 and $2, should be $df."
229 > fi
242 > fi
230 > }
243 > }
231
244
232 assert flag1 flag2 [0-same | 1-different]
245 assert flag1 flag2 [0-same | 1-different]
233
246
234 $ assert "-q" "-mard" 0
247 $ assert "-q" "-mard" 0
235 $ assert "-A" "-marduicC" 0
248 $ assert "-A" "-marduicC" 0
236 $ assert "-qA" "-mardcC" 0
249 $ assert "-qA" "-mardcC" 0
237 $ assert "-qAui" "-A" 0
250 $ assert "-qAui" "-A" 0
238 $ assert "-qAu" "-marducC" 0
251 $ assert "-qAu" "-marducC" 0
239 $ assert "-qAi" "-mardicC" 0
252 $ assert "-qAi" "-mardicC" 0
240 $ assert "-qu" "-u" 0
253 $ assert "-qu" "-u" 0
241 $ assert "-q" "-u" 1
254 $ assert "-q" "-u" 1
242 $ assert "-m" "-a" 1
255 $ assert "-m" "-a" 1
243 $ assert "-r" "-d" 1
256 $ assert "-r" "-d" 1
244 $ cd ..
257 $ cd ..
245
258
246 test 'resolve -l'
259 test 'resolve -l'
247
260
248 $ hg init repo4
261 $ hg init repo4
249 $ cd repo4
262 $ cd repo4
250 $ echo "file a" > a
263 $ echo "file a" > a
251 $ echo "file b" > b
264 $ echo "file b" > b
252 $ hg add a b
265 $ hg add a b
253 $ hg commit -m "initial"
266 $ hg commit -m "initial"
254 $ echo "file a change 1" > a
267 $ echo "file a change 1" > a
255 $ echo "file b change 1" > b
268 $ echo "file b change 1" > b
256 $ hg commit -m "head 1"
269 $ hg commit -m "head 1"
257 $ hg update 0
270 $ hg update 0
258 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 $ echo "file a change 2" > a
272 $ echo "file a change 2" > a
260 $ echo "file b change 2" > b
273 $ echo "file b change 2" > b
261 $ hg commit -m "head 2"
274 $ hg commit -m "head 2"
262 created new head
275 created new head
263 $ hg merge
276 $ hg merge
264 merging a
277 merging a
265 warning: conflicts during merge.
278 warning: conflicts during merge.
266 merging a failed!
279 merging a failed!
267 merging b
280 merging b
268 warning: conflicts during merge.
281 warning: conflicts during merge.
269 merging b failed!
282 merging b failed!
270 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
283 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
271 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
284 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
272 [1]
285 [1]
273 $ hg resolve -m b
286 $ hg resolve -m b
274
287
275 hg resolve with one unresolved, one resolved:
288 hg resolve with one unresolved, one resolved:
276
289
277 $ hg resolve --color=always -l
290 $ hg resolve --color=always -l
278 \x1b[0;31;1mU a\x1b[0m (esc)
291 \x1b[0;31;1mU a\x1b[0m (esc)
279 \x1b[0;32;1mR b\x1b[0m (esc)
292 \x1b[0;32;1mR b\x1b[0m (esc)
General Comments 0
You need to be logged in to leave comments. Login now