Show More
@@ -943,7 +943,7 b' class localrepository(repo.repository):' | |||
|
943 | 943 | ''' |
|
944 | 944 | return self[node].walk(match) |
|
945 | 945 | |
|
946 |
def status(self, node1= |
|
|
946 | def status(self, node1='.', node2=None, match=None, | |
|
947 | 947 | ignored=False, clean=False, unknown=False): |
|
948 | 948 | """return status of files between two nodes or node and working directory |
|
949 | 949 | |
@@ -951,14 +951,9 b' class localrepository(repo.repository):' | |||
|
951 | 951 | If node2 is None, compare node1 with working directory. |
|
952 | 952 | """ |
|
953 | 953 | |
|
954 |
def |
|
|
955 | t1 = self.wread(fn) | |
|
956 | return self.file(fn).cmp(getnode(fn), t1) | |
|
957 | ||
|
958 | def mfmatches(node): | |
|
959 | change = self.changelog.read(node) | |
|
960 | mf = self.manifest.read(change[0]).copy() | |
|
961 | for fn in mf.keys(): | |
|
954 | def mfmatches(ctx): | |
|
955 | mf = ctx.manifest().copy() | |
|
956 | for fn in mf: | |
|
962 | 957 | if not match(fn): |
|
963 | 958 | del mf[fn] |
|
964 | 959 | return mf |
@@ -966,35 +961,34 b' class localrepository(repo.repository):' | |||
|
966 | 961 | if not match: |
|
967 | 962 | match = match_.always(self.root, self.getcwd()) |
|
968 | 963 | |
|
964 | ctx1 = self[node1] | |
|
965 | ctx2 = self[node2] | |
|
966 | working = ctx2 == self[None] | |
|
967 | parentworking = working and ctx1 == self['.'] | |
|
968 | ||
|
969 | 969 | listignored, listclean, listunknown = ignored, clean, unknown |
|
970 | 970 | modified, added, removed, deleted, unknown = [], [], [], [], [] |
|
971 | 971 | ignored, clean = [], [] |
|
972 | 972 | |
|
973 |
|
|
|
974 | if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): | |
|
975 | compareworking = True | |
|
976 | ||
|
977 | if not compareworking: | |
|
973 | if not parentworking: | |
|
978 | 974 | # read the manifest from node1 before the manifest from node2, |
|
979 | 975 | # so that we'll hit the manifest cache if we're going through |
|
980 | 976 | # all the revisions in parent->child order. |
|
981 |
mf1 = mfmatches( |
|
|
977 | mf1 = mfmatches(ctx1) | |
|
982 | 978 | |
|
983 | 979 | # are we comparing the working directory? |
|
984 |
if |
|
|
980 | if working: | |
|
985 | 981 | (lookup, modified, added, removed, deleted, unknown, |
|
986 | 982 | ignored, clean) = self.dirstate.status(match, listignored, |
|
987 | 983 | listclean, listunknown) |
|
988 | 984 | # are we comparing working dir against its parent? |
|
989 |
if |
|
|
985 | if parentworking: | |
|
990 | 986 | if lookup: |
|
991 | 987 | fixup = [] |
|
992 | 988 | # do a full compare of any files that might have changed |
|
993 | ctx = self['.'] | |
|
994 | ff = self.dirstate.flagfunc(ctx.flags) | |
|
995 | 989 | for f in lookup: |
|
996 |
if (f not in ctx or |
|
|
997 |
or ctx[f].cmp( |
|
|
990 | if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) | |
|
991 | or ctx1[f].cmp(ctx2[f].read())): | |
|
998 | 992 | modified.append(f) |
|
999 | 993 | else: |
|
1000 | 994 | fixup.append(f) |
@@ -1018,31 +1012,28 b' class localrepository(repo.repository):' | |||
|
1018 | 1012 | # we are comparing working dir against non-parent |
|
1019 | 1013 | # generate a pseudo-manifest for the working dir |
|
1020 | 1014 | # XXX: create it in dirstate.py ? |
|
1021 |
mf2 = mfmatches(self. |
|
|
1022 | ff = self.dirstate.flagfunc(mf2.flags) | |
|
1015 | mf2 = mfmatches(self['.']) | |
|
1023 | 1016 | for f in lookup + modified + added: |
|
1024 |
mf2[f] = |
|
|
1025 |
mf2.set(f, |
|
|
1017 | mf2[f] = None | |
|
1018 | mf2.set(f, ctx2.flags(f)) | |
|
1026 | 1019 | for f in removed: |
|
1027 | 1020 | if f in mf2: |
|
1028 | 1021 | del mf2[f] |
|
1029 | ||
|
1030 | 1022 | else: |
|
1031 | 1023 | # we are comparing two revisions |
|
1032 |
mf2 = mfmatches( |
|
|
1024 | mf2 = mfmatches(ctx2) | |
|
1033 | 1025 | |
|
1034 |
if not |
|
|
1026 | if not parentworking: | |
|
1035 | 1027 | # flush lists from dirstate before comparing manifests |
|
1036 | 1028 | modified, added, clean = [], [], [] |
|
1037 | 1029 | |
|
1038 | 1030 | # make sure to sort the files so we talk to the disk in a |
|
1039 | 1031 | # reasonable order |
|
1040 | getnode = lambda fn: mf1.get(fn, nullid) | |
|
1041 | 1032 | for fn in util.sort(mf2): |
|
1042 | 1033 | if fn in mf1: |
|
1043 | 1034 | if (mf1.flags(fn) != mf2.flags(fn) or |
|
1044 | 1035 | (mf1[fn] != mf2[fn] and |
|
1045 |
(mf2[fn] |
|
|
1036 | (mf2[fn] or ctx1[f].cmp(ctx2[f].read())))): | |
|
1046 | 1037 | modified.append(fn) |
|
1047 | 1038 | elif listclean: |
|
1048 | 1039 | clean.append(fn) |
General Comments 0
You need to be logged in to leave comments.
Login now