##// END OF EJS Templates
merge: forcefully mark files that we get from the second parent as dirty...
Alexis S. L. Carvalho -
r5210:90d9ec0d default
parent child Browse files
Show More
@@ -0,0 +1,31 b''
1 #!/bin/sh
2
3 # In the merge below, the file "foo" has the same contents in both
4 # parents, but if we look at the file-level history, we'll notice that
5 # the version in p1 is an ancestor of the version in p2. This test
6 # makes sure that we'll use the version from p2 in the manifest of the
7 # merge revision.
8
9 hg init repo
10 cd repo
11
12 echo foo > foo
13 hg ci -d '0 0' -qAm 'add foo'
14
15 echo bar >> foo
16 hg ci -d '0 0' -m 'change foo'
17
18 hg backout -d '0 0' -r tip -m 'backout changed foo'
19
20 hg up -C 0
21 touch bar
22 hg ci -d '0 0' -qAm 'add bar'
23
24 hg merge --debug
25 hg debugstate | grep foo
26 hg st -A foo
27 hg ci -d '0 0' -m 'merge'
28
29 hg manifest --debug | grep foo
30 hg debugindex .hg/store/data/foo.i
31
@@ -0,0 +1,17 b''
1 reverting foo
2 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
3 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 resolving manifests
5 overwrite None partial False
6 ancestor bbd179dfa0a7 local 71766447bdbb+ remote 4d9e78aaceee
7 foo: remote is newer -> g
8 getting foo
9 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 (branch merge, don't forget to commit)
11 n 0 -2 unset foo
12 M foo
13 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
14 rev offset length base linkrev nodeid p1 p2
15 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
16 1 5 9 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
17 2 14 5 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
@@ -1050,7 +1050,7 b' class queue:'
1050 for f in m:
1050 for f in m:
1051 repo.dirstate.normal(f)
1051 repo.dirstate.normal(f)
1052 for f in mm:
1052 for f in mm:
1053 repo.dirstate.normaldirty(f)
1053 repo.dirstate.normallookup(f)
1054 for f in forget:
1054 for f in forget:
1055 repo.dirstate.forget(f)
1055 repo.dirstate.forget(f)
1056
1056
@@ -202,18 +202,24 b' class dirstate(object):'
202 self._incpath(f)
202 self._incpath(f)
203
203
204 def normal(self, f):
204 def normal(self, f):
205 'mark a file normal'
205 'mark a file normal and clean'
206 self._dirty = True
206 self._dirty = True
207 s = os.lstat(self._join(f))
207 s = os.lstat(self._join(f))
208 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime)
208 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime)
209 if self._copymap.has_key(f):
209 if self._copymap.has_key(f):
210 del self._copymap[f]
210 del self._copymap[f]
211
211
212 def normaldirty(self, f):
212 def normallookup(self, f):
213 'mark a file normal, but possibly dirty'
213 'mark a file normal, but possibly dirty'
214 self._dirty = True
214 self._dirty = True
215 s = os.lstat(self._join(f))
215 self._map[f] = ('n', 0, -1, -1)
216 self._map[f] = ('n', s.st_mode, -1, -1)
216 if f in self._copymap:
217 del self._copymap[f]
218
219 def normaldirty(self, f):
220 'mark a file normal, but dirty'
221 self._dirty = True
222 self._map[f] = ('n', 0, -2, -1)
217 if f in self._copymap:
223 if f in self._copymap:
218 del self._copymap[f]
224 del self._copymap[f]
219
225
@@ -523,6 +529,7 b' class dirstate(object):'
523 st = lstat(_join(fn))
529 st = lstat(_join(fn))
524 if (size >= 0 and (size != st.st_size
530 if (size >= 0 and (size != st.st_size
525 or (mode ^ st.st_mode) & 0100)
531 or (mode ^ st.st_mode) & 0100)
532 or size == -2
526 or fn in self._copymap):
533 or fn in self._copymap):
527 madd(fn)
534 madd(fn)
528 elif time != int(st.st_mtime):
535 elif time != int(st.st_mtime):
@@ -998,7 +998,7 b' class localrepository(repo.repository):'
998 elif self.dirstate[f] in 'amn':
998 elif self.dirstate[f] in 'amn':
999 self.ui.warn(_("%s already tracked!\n") % f)
999 self.ui.warn(_("%s already tracked!\n") % f)
1000 elif self.dirstate[f] == 'r':
1000 elif self.dirstate[f] == 'r':
1001 self.dirstate.normaldirty(f)
1001 self.dirstate.normallookup(f)
1002 else:
1002 else:
1003 self.dirstate.add(f)
1003 self.dirstate.add(f)
1004 finally:
1004 finally:
@@ -543,7 +543,7 b' def recordupdates(repo, action, branchme'
543 # of that file some time in the past. Thus our
543 # of that file some time in the past. Thus our
544 # merge will appear as a normal local file
544 # merge will appear as a normal local file
545 # modification.
545 # modification.
546 repo.dirstate.normaldirty(fd)
546 repo.dirstate.normallookup(fd)
547 if move:
547 if move:
548 repo.dirstate.forget(f)
548 repo.dirstate.forget(f)
549 elif m == "d": # directory rename
549 elif m == "d": # directory rename
General Comments 0
You need to be logged in to leave comments. Login now