mercurial/logcmdutil.py
changeset 45473 5f0eeda2005d
parent 45472 07324227f6b7
child 45563 142f0dcf90d0
equal deleted inserted replaced
45472:07324227f6b7 45473:5f0eeda2005d
   690     match, pats = scmutil.matchandpats(wctx, pats, opts)
   690     match, pats = scmutil.matchandpats(wctx, pats, opts)
   691     slowpath = match.anypats() or (not match.always() and opts.get(b'removed'))
   691     slowpath = match.anypats() or (not match.always() and opts.get(b'removed'))
   692     if not slowpath:
   692     if not slowpath:
   693         follow = opts.get(b'follow') or opts.get(b'follow_first')
   693         follow = opts.get(b'follow') or opts.get(b'follow_first')
   694         if follow and opts.get(b'rev'):
   694         if follow and opts.get(b'rev'):
       
   695             # There may be the case that a path doesn't exist in some (but
       
   696             # not all) of the specified start revisions, but let's consider
       
   697             # the path is valid. Missing files will be warned by the matcher.
   695             startctxs = [repo[r] for r in revs]
   698             startctxs = [repo[r] for r in revs]
   696             for f in match.files():
   699             for f in match.files():
   697                 # No idea if the path was a directory at that revision, so
   700                 found = False
   698                 # take the slow path.
   701                 for c in startctxs:
   699                 if any(f not in c for c in startctxs):
   702                     if f in c:
   700                     slowpath = True
   703                         found = True
   701                     break
   704                     elif c.hasdir(f):
       
   705                         # If a directory exists in any of the start revisions,
       
   706                         # take the slow path.
       
   707                         found = slowpath = True
       
   708                 if not found:
       
   709                     raise error.Abort(
       
   710                         _(
       
   711                             b'cannot follow file not in any of the specified '
       
   712                             b'revisions: "%s"'
       
   713                         )
       
   714                         % f
       
   715                     )
   702         elif follow:
   716         elif follow:
   703             for f in match.files():
   717             for f in match.files():
   704                 if f not in wctx:
   718                 if f not in wctx:
   705                     # If the file exists, it may be a directory, so let it
   719                     # If the file exists, it may be a directory, so let it
   706                     # take the slow path.
   720                     # take the slow path.