123
120
ERROR_PATH_NOT_FOUND = 3 # WindowsError errno code, equivalent to ENOENT
126
@deprecated_function(zero_thirteen)
127
def gen_file_id(name):
128
"""Return new file id for the basename 'name'.
130
Use bzrlib.generate_ids.gen_file_id() instead
132
return generate_ids.gen_file_id(name)
135
@deprecated_function(zero_thirteen)
137
"""Return a new tree-root file id.
139
This has been deprecated in favor of bzrlib.generate_ids.gen_root_id()
141
return generate_ids.gen_root_id()
144
123
class TreeEntry(object):
145
124
"""An entry that implements the minimum interface used by commands.
428
407
def _cleanup(self):
429
408
self._flush_ignore_list_cache()
432
@deprecated_method(zero_eight)
433
def create(branch, directory):
434
"""Create a workingtree for branch at directory.
436
If existing_directory already exists it must have a .bzr directory.
437
If it does not exist, it will be created.
439
This returns a new WorkingTree object for the new checkout.
441
TODO FIXME RBC 20060124 when we have checkout formats in place this
442
should accept an optional revisionid to checkout [and reject this if
443
checking out into the same dir as a pre-checkout-aware branch format.]
445
XXX: When BzrDir is present, these should be created through that
448
warnings.warn('delete WorkingTree.create', stacklevel=3)
449
transport = get_transport(directory)
450
if branch.bzrdir.root_transport.base == transport.base:
452
return branch.bzrdir.create_workingtree()
453
# different directory,
454
# create a branch reference
455
# and now a working tree.
456
raise NotImplementedError
459
@deprecated_method(zero_eight)
460
def create_standalone(directory):
461
"""Create a checkout and a branch and a repo at directory.
463
Directory must exist and be empty.
465
please use BzrDir.create_standalone_workingtree
467
return bzrdir.BzrDir.create_standalone_workingtree(directory)
469
410
def relpath(self, path):
470
411
"""Return the local path portion from a given path.
612
553
__contains__ = has_id
614
555
def get_file_size(self, file_id):
615
return os.path.getsize(self.id2abspath(file_id))
556
"""See Tree.get_file_size"""
558
return os.path.getsize(self.id2abspath(file_id))
560
if e.errno != errno.ENOENT:
618
566
def get_file_sha1(self, file_id, path=None, stat_value=None):
759
707
return (kind, None, None, None)
761
@deprecated_method(zero_eleven)
763
def pending_merges(self):
764
"""Return a list of pending merges.
766
These are revisions that have been merged into the working
767
directory but not yet committed.
769
As of 0.11 this is deprecated. Please see WorkingTree.get_parent_ids()
770
instead - which is available on all tree objects.
772
return self.get_parent_ids()[1:]
774
709
def _check_parents_for_ghosts(self, revision_ids, allow_leftmost_as_ghost):
775
710
"""Common ghost checking functionality from set_parent_*.
1533
1468
# - RBC 20060907
1534
1469
self._write_inventory(self._inventory)
1536
@deprecated_method(zero_eight)
1537
def iter_conflicts(self):
1538
"""List all files in the tree that have text or content conflicts.
1539
DEPRECATED. Use conflicts instead."""
1540
return self._iter_conflicts()
1542
1471
def _iter_conflicts(self):
1543
1472
conflicted = set()
1544
1473
for info in self.list_files():
2083
2012
"""Set the root id for this tree."""
2084
2013
# for compatability
2085
2014
if file_id is None:
2086
symbol_versioning.warn(symbol_versioning.zero_twelve
2087
% 'WorkingTree.set_root_id with fileid=None',
2092
file_id = osutils.safe_file_id(file_id)
2016
'WorkingTree.set_root_id with fileid=None')
2017
file_id = osutils.safe_file_id(file_id)
2093
2018
self._set_root_id(file_id)
2095
2020
def _set_root_id(self, file_id):
2637
2562
return path[:-len(suffix)]
2640
@deprecated_function(zero_eight)
2641
def is_control_file(filename):
2642
"""See WorkingTree.is_control_filename(filename)."""
2643
## FIXME: better check
2644
filename = normpath(filename)
2645
while filename != '':
2646
head, tail = os.path.split(filename)
2647
## mutter('check %r for control file' % ((head, tail),))
2650
if filename == head:
2656
2565
class WorkingTreeFormat(object):
2657
2566
"""An encapsulation of the initialization and open routines for a format.