Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 471:7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 11 Jul 2012 20:40:47 +0200 |
parents | 909306e412e2 |
children | 5c09a9f2e073 |
comparison
equal
deleted
inserted
replaced
470:31bd09da0dcf | 471:7bcfbc255f48 |
---|---|
383 private void checkLocalStatusAgainstBaseRevision(Set<Path> baseRevNames, ManifestRevision collect, int baseRevision, Path fname, FileInfo f, HgStatusInspector inspector) { | 383 private void checkLocalStatusAgainstBaseRevision(Set<Path> baseRevNames, ManifestRevision collect, int baseRevision, Path fname, FileInfo f, HgStatusInspector inspector) { |
384 // fname is in the dirstate, either Normal, Added, Removed or Merged | 384 // fname is in the dirstate, either Normal, Added, Removed or Merged |
385 Nodeid nid1 = collect.nodeid(fname); | 385 Nodeid nid1 = collect.nodeid(fname); |
386 HgManifest.Flags flags = collect.flags(fname); | 386 HgManifest.Flags flags = collect.flags(fname); |
387 HgDirstate.Record r; | 387 HgDirstate.Record r; |
388 final HgDirstate ds = getDirstateImpl(); | |
388 if (nid1 == null) { | 389 if (nid1 == null) { |
389 // normal: added? | 390 // not known at the time of baseRevision: |
390 // added: not known at the time of baseRevision, shall report | 391 // normal, added, merged: either added or copied since base revision. |
391 // merged: was not known, report as added? | 392 // removed: nothing to report, |
392 if ((r = getDirstateImpl().checkNormal(fname)) != null) { | 393 if (ds.checkNormal(fname) != null || ds.checkMerged(fname) != null) { |
393 try { | 394 try { |
394 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); | 395 Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, baseRevNames, baseRevision); |
395 if (origin != null) { | 396 if (origin != null) { |
396 inspector.copied(getPathPool().mangle(origin), fname); | 397 inspector.copied(getPathPool().mangle(origin), fname); |
397 return; | 398 return; |
398 } | 399 } |
400 // fall-through, report as added | |
399 } catch (HgInvalidFileException ex) { | 401 } catch (HgInvalidFileException ex) { |
400 // report failure and continue status collection | 402 // report failure and continue status collection |
401 inspector.invalid(fname, ex); | 403 inspector.invalid(fname, ex); |
402 } | 404 } |
403 } else if ((r = getDirstateImpl().checkAdded(fname)) != null) { | 405 } else if ((r = ds.checkAdded(fname)) != null) { |
404 if (r.copySource() != null && baseRevNames.contains(r.copySource())) { | 406 if (r.copySource() != null && baseRevNames.contains(r.copySource())) { |
405 baseRevNames.remove(r.copySource()); // XXX surely I shall not report rename source as Removed? | 407 baseRevNames.remove(r.copySource()); // FIXME likely I shall report rename source as Removed, same as above for Normal? |
406 inspector.copied(r.copySource(), fname); | 408 inspector.copied(r.copySource(), fname); |
407 return; | 409 return; |
408 } | 410 } |
409 // fall-through, report as added | 411 // fall-through, report as added |
410 } else if (getDirstateImpl().checkRemoved(fname) != null) { | 412 } else if (ds.checkRemoved(fname) != null) { |
411 // removed: removed file was not known at the time of baseRevision, and we should not report it as removed | 413 // removed: removed file was not known at the time of baseRevision, and we should not report it as removed |
412 return; | 414 return; |
413 } | 415 } |
414 inspector.added(fname); | 416 inspector.added(fname); |
415 } else { | 417 } else { |
416 // was known; check whether clean or modified | 418 // was known; check whether clean or modified |
417 Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname); | 419 Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname); |
418 if ((r = getDirstateImpl().checkNormal(fname)) != null && nid1.equals(nidFromDirstate)) { | 420 if ((r = ds.checkNormal(fname)) != null && nid1.equals(nidFromDirstate)) { |
419 // regular file, was the same up to WC initialization. Check if was modified since, and, if not, report right away | 421 // regular file, was the same up to WC initialization. Check if was modified since, and, if not, report right away |
420 // same code as in #checkLocalStatusAgainstFile | 422 // same code as in #checkLocalStatusAgainstFile |
421 final boolean timestampEqual = f.lastModified() == r.modificationTime(), sizeEqual = r.size() == f.length(); | 423 final boolean timestampEqual = f.lastModified() == r.modificationTime(), sizeEqual = r.size() == f.length(); |
422 boolean handled = false; | 424 boolean handled = false; |
423 if (timestampEqual && sizeEqual) { | 425 if (timestampEqual && sizeEqual) { |
437 } | 439 } |
438 // otherwise, shall check actual content (size not the same, or unknown (-1 or -2), or timestamp is different, | 440 // otherwise, shall check actual content (size not the same, or unknown (-1 or -2), or timestamp is different, |
439 // or nodeid in dirstate is different, but local change might have brought it back to baseRevision state) | 441 // or nodeid in dirstate is different, but local change might have brought it back to baseRevision state) |
440 // FALL THROUGH | 442 // FALL THROUGH |
441 } | 443 } |
442 if (r != null || (r = getDirstateImpl().checkMerged(fname)) != null || (r = getDirstateImpl().checkAdded(fname)) != null) { | 444 if (r != null || (r = ds.checkMerged(fname)) != null || (r = ds.checkAdded(fname)) != null) { |
443 try { | 445 try { |
444 // check actual content to see actual changes | 446 // check actual content to see actual changes |
445 // when added - seems to be the case of a file added once again, hence need to check if content is different | 447 // when added - seems to be the case of a file added once again, hence need to check if content is different |
446 // either clean or modified | 448 // either clean or modified |
447 HgDataFile fileNode = repo.getFileNode(fname); | 449 HgDataFile fileNode = repo.getFileNode(fname); |