Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 41367:b44f1703b28c
grep: don't look up copy info unless --follow is given
If no --follow was given, then the "copy" variable will become
None. In that case we would still look up the copy information from
the filelog and then ignore it. Let's avoid even looking it up.
Differential Revision: https://phab.mercurial-scm.org/D5620
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 06 Sep 2018 15:56:53 -0700 |
parents | 876494fd967d |
children | 609d6d8646db |
comparison
equal
deleted
inserted
replaced
41366:fabb0224a599 | 41367:b44f1703b28c |
---|---|
2942 flog = getfile(fn) | 2942 flog = getfile(fn) |
2943 try: | 2943 try: |
2944 fnode = ctx.filenode(fn) | 2944 fnode = ctx.filenode(fn) |
2945 except error.LookupError: | 2945 except error.LookupError: |
2946 continue | 2946 continue |
2947 try: | 2947 copy = None |
2948 copied = flog.renamed(fnode) | 2948 if follow: |
2949 except error.WdirUnsupported: | 2949 try: |
2950 copied = ctx[fn].renamed() | 2950 copied = flog.renamed(fnode) |
2951 copy = follow and copied and copied[0] | 2951 except error.WdirUnsupported: |
2952 if copy: | 2952 copied = ctx[fn].renamed() |
2953 copies.setdefault(rev, {})[fn] = copy | 2953 copy = copied and copied[0] |
2954 if copy: | |
2955 copies.setdefault(rev, {})[fn] = copy | |
2956 if fn in skip: | |
2957 skip[copy] = True | |
2954 if fn in skip: | 2958 if fn in skip: |
2955 if copy: | |
2956 skip[copy] = True | |
2957 continue | 2959 continue |
2958 files.append(fn) | 2960 files.append(fn) |
2959 | 2961 |
2960 if fn not in matches[rev]: | 2962 if fn not in matches[rev]: |
2961 try: | 2963 try: |