##// END OF EJS Templates
merge: while checking for unknown files don't follow symlinks (issue5027)...
Siddharth Agarwal -
r27571:6a6e78f8 stable
parent child Browse files
Show More
@@ -404,7 +404,7 b' class mergestate(object):'
404 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
404 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
405 if f2 is None:
405 if f2 is None:
406 f2 = f
406 f2 = f
407 return (os.path.isfile(repo.wjoin(f))
407 return (repo.wvfs.isfileorlink(f)
408 and repo.wvfs.audit.check(f)
408 and repo.wvfs.audit.check(f)
409 and repo.dirstate.normalize(f) not in repo.dirstate
409 and repo.dirstate.normalize(f) not in repo.dirstate
410 and mctx[f2].cmp(wctx[f]))
410 and mctx[f2].cmp(wctx[f]))
@@ -312,6 +312,17 b' class abstractvfs(object):'
312 def islink(self, path=None):
312 def islink(self, path=None):
313 return os.path.islink(self.join(path))
313 return os.path.islink(self.join(path))
314
314
315 def isfileorlink(self, path=None):
316 '''return whether path is a regular file or a symlink
317
318 Unlike isfile, this doesn't follow symlinks.'''
319 try:
320 st = self.lstat(path)
321 except OSError:
322 return False
323 mode = st.st_mode
324 return stat.S_ISREG(mode) or stat.S_ISLNK(mode)
325
315 def reljoin(self, *paths):
326 def reljoin(self, *paths):
316 """join various elements of a path together (as os.path.join would do)
327 """join various elements of a path together (as os.path.join would do)
317
328
@@ -102,6 +102,28 b' merge should fail'
102 b: untracked file differs
102 b: untracked file differs
103 abort: untracked files in working directory differ from files in requested revision
103 abort: untracked files in working directory differ from files in requested revision
104 [255]
104 [255]
105
106 #if symlink
107 symlinks to directories should be treated as regular files (issue5027)
108 $ rm b
109 $ ln -s 'This is file b2' b
110 $ hg merge 1
111 b: untracked file differs
112 abort: untracked files in working directory differ from files in requested revision
113 [255]
114 symlinks shouldn't be followed
115 $ rm b
116 $ echo This is file b1 > .hg/b
117 $ ln -s .hg/b b
118 $ hg merge 1
119 b: untracked file differs
120 abort: untracked files in working directory differ from files in requested revision
121 [255]
122
123 $ rm b
124 $ echo This is file b2 > b
125 #endif
126
105 merge of b expected
127 merge of b expected
106 $ hg merge -f 1
128 $ hg merge -f 1
107 merging b
129 merging b
General Comments 0
You need to be logged in to leave comments. Login now