equal
deleted
inserted
replaced
364 try: |
364 try: |
365 r = self.changelog.rev(n) |
365 r = self.changelog.rev(n) |
366 except: |
366 except: |
367 r = -2 # sort to the beginning of the list if unknown |
367 r = -2 # sort to the beginning of the list if unknown |
368 l.append((r, t, n)) |
368 l.append((r, t, n)) |
369 l.sort() |
369 return [(t, n) for r, t, n in util.sort(l)] |
370 return [(t, n) for r, t, n in l] |
|
371 |
370 |
372 def nodetags(self, node): |
371 def nodetags(self, node): |
373 '''return the tags associated with a node''' |
372 '''return the tags associated with a node''' |
374 if not self.nodetagscache: |
373 if not self.nodetagscache: |
375 self.nodetagscache = {} |
374 self.nodetagscache = {} |
809 def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False, |
808 def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False, |
810 use_dirstate=True, update_dirstate=True): |
809 use_dirstate=True, update_dirstate=True): |
811 tr = None |
810 tr = None |
812 valid = 0 # don't save the dirstate if this isn't set |
811 valid = 0 # don't save the dirstate if this isn't set |
813 try: |
812 try: |
814 commit = wctx.modified() + wctx.added() |
813 commit = util.sort(wctx.modified() + wctx.added()) |
815 remove = wctx.removed() |
814 remove = wctx.removed() |
816 extra = wctx.extra().copy() |
815 extra = wctx.extra().copy() |
817 branchname = extra['branch'] |
816 branchname = extra['branch'] |
818 user = wctx.user() |
817 user = wctx.user() |
819 text = wctx.description() |
818 text = wctx.description() |
842 |
841 |
843 # check in files |
842 # check in files |
844 new = {} |
843 new = {} |
845 changed = [] |
844 changed = [] |
846 linkrev = len(self) |
845 linkrev = len(self) |
847 commit.sort() |
|
848 for f in commit: |
846 for f in commit: |
849 self.ui.note(f + "\n") |
847 self.ui.note(f + "\n") |
850 try: |
848 try: |
851 fctx = wctx.filectx(f) |
849 fctx = wctx.filectx(f) |
852 newflags = fctx.flags() |
850 newflags = fctx.flags() |
869 else: |
867 else: |
870 remove.append(f) |
868 remove.append(f) |
871 |
869 |
872 # update manifest |
870 # update manifest |
873 m1.update(new) |
871 m1.update(new) |
874 remove.sort() |
|
875 removed = [] |
872 removed = [] |
876 |
873 |
877 for f in remove: |
874 for f in util.sort(remove): |
878 if f in m1: |
875 if f in m1: |
879 del m1[f] |
876 del m1[f] |
880 removed.append(f) |
877 removed.append(f) |
881 elif f in m2: |
878 elif f in m2: |
882 removed.append(f) |
879 removed.append(f) |
948 if node: |
945 if node: |
949 fdict = dict.fromkeys(match.files()) |
946 fdict = dict.fromkeys(match.files()) |
950 # for dirstate.walk, files=['.'] means "walk the whole tree". |
947 # for dirstate.walk, files=['.'] means "walk the whole tree". |
951 # follow that here, too |
948 # follow that here, too |
952 fdict.pop('.', None) |
949 fdict.pop('.', None) |
953 mdict = self.manifest.read(self.changelog.read(node)[0]) |
950 for fn in self[node]: |
954 mfiles = mdict.keys() |
|
955 mfiles.sort() |
|
956 for fn in mfiles: |
|
957 for ffn in fdict: |
951 for ffn in fdict: |
958 # match if the file is the exact name or a directory |
952 # match if the file is the exact name or a directory |
959 if ffn == fn or fn.startswith("%s/" % ffn): |
953 if ffn == fn or fn.startswith("%s/" % ffn): |
960 del fdict[ffn] |
954 del fdict[ffn] |
961 break |
955 break |
962 if match(fn): |
956 if match(fn): |
963 yield fn |
957 yield fn |
964 ffiles = fdict.keys() |
958 for fn in util.sort(fdict): |
965 ffiles.sort() |
|
966 for fn in ffiles: |
|
967 if match.bad(fn, 'No such file in rev ' + short(node)) \ |
959 if match.bad(fn, 'No such file in rev ' + short(node)) \ |
968 and match(fn): |
960 and match(fn): |
969 yield fn |
961 yield fn |
970 else: |
962 else: |
971 for src, fn, st in self.dirstate.walk(match, True, False): |
963 for src, fn, st in self.dirstate.walk(match, True, False): |
1063 # flush lists from dirstate before comparing manifests |
1055 # flush lists from dirstate before comparing manifests |
1064 modified, added, clean = [], [], [] |
1056 modified, added, clean = [], [], [] |
1065 |
1057 |
1066 # make sure to sort the files so we talk to the disk in a |
1058 # make sure to sort the files so we talk to the disk in a |
1067 # reasonable order |
1059 # reasonable order |
1068 mf2keys = mf2.keys() |
|
1069 mf2keys.sort() |
|
1070 getnode = lambda fn: mf1.get(fn, nullid) |
1060 getnode = lambda fn: mf1.get(fn, nullid) |
1071 for fn in mf2keys: |
1061 for fn in util.sort(mf2): |
1072 if fn in mf1: |
1062 if fn in mf1: |
1073 if (mf1.flags(fn) != mf2.flags(fn) or |
1063 if (mf1.flags(fn) != mf2.flags(fn) or |
1074 (mf1[fn] != mf2[fn] and |
1064 (mf1[fn] != mf2[fn] and |
1075 (mf2[fn] != "" or fcmp(fn, getnode)))): |
1065 (mf2[fn] != "" or fcmp(fn, getnode)))): |
1076 modified.append(fn) |
1066 modified.append(fn) |
1188 |
1178 |
1189 def heads(self, start=None): |
1179 def heads(self, start=None): |
1190 heads = self.changelog.heads(start) |
1180 heads = self.changelog.heads(start) |
1191 # sort the output in rev descending order |
1181 # sort the output in rev descending order |
1192 heads = [(-self.changelog.rev(h), h) for h in heads] |
1182 heads = [(-self.changelog.rev(h), h) for h in heads] |
1193 heads.sort() |
1183 return [n for (r, n) in util.sort(heads)] |
1194 return [n for (r, n) in heads] |
|
1195 |
1184 |
1196 def branchheads(self, branch=None, start=None): |
1185 def branchheads(self, branch=None, start=None): |
1197 if branch is None: |
1186 if branch is None: |
1198 branch = self[None].branch() |
1187 branch = self[None].branch() |
1199 branches = self.branchtags() |
1188 branches = self.branchtags() |
1841 if isinstance(fname, int): |
1830 if isinstance(fname, int): |
1842 continue |
1831 continue |
1843 add_extra_nodes(fname, |
1832 add_extra_nodes(fname, |
1844 msng_filenode_set.setdefault(fname, {})) |
1833 msng_filenode_set.setdefault(fname, {})) |
1845 changedfiles[fname] = 1 |
1834 changedfiles[fname] = 1 |
1846 changedfiles = changedfiles.keys() |
|
1847 changedfiles.sort() |
|
1848 # Go through all our files in order sorted by name. |
1835 # Go through all our files in order sorted by name. |
1849 for fname in changedfiles: |
1836 for fname in util.sort(changedfiles): |
1850 filerevlog = self.file(fname) |
1837 filerevlog = self.file(fname) |
1851 if not len(filerevlog): |
1838 if not len(filerevlog): |
1852 raise util.Abort(_("empty or missing revlog for %s") % fname) |
1839 raise util.Abort(_("empty or missing revlog for %s") % fname) |
1853 # Toss out the filenodes that the recipient isn't really |
1840 # Toss out the filenodes that the recipient isn't really |
1854 # missing. |
1841 # missing. |
1922 changedfiles = {} |
1909 changedfiles = {} |
1923 |
1910 |
1924 for chnk in cl.group(nodes, identity, |
1911 for chnk in cl.group(nodes, identity, |
1925 changed_file_collector(changedfiles)): |
1912 changed_file_collector(changedfiles)): |
1926 yield chnk |
1913 yield chnk |
1927 changedfiles = changedfiles.keys() |
|
1928 changedfiles.sort() |
|
1929 |
1914 |
1930 mnfst = self.manifest |
1915 mnfst = self.manifest |
1931 nodeiter = gennodelst(mnfst) |
1916 nodeiter = gennodelst(mnfst) |
1932 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |
1917 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |
1933 yield chnk |
1918 yield chnk |
1934 |
1919 |
1935 for fname in changedfiles: |
1920 for fname in util.sort(changedfiles): |
1936 filerevlog = self.file(fname) |
1921 filerevlog = self.file(fname) |
1937 if not len(filerevlog): |
1922 if not len(filerevlog): |
1938 raise util.Abort(_("empty or missing revlog for %s") % fname) |
1923 raise util.Abort(_("empty or missing revlog for %s") % fname) |
1939 nodeiter = gennodelst(filerevlog) |
1924 nodeiter = gennodelst(filerevlog) |
1940 nodeiter = list(nodeiter) |
1925 nodeiter = list(nodeiter) |