379
379
"""Return RevisionTree for the current last revision.
381
381
If the left most parent is a ghost then the returned tree will be an
382
empty tree - one obtained by calling repository.revision_tree(None).
382
empty tree - one obtained by calling
383
repository.revision_tree(NULL_REVISION).
385
386
revision_id = self.get_parent_ids()[0]
387
388
# no parents, return an empty revision tree.
388
389
# in the future this should return the tree for
389
390
# 'empty:' - the implicit root empty tree.
390
return self.branch.repository.revision_tree(None)
391
return self.branch.repository.revision_tree(
392
_mod_revision.NULL_REVISION)
392
394
return self.revision_tree(revision_id)
393
395
except errors.NoSuchRevision:
404
406
if self.branch.repository.has_revision(revision_id):
406
408
# the basis tree is a ghost so return an empty tree.
407
return self.branch.repository.revision_tree(None)
409
return self.branch.repository.revision_tree(
410
_mod_revision.NULL_REVISION)
409
412
def _cleanup(self):
410
413
self._flush_ignore_list_cache()
897
900
hashfile = self._transport.get('merge-hashes')
898
901
except errors.NoSuchFile:
902
if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
906
if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
907
raise errors.MergeModifiedFormatError()
908
except StopIteration:
903
909
raise errors.MergeModifiedFormatError()
904
except StopIteration:
905
raise errors.MergeModifiedFormatError()
906
for s in RioReader(hashfile):
907
# RioReader reads in Unicode, so convert file_ids back to utf8
908
file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
909
if file_id not in self.inventory:
911
text_hash = s.get("hash")
912
if text_hash == self.get_file_sha1(file_id):
913
merge_hashes[file_id] = text_hash
910
for s in RioReader(hashfile):
911
# RioReader reads in Unicode, so convert file_ids back to utf8
912
file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
913
if file_id not in self.inventory:
915
text_hash = s.get("hash")
916
if text_hash == self.get_file_sha1(file_id):
917
merge_hashes[file_id] = text_hash
916
922
@needs_write_lock
917
923
def mkdir(self, path, file_id=None):
2593
2599
except errors.NoSuchFile:
2594
2600
return _mod_conflicts.ConflictList()
2596
if confile.next() != CONFLICT_HEADER_1 + '\n':
2603
if confile.next() != CONFLICT_HEADER_1 + '\n':
2604
raise errors.ConflictFormatError()
2605
except StopIteration:
2597
2606
raise errors.ConflictFormatError()
2598
except StopIteration:
2599
raise errors.ConflictFormatError()
2600
return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
2607
return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
2602
2611
def unlock(self):
2603
2612
# do non-implementation specific cleanup