Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 17911:8a8d1a2fd19d
manifest: add formatter support
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 06 Nov 2012 17:30:49 -0600 |
parents | c8709ff57ff2 |
children | 7a3de6c23f6d |
comparison
equal
deleted
inserted
replaced
17910:c8709ff57ff2 | 17911:8a8d1a2fd19d |
---|---|
4204 If option --all is specified, the list of all files from all revisions | 4204 If option --all is specified, the list of all files from all revisions |
4205 is printed. This includes deleted and renamed files. | 4205 is printed. This includes deleted and renamed files. |
4206 | 4206 |
4207 Returns 0 on success. | 4207 Returns 0 on success. |
4208 """ | 4208 """ |
4209 | |
4210 fm = ui.formatter('manifest', opts) | |
4211 | |
4209 if opts.get('all'): | 4212 if opts.get('all'): |
4210 if rev or node: | 4213 if rev or node: |
4211 raise util.Abort(_("can't specify a revision with --all")) | 4214 raise util.Abort(_("can't specify a revision with --all")) |
4212 | 4215 |
4213 res = [] | 4216 res = [] |
4221 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: | 4224 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: |
4222 res.append(fn[plen:-slen]) | 4225 res.append(fn[plen:-slen]) |
4223 finally: | 4226 finally: |
4224 lock.release() | 4227 lock.release() |
4225 for f in res: | 4228 for f in res: |
4226 ui.write("%s\n" % f) | 4229 fm.startitem() |
4230 fm.write("path", '%s\n', f) | |
4231 fm.end() | |
4227 return | 4232 return |
4228 | 4233 |
4229 if rev and node: | 4234 if rev and node: |
4230 raise util.Abort(_("please specify just one revision")) | 4235 raise util.Abort(_("please specify just one revision")) |
4231 | 4236 |
4232 if not node: | 4237 if not node: |
4233 node = rev | 4238 node = rev |
4234 | 4239 |
4235 decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '} | 4240 char = {'l': '@', 'x': '*', '': ''} |
4241 mode = {'l': '644', 'x': '755', '': '644'} | |
4236 ctx = scmutil.revsingle(repo, node) | 4242 ctx = scmutil.revsingle(repo, node) |
4243 mf = ctx.manifest() | |
4237 for f in ctx: | 4244 for f in ctx: |
4238 if ui.debugflag: | 4245 fm.startitem() |
4239 ui.write("%40s " % hex(ctx.manifest()[f])) | 4246 fl = ctx[f].flags() |
4240 if ui.verbose: | 4247 fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) |
4241 ui.write(decor[ctx.flags(f)]) | 4248 fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) |
4242 ui.write("%s\n" % f) | 4249 fm.write('path', '%s\n', f) |
4250 fm.end() | |
4243 | 4251 |
4244 @command('^merge', | 4252 @command('^merge', |
4245 [('f', 'force', None, _('force a merge with outstanding changes')), | 4253 [('f', 'force', None, _('force a merge with outstanding changes')), |
4246 ('r', 'rev', '', _('revision to merge'), _('REV')), | 4254 ('r', 'rev', '', _('revision to merge'), _('REV')), |
4247 ('P', 'preview', None, | 4255 ('P', 'preview', None, |