Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hg.py @ 862:d70c1c31fd45
Fix 3-way-merge of original parent, workdir and new parent.
The dirstate has to match what is in the repository (what would be
checked out with 'hg update -C'), because the resulting file may be
identical to the new parent, or it may be completely different.
Previously the dirstate wasn't updated, so if you changed the file to
look like the original parent, it might be considered unmodified
relative to the new parent.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 10 Aug 2005 06:47:46 +0100 |
parents | cbe5c4d016b7 |
children | a7e95e3606c7 |
comparison
equal
deleted
inserted
replaced
861:cbe5c4d016b7 | 862:d70c1c31fd45 |
---|---|
390 self.copies[dest] = source | 390 self.copies[dest] = source |
391 | 391 |
392 def copied(self, file): | 392 def copied(self, file): |
393 return self.copies.get(file, None) | 393 return self.copies.get(file, None) |
394 | 394 |
395 def update(self, files, state): | 395 def update(self, files, state, **kw): |
396 ''' current states: | 396 ''' current states: |
397 n normal | 397 n normal |
398 m needs merging | 398 m needs merging |
399 r marked for removal | 399 r marked for removal |
400 a marked for addition''' | 400 a marked for addition''' |
405 for f in files: | 405 for f in files: |
406 if state == "r": | 406 if state == "r": |
407 self.map[f] = ('r', 0, 0, 0) | 407 self.map[f] = ('r', 0, 0, 0) |
408 else: | 408 else: |
409 s = os.stat(os.path.join(self.root, f)) | 409 s = os.stat(os.path.join(self.root, f)) |
410 self.map[f] = (state, s.st_mode, s.st_size, s.st_mtime) | 410 st_mode = kw.get('st_mode', s.st_mode) |
411 st_size = kw.get('st_size', s.st_size) | |
412 st_mtime = kw.get('st_mtime', s.st_mtime) | |
413 self.map[f] = (state, st_mode, st_size, st_mtime) | |
411 | 414 |
412 def forget(self, files): | 415 def forget(self, files): |
413 if not files: return | 416 if not files: return |
414 self.read() | 417 self.read() |
415 self.markdirty() | 418 self.markdirty() |
1569 for f in files: | 1572 for f in files: |
1570 self.ui.status("merging %s\n" % f) | 1573 self.ui.status("merging %s\n" % f) |
1571 m, o, flag = merge[f] | 1574 m, o, flag = merge[f] |
1572 self.merge3(f, m, o) | 1575 self.merge3(f, m, o) |
1573 util.set_exec(self.wjoin(f), flag) | 1576 util.set_exec(self.wjoin(f), flag) |
1574 if moddirstate and mode == 'm': | 1577 if moddirstate: |
1575 # only update dirstate on branch merge, otherwise we | 1578 if mode == 'm': |
1576 # could mark files with changes as unchanged | 1579 # only update dirstate on branch merge, otherwise we |
1577 self.dirstate.update([f], mode) | 1580 # could mark files with changes as unchanged |
1581 self.dirstate.update([f], mode) | |
1582 elif p2 == nullid: | |
1583 # update dirstate from parent1's manifest | |
1584 m1n = self.changelog.read(p1)[0] | |
1585 m1 = self.manifest.read(m1n) | |
1586 file_ = self.file(f) | |
1587 f_len = file_.length(file_.rev(m1[f])) | |
1588 self.dirstate.update([f], mode, st_size=f_len, st_mtime=0) | |
1589 else: | |
1590 self.ui.warn("Second parent without branch merge!?\n" | |
1591 "Dirstate for file %s may be wrong.\n" % f) | |
1578 | 1592 |
1579 remove.sort() | 1593 remove.sort() |
1580 for f in remove: | 1594 for f in remove: |
1581 self.ui.note("removing %s\n" % f) | 1595 self.ui.note("removing %s\n" % f) |
1582 try: | 1596 try: |