##// END OF EJS Templates
files: recurse into subrepos automatically with an explicit path
Matt Harbison -
r25228:63a57a27 default
parent child Browse files
Show More
@@ -2297,12 +2297,16 b' def files(ui, ctx, m, fm, fmt, subrepos)'
2297 fm.write('path', fmt, m.rel(f))
2297 fm.write('path', fmt, m.rel(f))
2298 ret = 0
2298 ret = 0
2299
2299
2300 if subrepos:
2300 for subpath in sorted(ctx.substate):
2301 for subpath in sorted(ctx.substate):
2301 def matchessubrepo(subpath):
2302 return (m.always() or m.exact(subpath)
2303 or any(f.startswith(subpath + '/') for f in m.files()))
2304
2305 if subrepos or matchessubrepo(subpath):
2302 sub = ctx.sub(subpath)
2306 sub = ctx.sub(subpath)
2303 try:
2307 try:
2304 submatch = matchmod.narrowmatcher(subpath, m)
2308 submatch = matchmod.narrowmatcher(subpath, m)
2305 if sub.printfiles(ui, submatch, fm, fmt) == 0:
2309 if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0:
2306 ret = 0
2310 ret = 0
2307 except error.LookupError:
2311 except error.LookupError:
2308 ui.status(_("skipping missing subrepository: %s\n")
2312 ui.status(_("skipping missing subrepository: %s\n")
@@ -109,8 +109,10 b' Interaction with Mercurial Commands'
109 elements. Subversion subrepositories are currently silently ignored.
109 elements. Subversion subrepositories are currently silently ignored.
110
110
111 :files: files does not recurse into subrepos unless -S/--subrepos is
111 :files: files does not recurse into subrepos unless -S/--subrepos is
112 specified. Git and Subversion subrepositories are currently
112 specified. However, if you specify the full path of a file or
113 silently ignored.
113 directory in a subrepo, it will be displayed even without
114 -S/--subrepos being specified. Git and Subversion subrepositories
115 are currently silently ignored.
114
116
115 :forget: forget currently only handles exact file matches in subrepos.
117 :forget: forget currently only handles exact file matches in subrepos.
116 Git and Subversion subrepositories are currently silently ignored.
118 Git and Subversion subrepositories are currently silently ignored.
@@ -504,7 +504,7 b' class abstractsubrepo(object):'
504 """Resolve the fileset expression for this repo"""
504 """Resolve the fileset expression for this repo"""
505 return set()
505 return set()
506
506
507 def printfiles(self, ui, m, fm, fmt):
507 def printfiles(self, ui, m, fm, fmt, subrepos):
508 """handle the files command for this subrepo"""
508 """handle the files command for this subrepo"""
509 return 1
509 return 1
510
510
@@ -904,7 +904,7 b' class hgsubrepo(abstractsubrepo):'
904 return ctx.flags(name)
904 return ctx.flags(name)
905
905
906 @annotatesubrepoerror
906 @annotatesubrepoerror
907 def printfiles(self, ui, m, fm, fmt):
907 def printfiles(self, ui, m, fm, fmt, subrepos):
908 # If the parent context is a workingctx, use the workingctx here for
908 # If the parent context is a workingctx, use the workingctx here for
909 # consistency.
909 # consistency.
910 if self._ctx.rev() is None:
910 if self._ctx.rev() is None:
@@ -912,7 +912,7 b' class hgsubrepo(abstractsubrepo):'
912 else:
912 else:
913 rev = self._state[1]
913 rev = self._state[1]
914 ctx = self._repo[rev]
914 ctx = self._repo[rev]
915 return cmdutil.files(ui, ctx, m, fm, fmt, True)
915 return cmdutil.files(ui, ctx, m, fm, fmt, subrepos)
916
916
917 @annotatesubrepoerror
917 @annotatesubrepoerror
918 def getfileset(self, expr):
918 def getfileset(self, expr):
@@ -232,6 +232,18 b' Files sees uncommitted adds and removes '
232 sub1/sub2/sub2 (glob)
232 sub1/sub2/sub2 (glob)
233 sub1/sub2/test.txt (glob)
233 sub1/sub2/test.txt (glob)
234
234
235 $ hg files sub1
236 sub1/.hgsub (glob)
237 sub1/.hgsubstate (glob)
238 sub1/foo (glob)
239 sub1/sub1 (glob)
240 sub1/sub2/folder/bar (glob)
241 sub1/sub2/x.txt (glob)
242
243 $ hg files sub1/sub2
244 sub1/sub2/folder/bar (glob)
245 sub1/sub2/x.txt (glob)
246
235 $ hg files -S -r '.^' sub1/sub2/folder
247 $ hg files -S -r '.^' sub1/sub2/folder
236 sub1/sub2/folder/test.txt (glob)
248 sub1/sub2/folder/test.txt (glob)
237
249
@@ -239,7 +251,7 b' Files sees uncommitted adds and removes '
239 sub1/sub2/missing: no such file in rev 78026e779ea6 (glob)
251 sub1/sub2/missing: no such file in rev 78026e779ea6 (glob)
240 [1]
252 [1]
241
253
242 $ hg files -S -r '.^' sub1/
254 $ hg files -r '.^' sub1/
243 sub1/.hgsub (glob)
255 sub1/.hgsub (glob)
244 sub1/.hgsubstate (glob)
256 sub1/.hgsubstate (glob)
245 sub1/sub1 (glob)
257 sub1/sub1 (glob)
@@ -247,7 +259,7 b' Files sees uncommitted adds and removes '
247 sub1/sub2/sub2 (glob)
259 sub1/sub2/sub2 (glob)
248 sub1/sub2/test.txt (glob)
260 sub1/sub2/test.txt (glob)
249
261
250 $ hg files -S -r '.^' sub1/sub2
262 $ hg files -r '.^' sub1/sub2
251 sub1/sub2/folder/test.txt (glob)
263 sub1/sub2/folder/test.txt (glob)
252 sub1/sub2/sub2 (glob)
264 sub1/sub2/sub2 (glob)
253 sub1/sub2/test.txt (glob)
265 sub1/sub2/test.txt (glob)
General Comments 0
You need to be logged in to leave comments. Login now