281
281
change_scanner = self._repository._file_change_scanner
282
282
if self.commit_id == ZERO_SHA:
283
283
return NULL_REVISION
284
(path, commit_id) = change_scanner.find_last_change_revision(
284
(unused_path, commit_id) = change_scanner.find_last_change_revision(
285
285
path.encode('utf-8'), self.commit_id)
286
286
return self._repository.lookup_foreign_revision_id(commit_id, self.mapping)
301
301
path = self._fileid_map.lookup_path(file_id)
302
302
except ValueError:
303
303
raise errors.NoSuchId(self, file_id)
304
path = path.decode('utf-8')
305
304
if self.is_versioned(path):
307
306
raise errors.NoSuchId(self, file_id)
686
685
if target_extras is None:
687
686
target_extras = set()
688
687
for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
688
if oldpath is not None:
689
oldpath_decoded = oldpath.decode('utf-8')
691
oldpath_decoded = None
692
if newpath is not None:
693
newpath_decoded = newpath.decode('utf-8')
695
newpath_decoded = None
689
696
if not (specific_files is None or
690
(oldpath is not None and osutils.is_inside_or_parent_of_any(specific_files, oldpath)) or
691
(newpath is not None and osutils.is_inside_or_parent_of_any(specific_files, newpath))):
697
(oldpath_decoded is not None and osutils.is_inside_or_parent_of_any(specific_files, oldpath_decoded)) or
698
(newpath_decoded is not None and osutils.is_inside_or_parent_of_any(specific_files, newpath_decoded))):
693
path = (oldpath, newpath)
694
700
if oldpath is not None and mapping.is_special_file(oldpath):
696
702
if newpath is not None and mapping.is_special_file(newpath):
699
fileid = mapping.generate_file_id(newpath)
704
if oldpath_decoded is None:
705
fileid = mapping.generate_file_id(newpath_decoded)
704
710
oldversioned = False
706
712
oldversioned = True
707
oldpath = oldpath.decode("utf-8")
709
714
oldexe = mode_is_executable(oldmode)
710
715
oldkind = mode_kind(oldmode)
719
if oldpath_decoded == u'':
718
(oldparentpath, oldname) = osutils.split(oldpath)
723
(oldparentpath, oldname) = osutils.split(oldpath_decoded)
719
724
oldparent = mapping.generate_file_id(oldparentpath)
720
fileid = mapping.generate_file_id(oldpath)
725
fileid = mapping.generate_file_id(oldpath_decoded)
726
if newpath_decoded is None:
726
731
newversioned = False
728
newversioned = (newpath not in target_extras)
733
newversioned = (newpath_decoded not in target_extras)
730
735
newexe = mode_is_executable(newmode)
731
736
newkind = mode_kind(newmode)
735
newpath = newpath.decode("utf-8")
740
if newpath_decoded == u'':
740
newparentpath, newname = osutils.split(newpath)
744
newparentpath, newname = osutils.split(newpath_decoded)
741
745
newparent = mapping.generate_file_id(newparentpath)
742
746
if (not include_unchanged and
743
747
oldkind == 'directory' and newkind == 'directory' and
748
oldpath_decoded == newpath_decoded):
746
yield (fileid, (oldpath, newpath), (oldsha != newsha),
750
yield (fileid, (oldpath_decoded, newpath_decoded), (oldsha != newsha),
747
751
(oldversioned, newversioned),
748
752
(oldparent, newparent), (oldname, newname),
749
753
(oldkind, newkind), (oldexe, newexe))
901
905
path = self._fileid_map.lookup_path(file_id)
902
906
except ValueError:
903
907
raise errors.NoSuchId(self, file_id)
904
path = path.decode('utf-8')
905
908
if self.is_versioned(path):
907
910
raise errors.NoSuchId(self, file_id)
910
913
self._fileid_map.set_file_id("", file_id)
912
915
def get_root_id(self):
913
return self.path2id("")
916
return self.path2id(u"")
915
918
def _add(self, files, ids, kinds):
916
919
for (path, file_id, kind) in zip(files, ids, kinds):
1231
1234
self._index_add_entry(to_rel, kind)
1233
todo = [(p, i) for (p, i) in self._recurse_index_entries() if p.startswith(from_path+'/')]
1236
todo = [(p, i) for (p, i) in self._recurse_index_entries() if p.startswith(from_path+b'/')]
1234
1237
for child_path, child_value in todo:
1235
1238
(child_to_index, child_to_index_path) = self._lookup_index(
1236
1239
posixpath.join(to_path, posixpath.relpath(child_path, from_path)))