##// END OF EJS Templates
copies: properly visit file context ancestors on working file contexts
Henrik Stuart -
r10874:4f11978a stable
parent child Browse files
Show More
@@ -0,0 +1,19 b''
1 #!/bin/sh
2
3 # test update logic when there are renames
4
5
6 # update with local changes across a file rename
7 hg init a
8 cd a
9 echo a > a
10 hg add a
11 hg ci -m a
12 hg mv a b
13 hg ci -m rename
14 echo b > b
15 hg ci -m change
16 hg up -q 0
17 echo c > a
18 hg up
19 cd ..
@@ -0,0 +1,5 b''
1 merging a and b to b
2 warning: conflicts during merge.
3 merging b failed!
4 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
5 use 'hg resolve' to retry unresolved file merges
@@ -117,8 +117,23 b' def copies(repo, c1, c2, ca, checkdirs=F'
117 diverge = {}
117 diverge = {}
118
118
119 def related(f1, f2, limit):
119 def related(f1, f2, limit):
120 # Walk back to common ancestor to see if the two files originate
121 # from the same file. Since workingfilectx's rev() is None it messes
122 # up the integer comparison logic, hence the pre-step check for
123 # None (f1 and f2 can only be workingfilectx's initially).
124
125 if f1 == f2:
126 return f1 # a match
127
120 g1, g2 = f1.ancestors(), f2.ancestors()
128 g1, g2 = f1.ancestors(), f2.ancestors()
121 try:
129 try:
130 f1r, f2r = f1.rev(), f2.rev()
131
132 if f1r is None:
133 f1 = g1.next()
134 if f2r is None:
135 f2 = g2.next()
136
122 while 1:
137 while 1:
123 f1r, f2r = f1.rev(), f2.rev()
138 f1r, f2r = f1.rev(), f2.rev()
124 if f1r > f2r:
139 if f1r > f2r:
General Comments 0
You need to be logged in to leave comments. Login now