266 self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0]) |
266 self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0]) |
267 wlock = lock.lock(self.join("wlock"), wait, self.dirstate.write) |
267 wlock = lock.lock(self.join("wlock"), wait, self.dirstate.write) |
268 self.dirstate.read() |
268 self.dirstate.read() |
269 return wlock |
269 return wlock |
270 |
270 |
|
271 def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): |
|
272 "determine whether a new filenode is needed" |
|
273 fp1 = manifest1.get(filename, nullid) |
|
274 fp2 = manifest2.get(filename, nullid) |
|
275 |
|
276 if fp2 != nullid: |
|
277 # is one parent an ancestor of the other? |
|
278 fpa = filelog.ancestor(fp1, fp2) |
|
279 if fpa == fp1: |
|
280 fp1, fp2 = fp2, nullid |
|
281 elif fpa == fp2: |
|
282 fp2 = nullid |
|
283 |
|
284 # is the file unmodified from the parent? report existing entry |
|
285 if fp2 == nullid and text == filelog.read(fp1): |
|
286 return (fp1, None, None) |
|
287 |
|
288 return (None, fp1, fp2) |
|
289 |
271 def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
290 def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
272 orig_parent = self.dirstate.parents()[0] or nullid |
291 orig_parent = self.dirstate.parents()[0] or nullid |
273 p1 = p1 or self.dirstate.parents()[0] or nullid |
292 p1 = p1 or self.dirstate.parents()[0] or nullid |
274 p2 = p2 or self.dirstate.parents()[1] or nullid |
293 p2 = p2 or self.dirstate.parents()[1] or nullid |
275 c1 = self.changelog.read(p1) |
294 c1 = self.changelog.read(p1) |
296 t = self.wread(f) |
315 t = self.wread(f) |
297 tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
316 tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
298 r = self.file(f) |
317 r = self.file(f) |
299 mfm[f] = tm |
318 mfm[f] = tm |
300 |
319 |
301 fp1 = m1.get(f, nullid) |
320 (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) |
302 fp2 = m2.get(f, nullid) |
321 if entry: |
303 |
322 mm[f] = entry |
304 # is the same revision on two branches of a merge? |
323 continue |
305 if fp2 == fp1: |
|
306 fp2 = nullid |
|
307 |
|
308 if fp2 != nullid: |
|
309 # is one parent an ancestor of the other? |
|
310 fpa = r.ancestor(fp1, fp2) |
|
311 if fpa == fp1: |
|
312 fp1, fp2 = fp2, nullid |
|
313 elif fpa == fp2: |
|
314 fp2 = nullid |
|
315 |
|
316 # is the file unmodified from the parent? |
|
317 if t == r.read(fp1): |
|
318 # record the proper existing parent in manifest |
|
319 # no need to add a revision |
|
320 mm[f] = fp1 |
|
321 continue |
|
322 |
324 |
323 mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) |
325 mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) |
324 changed.append(f) |
326 changed.append(f) |
325 if update_dirstate: |
327 if update_dirstate: |
326 self.dirstate.update([f], "n") |
328 self.dirstate.update([f], "n") |
401 meta["copy"] = cp |
403 meta["copy"] = cp |
402 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid))) |
404 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid))) |
403 self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) |
405 self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) |
404 fp1, fp2 = nullid, nullid |
406 fp1, fp2 = nullid, nullid |
405 else: |
407 else: |
406 fp1 = m1.get(f, nullid) |
408 entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) |
407 fp2 = m2.get(f, nullid) |
409 if entry: |
408 |
410 new[f] = entry |
409 if fp2 != nullid: |
|
410 # is one parent an ancestor of the other? |
|
411 fpa = r.ancestor(fp1, fp2) |
|
412 if fpa == fp1: |
|
413 fp1, fp2 = fp2, nullid |
|
414 elif fpa == fp2: |
|
415 fp2 = nullid |
|
416 |
|
417 # is the file unmodified from the parent? |
|
418 if not meta and t == r.read(fp1) and fp2 == nullid: |
|
419 # record the proper existing parent in manifest |
|
420 # no need to add a revision |
|
421 new[f] = fp1 |
|
422 continue |
411 continue |
423 |
412 |
424 new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
413 new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
425 # remember what we've added so that we can later calculate |
414 # remember what we've added so that we can later calculate |
426 # the files to pull from a set of changesets |
415 # the files to pull from a set of changesets |