##// END OF EJS Templates
update: teach hg to override untracked dir with a tracked file on update...
Kostia Balytskyi -
r29480:1e4512ea default
parent child Browse files
Show More
@@ -1076,15 +1076,14 b' def batchget(repo, mctx, actions):'
1076 absf = repo.wjoin(f)
1076 absf = repo.wjoin(f)
1077 orig = scmutil.origpath(ui, repo, absf)
1077 orig = scmutil.origpath(ui, repo, absf)
1078 try:
1078 try:
1079 # TODO Mercurial has always aborted if an untracked
1080 # directory is replaced by a tracked file, or generally
1081 # with file/directory merges. This needs to be sorted out.
1082 if repo.wvfs.isfileorlink(f):
1079 if repo.wvfs.isfileorlink(f):
1083 util.rename(absf, orig)
1080 util.rename(absf, orig)
1084 except OSError as e:
1081 except OSError as e:
1085 if e.errno != errno.ENOENT:
1082 if e.errno != errno.ENOENT:
1086 raise
1083 raise
1087
1084
1085 if repo.wvfs.isdir(f):
1086 repo.wvfs.removedirs(f)
1088 wwrite(f, fctx(f).data(), flags, backgroundclose=True)
1087 wwrite(f, fctx(f).data(), flags, backgroundclose=True)
1089 if i == 100:
1088 if i == 100:
1090 yield i, f
1089 yield i, f
@@ -24,9 +24,10 b''
24 $ hg update 0
24 $ hg update 0
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26
26
27 Test interrupted updates by exploiting our non-handling of directory collisions
27 Test interrupted updates by having a non-empty dir with the same name as one
28 of the files in a commit we're updating to
28
29
29 $ mkdir b
30 $ mkdir b && touch b/nonempty
30 $ hg up
31 $ hg up
31 abort: *: '$TESTTMP/t/b' (glob)
32 abort: *: '$TESTTMP/t/b' (glob)
32 [255]
33 [255]
@@ -38,10 +39,10 b' Test interrupted updates by exploiting o'
38 parent: 0:538afb845929
39 parent: 0:538afb845929
39 commit #0
40 commit #0
40 branch: default
41 branch: default
41 commit: (interrupted update)
42 commit: 1 unknown (interrupted update)
42 update: 1 new changesets (update)
43 update: 1 new changesets (update)
43 phases: 2 draft
44 phases: 2 draft
44 $ rmdir b
45 $ rm b/nonempty
45 $ hg up
46 $ hg up
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ hg sum
48 $ hg sum
@@ -1,8 +1,9 b''
1 Test update logic when there are renames
1 Test update logic when there are renames or weird same-name cases between dirs
2 and files
2
3
3 Update with local changes across a file rename
4 Update with local changes across a file rename
4
5
5 $ hg init
6 $ hg init r1 && cd r1
6
7
7 $ echo a > a
8 $ echo a > a
8 $ hg add a
9 $ hg add a
@@ -24,3 +25,31 b' Update with local changes across a file '
24 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
25 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
25 use 'hg resolve' to retry unresolved file merges
26 use 'hg resolve' to retry unresolved file merges
26 [1]
27 [1]
28
29 Test update when local untracked directory exists with the same name as a
30 tracked file in a commit we are updating to
31 $ hg init r2 && cd r2
32 $ echo root > root && hg ci -Am root # rev 0
33 adding root
34 $ echo text > name && hg ci -Am "name is a file" # rev 1
35 adding name
36 $ hg up 0
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
38 $ mkdir name
39 $ hg up 1
40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41
42 Test update when local untracked directory exists with some files in it and has
43 the same name a tracked file in a commit we are updating to. In future this
44 should be updated to give an friendlier error message, but now we should just
45 make sure that this does not erase untracked data
46 $ hg up 0
47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 $ mkdir name
49 $ echo text > name/file
50 $ hg st
51 ? name/file
52 $ hg up 1
53 abort: *: '$TESTTMP/r1/r2/name' (glob)
54 [255]
55 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now