##// END OF EJS Templates
dirstate: more explicit name, rename normaldirty() to otherparent()
Benoit Boissinot -
r10968:7a0d096e default
parent child Browse files
Show More
@@ -285,14 +285,15 b' class dirstate(object):'
285 '''Mark a file normal, but possibly dirty.'''
285 '''Mark a file normal, but possibly dirty.'''
286 if self._pl[1] != nullid and f in self._map:
286 if self._pl[1] != nullid and f in self._map:
287 # if there is a merge going on and the file was either
287 # if there is a merge going on and the file was either
288 # in state 'm' or dirty before being removed, restore that state.
288 # in state 'm' (-1) or coming from other parent (-2) before
289 # being removed, restore that state.
289 entry = self._map[f]
290 entry = self._map[f]
290 if entry[0] == 'r' and entry[2] in (-1, -2):
291 if entry[0] == 'r' and entry[2] in (-1, -2):
291 source = self._copymap.get(f)
292 source = self._copymap.get(f)
292 if entry[2] == -1:
293 if entry[2] == -1:
293 self.merge(f)
294 self.merge(f)
294 elif entry[2] == -2:
295 elif entry[2] == -2:
295 self.normaldirty(f)
296 self.otherparent(f)
296 if source:
297 if source:
297 self.copy(source, f)
298 self.copy(source, f)
298 return
299 return
@@ -304,8 +305,11 b' class dirstate(object):'
304 if f in self._copymap:
305 if f in self._copymap:
305 del self._copymap[f]
306 del self._copymap[f]
306
307
307 def normaldirty(self, f):
308 def otherparent(self, f):
308 '''Mark a file normal, but dirty.'''
309 '''Mark as coming from the other parent, always dirty.'''
310 if self._pl[1] == nullid:
311 raise util.Abort(_("setting %r to other parent "
312 "only allowed in merges") % f)
309 self._dirty = True
313 self._dirty = True
310 self._addpath(f)
314 self._addpath(f)
311 self._map[f] = ('n', 0, -2, -1)
315 self._map[f] = ('n', 0, -2, -1)
@@ -326,10 +330,11 b' class dirstate(object):'
326 self._droppath(f)
330 self._droppath(f)
327 size = 0
331 size = 0
328 if self._pl[1] != nullid and f in self._map:
332 if self._pl[1] != nullid and f in self._map:
333 # backup the previous state
329 entry = self._map[f]
334 entry = self._map[f]
330 if entry[0] == 'm':
335 if entry[0] == 'm': # merge
331 size = -1
336 size = -1
332 elif entry[0] == 'n' and entry[2] == -2:
337 elif entry[0] == 'n' and entry[2] == -2: # other parent
333 size = -2
338 size = -2
334 self._map[f] = ('r', 0, size, 0)
339 self._map[f] = ('r', 0, size, 0)
335 if size == 0 and f in self._copymap:
340 if size == 0 and f in self._copymap:
@@ -638,7 +643,7 b' class dirstate(object):'
638 if (size >= 0 and
643 if (size >= 0 and
639 (size != st.st_size
644 (size != st.st_size
640 or ((mode ^ st.st_mode) & 0100 and self._checkexec))
645 or ((mode ^ st.st_mode) & 0100 and self._checkexec))
641 or size == -2
646 or size == -2 # other parent
642 or fn in self._copymap):
647 or fn in self._copymap):
643 madd(fn)
648 madd(fn)
644 elif time != int(st.st_mtime):
649 elif time != int(st.st_mtime):
@@ -364,7 +364,7 b' def recordupdates(repo, action, branchme'
364 repo.dirstate.normallookup(f)
364 repo.dirstate.normallookup(f)
365 elif m == "g": # get
365 elif m == "g": # get
366 if branchmerge:
366 if branchmerge:
367 repo.dirstate.normaldirty(f)
367 repo.dirstate.otherparent(f)
368 else:
368 else:
369 repo.dirstate.normal(f)
369 repo.dirstate.normal(f)
370 elif m == "m": # merge
370 elif m == "m": # merge
@@ -507,8 +507,8 b' def update(repo, node, branchmerge, forc'
507 stats = applyupdates(repo, action, wc, p2)
507 stats = applyupdates(repo, action, wc, p2)
508
508
509 if not partial:
509 if not partial:
510 repo.dirstate.setparents(fp1, fp2)
510 recordupdates(repo, action, branchmerge)
511 recordupdates(repo, action, branchmerge)
511 repo.dirstate.setparents(fp1, fp2)
512 if not branchmerge and not fastforward:
512 if not branchmerge and not fastforward:
513 repo.dirstate.setbranch(p2.branch())
513 repo.dirstate.setbranch(p2.branch())
514 finally:
514 finally:
General Comments 0
You need to be logged in to leave comments. Login now