comparison mercurial/localrepo.py @ 4263:4a1504264261

Fix localrepo.copy to deal with symbolic links.
author Eric St-Jean <esj@wwd.ca>
date Wed, 21 Mar 2007 23:20:56 -0400
parents 0d51eb296fb9
children 81402b2b294d
comparison
equal deleted inserted replaced
4262:ad33eeeeb50a 4263:4a1504264261
1070 self.wwrite(f, t, m.flags(f)) 1070 self.wwrite(f, t, m.flags(f))
1071 self.dirstate.update([f], "n") 1071 self.dirstate.update([f], "n")
1072 1072
1073 def copy(self, source, dest, wlock=None): 1073 def copy(self, source, dest, wlock=None):
1074 p = self.wjoin(dest) 1074 p = self.wjoin(dest)
1075 if not os.path.exists(p): 1075 if not (os.path.exists(p) or os.path.islink(p)):
1076 self.ui.warn(_("%s does not exist!\n") % dest) 1076 self.ui.warn(_("%s does not exist!\n") % dest)
1077 elif not os.path.isfile(p): 1077 elif not (os.path.isfile(p) or os.path.islink(p)):
1078 self.ui.warn(_("copy failed: %s is not a file\n") % dest) 1078 self.ui.warn(_("copy failed: %s is not a file or a "
1079 "symbolic link\n") % dest)
1079 else: 1080 else:
1080 if not wlock: 1081 if not wlock:
1081 wlock = self.wlock() 1082 wlock = self.wlock()
1082 if self.dirstate.state(dest) == '?': 1083 if self.dirstate.state(dest) == '?':
1083 self.dirstate.update([dest], "a") 1084 self.dirstate.update([dest], "a")