Show More
@@ -2261,7 +2261,7 b' def forget(ui, repo, match, prefix, expl' | |||
|
2261 | 2261 | forgot.extend(f for f in forget if f not in rejected) |
|
2262 | 2262 | return bad, forgot |
|
2263 | 2263 | |
|
2264 | def files(ui, ctx, m, fm, fmt): | |
|
2264 | def files(ui, ctx, m, fm, fmt, subrepos): | |
|
2265 | 2265 | rev = ctx.rev() |
|
2266 | 2266 | ret = 1 |
|
2267 | 2267 | ds = ctx.repo().dirstate |
@@ -2277,6 +2277,17 b' def files(ui, ctx, m, fm, fmt):' | |||
|
2277 | 2277 | fm.write('path', fmt, m.rel(f)) |
|
2278 | 2278 | ret = 0 |
|
2279 | 2279 | |
|
2280 | if subrepos: | |
|
2281 | for subpath in sorted(ctx.substate): | |
|
2282 | sub = ctx.sub(subpath) | |
|
2283 | try: | |
|
2284 | submatch = matchmod.narrowmatcher(subpath, m) | |
|
2285 | if sub.printfiles(ui, submatch, fm, fmt) == 0: | |
|
2286 | ret = 0 | |
|
2287 | except error.LookupError: | |
|
2288 | ui.status(_("skipping missing subrepository: %s\n") | |
|
2289 | % m.abs(subpath)) | |
|
2290 | ||
|
2280 | 2291 | return ret |
|
2281 | 2292 | |
|
2282 | 2293 | def remove(ui, repo, m, prefix, after, force, subrepos): |
@@ -3225,7 +3225,7 b' def export(ui, repo, *changesets, **opts' | |||
|
3225 | 3225 | @command('files', |
|
3226 | 3226 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), |
|
3227 | 3227 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
3228 | ] + walkopts + formatteropts, | |
|
3228 | ] + walkopts + formatteropts + subrepoopts, | |
|
3229 | 3229 | _('[OPTION]... [PATTERN]...')) |
|
3230 | 3230 | def files(ui, repo, *pats, **opts): |
|
3231 | 3231 | """list tracked files |
@@ -3280,7 +3280,7 b' def files(ui, repo, *pats, **opts):' | |||
|
3280 | 3280 | fmt = '%s' + end |
|
3281 | 3281 | |
|
3282 | 3282 | m = scmutil.match(ctx, pats, opts) |
|
3283 | ret = cmdutil.files(ui, ctx, m, fm, fmt) | |
|
3283 | ret = cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos')) | |
|
3284 | 3284 | |
|
3285 | 3285 | fm.end() |
|
3286 | 3286 |
@@ -109,6 +109,10 b' Interaction with Mercurial Commands' | |||
|
109 | 109 | elements. Git subrepositories do not support --include/--exclude. |
|
110 | 110 | Subversion subrepositories are currently silently ignored. |
|
111 | 111 | |
|
112 | :files: files does not recurse into subrepos unless -S/--subrepos is | |
|
113 | specified. Git and Subversion subrepositories are currently | |
|
114 | silently ignored. | |
|
115 | ||
|
112 | 116 | :forget: forget currently only handles exact file matches in subrepos. |
|
113 | 117 | Git and Subversion subrepositories are currently silently ignored. |
|
114 | 118 |
@@ -469,6 +469,10 b' class abstractsubrepo(object):' | |||
|
469 | 469 | """return file flags""" |
|
470 | 470 | return '' |
|
471 | 471 | |
|
472 | def printfiles(self, ui, m, fm, fmt): | |
|
473 | """handle the files command for this subrepo""" | |
|
474 | return 1 | |
|
475 | ||
|
472 | 476 | def archive(self, archiver, prefix, match=None): |
|
473 | 477 | if match is not None: |
|
474 | 478 | files = [f for f in self.files() if match(f)] |
@@ -848,6 +852,17 b' class hgsubrepo(abstractsubrepo):' | |||
|
848 | 852 | ctx = self._repo[rev] |
|
849 | 853 | return ctx.flags(name) |
|
850 | 854 | |
|
855 | @annotatesubrepoerror | |
|
856 | def printfiles(self, ui, m, fm, fmt): | |
|
857 | # If the parent context is a workingctx, use the workingctx here for | |
|
858 | # consistency. | |
|
859 | if self._ctx.rev() is None: | |
|
860 | ctx = self._repo[None] | |
|
861 | else: | |
|
862 | rev = self._state[1] | |
|
863 | ctx = self._repo[rev] | |
|
864 | return cmdutil.files(ui, ctx, m, fm, fmt, True) | |
|
865 | ||
|
851 | 866 | def walk(self, match): |
|
852 | 867 | ctx = self._repo[None] |
|
853 | 868 | return ctx.walk(match) |
@@ -262,7 +262,7 b' Show all commands + options' | |||
|
262 | 262 | debugsuccessorssets: |
|
263 | 263 | debugwalk: include, exclude |
|
264 | 264 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
265 | files: rev, print0, include, exclude, template | |
|
265 | files: rev, print0, include, exclude, template, subrepos | |
|
266 | 266 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run |
|
267 | 267 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude |
|
268 | 268 | heads: rev, topo, active, closed, style, template |
@@ -186,6 +186,24 b' Test relative path printing + subrepos' | |||
|
186 | 186 | adding foo/bar/abc |
|
187 | 187 | committing subrepository sub1 |
|
188 | 188 | committing subrepository sub1/sub2 (glob) |
|
189 | ||
|
190 | $ hg forget sub1/sub2/sub2 | |
|
191 | $ echo x > sub1/sub2/x.txt | |
|
192 | $ hg add sub1/sub2/x.txt | |
|
193 | ||
|
194 | Files sees uncommitted adds and removes in subrepos | |
|
195 | $ hg files -S | |
|
196 | .hgsub | |
|
197 | .hgsubstate | |
|
198 | foo/bar/abc (glob) | |
|
199 | main | |
|
200 | sub1/.hgsub (glob) | |
|
201 | sub1/.hgsubstate (glob) | |
|
202 | sub1/foo (glob) | |
|
203 | sub1/sub1 (glob) | |
|
204 | sub1/sub2/folder/bar (glob) | |
|
205 | sub1/sub2/x.txt (glob) | |
|
206 | ||
|
189 | 207 | $ hg rollback -q |
|
190 | 208 | $ hg up -Cq |
|
191 | 209 | |
@@ -393,6 +411,7 b' largefile and a normal file. Then a lar' | |||
|
393 | 411 | R sub1/sub2/test.txt |
|
394 | 412 | ? foo/bar/abc |
|
395 | 413 | ? sub1/sub2/untracked.txt |
|
414 | ? sub1/sub2/x.txt | |
|
396 | 415 | $ hg add sub1/sub2 |
|
397 | 416 | $ hg ci -Sqm 'forget testing' |
|
398 | 417 |
General Comments 0
You need to be logged in to leave comments.
Login now