31 rejected = None |
31 rejected = None |
32 exacts = {} |
32 exacts = {} |
33 names = [] |
33 names = [] |
34 m = cmdutil.match(repo, pats, opts) |
34 m = cmdutil.match(repo, pats, opts) |
35 m.bad = lambda x,y: True |
35 m.bad = lambda x,y: True |
36 for src, abs in repo.walk(m): |
36 for abs in repo.walk(m): |
37 if m.exact(abs): |
37 if m.exact(abs): |
38 if ui.verbose: |
38 if ui.verbose: |
39 ui.status(_('adding %s\n') % m.rel(abs)) |
39 ui.status(_('adding %s\n') % m.rel(abs)) |
40 names.append(abs) |
40 names.append(abs) |
41 exacts[abs] = 1 |
41 exacts[abs] = 1 |
108 funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
108 funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
109 |
109 |
110 ctx = repo.changectx(opts['rev']) |
110 ctx = repo.changectx(opts['rev']) |
111 |
111 |
112 m = cmdutil.match(repo, pats, opts) |
112 m = cmdutil.match(repo, pats, opts) |
113 for src, abs in repo.walk(m, ctx.node()): |
113 for abs in repo.walk(m, ctx.node()): |
114 fctx = ctx.filectx(abs) |
114 fctx = ctx.filectx(abs) |
115 if not opts['text'] and util.binary(fctx.data()): |
115 if not opts['text'] and util.binary(fctx.data()): |
116 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |
116 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |
117 continue |
117 continue |
118 |
118 |
487 %p root-relative path name of file being printed |
487 %p root-relative path name of file being printed |
488 """ |
488 """ |
489 ctx = repo.changectx(opts['rev']) |
489 ctx = repo.changectx(opts['rev']) |
490 err = 1 |
490 err = 1 |
491 m = cmdutil.match(repo, (file1,) + pats, opts) |
491 m = cmdutil.match(repo, (file1,) + pats, opts) |
492 for src, abs in repo.walk(m, ctx.node()): |
492 for abs in repo.walk(m, ctx.node()): |
493 fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs) |
493 fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs) |
494 data = ctx.filectx(abs).data() |
494 data = ctx.filectx(abs).data() |
495 if opts.get('decode'): |
495 if opts.get('decode'): |
496 data = repo.wwritedata(abs, data) |
496 data = repo.wwritedata(abs, data) |
497 fp.write(data) |
497 fp.write(data) |
913 def debugrename(ui, repo, file1, *pats, **opts): |
913 def debugrename(ui, repo, file1, *pats, **opts): |
914 """dump rename information""" |
914 """dump rename information""" |
915 |
915 |
916 ctx = repo.changectx(opts.get('rev', 'tip')) |
916 ctx = repo.changectx(opts.get('rev', 'tip')) |
917 m = cmdutil.match(repo, (file1,) + pats, opts) |
917 m = cmdutil.match(repo, (file1,) + pats, opts) |
918 for src, abs in repo.walk(m, ctx.node()): |
918 for abs in repo.walk(m, ctx.node()): |
919 fctx = ctx.filectx(abs) |
919 fctx = ctx.filectx(abs) |
920 o = fctx.filelog().renamed(fctx.filenode()) |
920 o = fctx.filelog().renamed(fctx.filenode()) |
921 rel = m.rel(abs) |
921 rel = m.rel(abs) |
922 if o: |
922 if o: |
923 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
923 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
928 """show how files match on given patterns""" |
928 """show how files match on given patterns""" |
929 m = cmdutil.match(repo, pats, opts) |
929 m = cmdutil.match(repo, pats, opts) |
930 items = list(repo.walk(m)) |
930 items = list(repo.walk(m)) |
931 if not items: |
931 if not items: |
932 return |
932 return |
933 fmt = '%%s %%-%ds %%-%ds %%s' % ( |
933 fmt = 'f %%-%ds %%-%ds %%s' % ( |
934 max([len(abs) for (src, abs) in items]), |
934 max([len(abs) for abs in items]), |
935 max([len(m.rel(abs)) for (src, abs) in items])) |
935 max([len(m.rel(abs)) for abs in items])) |
936 for src, abs in items: |
936 for abs in items: |
937 line = fmt % (src, abs, m.rel(abs), m.exact(abs) and 'exact' or '') |
937 line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '') |
938 ui.write("%s\n" % line.rstrip()) |
938 ui.write("%s\n" % line.rstrip()) |
939 |
939 |
940 def diff(ui, repo, *pats, **opts): |
940 def diff(ui, repo, *pats, **opts): |
941 """diff repository (or selected files) |
941 """diff repository (or selected files) |
942 |
942 |
1697 node = None |
1697 node = None |
1698 |
1698 |
1699 ret = 1 |
1699 ret = 1 |
1700 m = cmdutil.match(repo, pats, opts, default='relglob') |
1700 m = cmdutil.match(repo, pats, opts, default='relglob') |
1701 m.bad = lambda x,y: False |
1701 m.bad = lambda x,y: False |
1702 for src, abs in repo.walk(m, node): |
1702 for abs in repo.walk(m, node): |
1703 if not node and abs not in repo.dirstate: |
1703 if not node and abs not in repo.dirstate: |
1704 continue |
1704 continue |
1705 if opts['fullpath']: |
1705 if opts['fullpath']: |
1706 ui.write(os.path.join(repo.root, abs), end) |
1706 ui.write(os.path.join(repo.root, abs), end) |
1707 else: |
1707 else: |
2183 m = cmdutil.match(repo, pats, opts) |
2183 m = cmdutil.match(repo, pats, opts) |
2184 mardu = map(dict.fromkeys, repo.status(files=m.files(), match=m))[:5] |
2184 mardu = map(dict.fromkeys, repo.status(files=m.files(), match=m))[:5] |
2185 modified, added, removed, deleted, unknown = mardu |
2185 modified, added, removed, deleted, unknown = mardu |
2186 |
2186 |
2187 remove, forget = [], [] |
2187 remove, forget = [], [] |
2188 for src, abs in repo.walk(m): |
2188 for abs in repo.walk(m): |
2189 |
2189 |
2190 reason = None |
2190 reason = None |
2191 if abs in removed or abs in unknown: |
2191 if abs in removed or abs in unknown: |
2192 continue |
2192 continue |
2193 |
2193 |
2340 # walk dirstate. |
2340 # walk dirstate. |
2341 files = [] |
2341 files = [] |
2342 |
2342 |
2343 m = cmdutil.match(repo, pats, opts) |
2343 m = cmdutil.match(repo, pats, opts) |
2344 m.bad = lambda x,y: False |
2344 m.bad = lambda x,y: False |
2345 for src, abs in repo.walk(m): |
2345 for abs in repo.walk(m): |
2346 names[abs] = m.rel(abs), m.exact(abs) |
2346 names[abs] = m.rel(abs), m.exact(abs) |
2347 |
2347 |
2348 # walk target manifest. |
2348 # walk target manifest. |
2349 |
2349 |
2350 def badfn(path, msg): |
2350 def badfn(path, msg): |
2357 repo.ui.warn("%s: %s\n" % (m.rel(path), msg)) |
2357 repo.ui.warn("%s: %s\n" % (m.rel(path), msg)) |
2358 return False |
2358 return False |
2359 |
2359 |
2360 m = cmdutil.match(repo, pats, opts) |
2360 m = cmdutil.match(repo, pats, opts) |
2361 m.bad = badfn |
2361 m.bad = badfn |
2362 for src, abs in repo.walk(m, node=node): |
2362 for abs in repo.walk(m, node=node): |
2363 if abs not in names: |
2363 if abs not in names: |
2364 names[abs] = m.rel(abs), m.exact(abs) |
2364 names[abs] = m.rel(abs), m.exact(abs) |
2365 |
2365 |
2366 changes = repo.status(files=files, match=names.has_key)[:4] |
2366 changes = repo.status(files=files, match=names.has_key)[:4] |
2367 modified, added, removed, deleted = map(dict.fromkeys, changes) |
2367 modified, added, removed, deleted = map(dict.fromkeys, changes) |