Mercurial > hg
comparison mercurial/localrepo.py @ 6743:86e8187b721a
simplify flag handling
add _checklink var to dirstate
introduce dirstate.flagfunc
switch users of util.execfunc/linkfunc to flagfunc
change manifestdict.set to take a flags string
change ctx.fileflags to ctx.flags
change gitmode func to a dict
remove util.execfunc/linkfunc
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Jun 2008 13:46:34 -0500 |
parents | 2d54e7c1e69d |
children | f6c00b17387c |
comparison
equal
deleted
inserted
replaced
6742:2d54e7c1e69d | 6743:86e8187b721a |
---|---|
835 commit.sort() | 835 commit.sort() |
836 for f in commit: | 836 for f in commit: |
837 self.ui.note(f + "\n") | 837 self.ui.note(f + "\n") |
838 try: | 838 try: |
839 fctx = wctx.filectx(f) | 839 fctx = wctx.filectx(f) |
840 newflags = fctx.flags() | |
840 new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed) | 841 new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed) |
841 new_exec = fctx.isexec() | |
842 new_link = fctx.islink() | |
843 if ((not changed or changed[-1] != f) and | 842 if ((not changed or changed[-1] != f) and |
844 m2.get(f) != new[f]): | 843 m2.get(f) != new[f]): |
845 # mention the file in the changelog if some | 844 # mention the file in the changelog if some |
846 # flag changed, even if there was no content | 845 # flag changed, even if there was no content |
847 # change. | 846 # change. |
848 old_exec = m1.execf(f) | 847 if m1.flags(f) != newflags: |
849 old_link = m1.linkf(f) | |
850 if old_exec != new_exec or old_link != new_link: | |
851 changed.append(f) | 848 changed.append(f) |
852 m1.set(f, new_exec, new_link) | 849 m1.set(f, newflags) |
853 if use_dirstate: | 850 if use_dirstate: |
854 self.dirstate.normal(f) | 851 self.dirstate.normal(f) |
855 | 852 |
856 except (OSError, IOError): | 853 except (OSError, IOError): |
857 if use_dirstate: | 854 if use_dirstate: |
1007 if compareworking: | 1004 if compareworking: |
1008 if lookup: | 1005 if lookup: |
1009 fixup = [] | 1006 fixup = [] |
1010 # do a full compare of any files that might have changed | 1007 # do a full compare of any files that might have changed |
1011 ctx = self.changectx('') | 1008 ctx = self.changectx('') |
1012 mexec = lambda f: 'x' in ctx.fileflags(f) | 1009 ff = self.dirstate.flagfunc(ctx.flags) |
1013 mlink = lambda f: 'l' in ctx.fileflags(f) | |
1014 is_exec = util.execfunc(self.root, mexec) | |
1015 is_link = util.linkfunc(self.root, mlink) | |
1016 def flags(f): | |
1017 return is_link(f) and 'l' or is_exec(f) and 'x' or '' | |
1018 for f in lookup: | 1010 for f in lookup: |
1019 if (f not in ctx or flags(f) != ctx.fileflags(f) | 1011 if (f not in ctx or ff(f) != ctx.flags(f) |
1020 or ctx[f].cmp(self.wread(f))): | 1012 or ctx[f].cmp(self.wread(f))): |
1021 modified.append(f) | 1013 modified.append(f) |
1022 else: | 1014 else: |
1023 fixup.append(f) | 1015 fixup.append(f) |
1024 if list_clean: | 1016 if list_clean: |
1040 else: | 1032 else: |
1041 # we are comparing working dir against non-parent | 1033 # we are comparing working dir against non-parent |
1042 # generate a pseudo-manifest for the working dir | 1034 # generate a pseudo-manifest for the working dir |
1043 # XXX: create it in dirstate.py ? | 1035 # XXX: create it in dirstate.py ? |
1044 mf2 = mfmatches(self.dirstate.parents()[0]) | 1036 mf2 = mfmatches(self.dirstate.parents()[0]) |
1045 is_exec = util.execfunc(self.root, mf2.execf) | 1037 ff = self.dirstate.flagfunc(mf2.flags) |
1046 is_link = util.linkfunc(self.root, mf2.linkf) | |
1047 for f in lookup + modified + added: | 1038 for f in lookup + modified + added: |
1048 mf2[f] = "" | 1039 mf2[f] = "" |
1049 mf2.set(f, is_exec(f), is_link(f)) | 1040 mf2.set(f, ff(f)) |
1050 for f in removed: | 1041 for f in removed: |
1051 if f in mf2: | 1042 if f in mf2: |
1052 del mf2[f] | 1043 del mf2[f] |
1053 | 1044 |
1054 else: | 1045 else: |