74
74
"""Branch holding a history of revisions.
76
:todo: Perhaps use different stores for different classes of object,
76
TODO: Perhaps use different stores for different classes of object,
77
77
so that we can keep track of how much space each one uses,
78
78
or garbage-collect them.
80
:todo: Add a RemoteBranch subclass. For the basic case of read-only
80
TODO: Add a RemoteBranch subclass. For the basic case of read-only
81
81
HTTP access this should be very easy by,
82
82
just redirecting controlfile access into HTTP requests.
83
83
We would need a RemoteStore working similarly.
85
:todo: Keep the on-disk branch locked while the object exists.
85
TODO: Keep the on-disk branch locked while the object exists.
87
:todo: mkdir() method.
89
89
def __init__(self, base, init=False, find_root=True):
90
90
"""Create new branch object at a particular location.
92
:param base: Base directory for the branch.
92
base -- Base directory for the branch.
94
:param init: If True, create new control files in a previously
94
init -- If True, create new control files in a previously
95
95
unversioned directory. If False, the branch must already
98
:param find_root: If true and init is false, find the root of the
98
find_root -- If true and init is false, find the root of the
99
99
existing branch containing base.
101
101
In the test suite, creation of new trees is tested using the
249
249
This puts the files in the Added state, so that they will be
250
250
recorded by the next commit.
252
:todo: Perhaps have an option to add the ids even if the files do
252
TODO: Perhaps have an option to add the ids even if the files do
255
:todo: Perhaps return the ids of the files? But then again it
255
TODO: Perhaps return the ids of the files? But then again it
256
256
is easy to retrieve them if they're needed.
258
:todo: Option to specify file id.
258
TODO: Option to specify file id.
260
:todo: Adding a directory should optionally recurse down and
260
TODO: Adding a directory should optionally recurse down and
261
261
add all non-ignored children. Perhaps do that in a
262
262
higher-level method.
337
337
This does not remove their text. This does not run on
339
:todo: Refuse to remove modified files unless --force is given?
339
TODO: Refuse to remove modified files unless --force is given?
341
341
>>> b = ScratchBranch(files=['foo'])
360
360
>>> b.working_tree().has_filename('foo')
363
:todo: Do something useful with directories.
363
TODO: Do something useful with directories.
365
:todo: Should this remove the text or not? Tough call; not
365
TODO: Should this remove the text or not? Tough call; not
366
366
removing may be useful and the user can just use use rm, and
367
367
is the opposite of add. Removing it is consistent with most
368
368
other tools. Maybe an option.
432
432
be robust against files disappearing, moving, etc. So the
433
433
whole thing is a bit hard.
435
:param timestamp: if not None, seconds-since-epoch for a
435
timestamp -- if not None, seconds-since-epoch for a
436
436
postdated/predated commit.
612
612
def get_inventory(self, inventory_id):
613
613
"""Get Inventory object by hash.
615
:todo: Perhaps for this and similar methods, take a revision
615
TODO: Perhaps for this and similar methods, take a revision
616
616
parameter which can be either an integer revno or a
618
618
i = Inventory.read_xml(self.inventory_store[inventory_id])
721
721
def write_log(self, show_timezone='original', verbose=False):
722
722
"""Write out human-readable log of commits to this branch
724
:param utc: If true, show dates in universal time, not local time."""
724
utc -- If true, show dates in universal time, not local time."""
725
725
## TODO: Option to choose either original, utc or local timezone
924
924
show_status(fs, kind, newname)
926
bailout("wierd file state %r" % ((fs, fid),))
926
bailout("weird file state %r" % ((fs, fid),))