##// END OF EJS Templates
largefiles: migrate `opts` to native kwargs
Matt Harbison -
r51773:ee393dbf default
parent child Browse files
Show More
@@ -27,7 +27,6 b' from mercurial import ('
27 lock,
27 lock,
28 logcmdutil,
28 logcmdutil,
29 match as matchmod,
29 match as matchmod,
30 pycompat,
31 scmutil,
30 scmutil,
32 util,
31 util,
33 )
32 )
@@ -87,12 +86,11 b' def lfconvert(ui, src, dest, *pats, **op'
87 Use --to-normal to convert largefiles back to normal files; after
86 Use --to-normal to convert largefiles back to normal files; after
88 this, the DEST repository can be used without largefiles at all."""
87 this, the DEST repository can be used without largefiles at all."""
89
88
90 opts = pycompat.byteskwargs(opts)
89 if opts['to_normal']:
91 if opts[b'to_normal']:
92 tolfile = False
90 tolfile = False
93 else:
91 else:
94 tolfile = True
92 tolfile = True
95 size = lfutil.getminsize(ui, True, opts.get(b'size'), default=None)
93 size = lfutil.getminsize(ui, True, opts.get('size'), default=None)
96
94
97 if not hg.islocal(src):
95 if not hg.islocal(src):
98 raise error.Abort(_(b'%s is not a local Mercurial repo') % src)
96 raise error.Abort(_(b'%s is not a local Mercurial repo') % src)
@@ -1717,11 +1717,10 b' def overridetransplant(orig, ui, repo, *'
1717
1717
1718 @eh.wrapcommand(b'cat')
1718 @eh.wrapcommand(b'cat')
1719 def overridecat(orig, ui, repo, file1, *pats, **opts):
1719 def overridecat(orig, ui, repo, file1, *pats, **opts):
1720 opts = pycompat.byteskwargs(opts)
1720 ctx = logcmdutil.revsingle(repo, opts.get('rev'))
1721 ctx = logcmdutil.revsingle(repo, opts.get(b'rev'))
1722 err = 1
1721 err = 1
1723 notbad = set()
1722 notbad = set()
1724 m = scmutil.match(ctx, (file1,) + pats, opts)
1723 m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
1725 origmatchfn = m.matchfn
1724 origmatchfn = m.matchfn
1726
1725
1727 def lfmatchfn(f):
1726 def lfmatchfn(f):
@@ -1758,12 +1757,12 b' def overridecat(orig, ui, repo, file1, *'
1758 m.visitdir = lfvisitdirfn
1757 m.visitdir = lfvisitdirfn
1759
1758
1760 for f in ctx.walk(m):
1759 for f in ctx.walk(m):
1761 with cmdutil.makefileobj(ctx, opts.get(b'output'), pathname=f) as fp:
1760 with cmdutil.makefileobj(ctx, opts.get('output'), pathname=f) as fp:
1762 lf = lfutil.splitstandin(f)
1761 lf = lfutil.splitstandin(f)
1763 if lf is None or origmatchfn(f):
1762 if lf is None or origmatchfn(f):
1764 # duplicating unreachable code from commands.cat
1763 # duplicating unreachable code from commands.cat
1765 data = ctx[f].data()
1764 data = ctx[f].data()
1766 if opts.get(b'decode'):
1765 if opts.get('decode'):
1767 data = repo.wwritedata(f, data)
1766 data = repo.wwritedata(f, data)
1768 fp.write(data)
1767 fp.write(data)
1769 else:
1768 else:
General Comments 0
You need to be logged in to leave comments. Login now