26
26
## applies and recreates the right state.
29
## This is not quite safe if the working copy changes during the
30
## commit; for the moment that is simply not allowed. A better
31
## approach is to make a temporary copy of the files before
32
## computing their hashes, and then add those hashes in turn to
33
## the inventory. This should mean at least that there are no
34
## broken hash pointers. There is no way we can get a snapshot
35
## of the whole directory at an instant. This would also have to
36
## be robust against files disappearing, moving, etc. So the
37
## whole thing is a bit hard.
39
## The newly committed revision is going to have a shape corresponding
40
## to that of the working inventory. Files that are not in the
41
## working tree and that were in the predecessor are reported as
42
## removed -- this can include files that were either removed from the
43
## inventory or deleted in the working tree. If they were only
44
## deleted from disk, they are removed from the working inventory.
46
## We then consider the remaining entries, which will be in the new
47
## version. Directory entries are simply copied across. File entries
48
## must be checked to see if a new version of the file should be
49
## recorded. For each parent revision inventory, we check to see what
50
## version of the file was present. If the file was present in at
51
## least one tree, and if it was the same version in all the trees,
52
## then we can just refer to that version. Otherwise, a new version
53
## representing the merger of the file versions must be added.
120
148
store, then the inventory, then make a new revision pointing
121
149
to that inventory and store that.
123
This is not quite safe if the working copy changes during the
124
commit; for the moment that is simply not allowed. A better
125
approach is to make a temporary copy of the files before
126
computing their hashes, and then add those hashes in turn to
127
the inventory. This should mean at least that there are no
128
broken hash pointers. There is no way we can get a snapshot
129
of the whole directory at an instant. This would also have to
130
be robust against files disappearing, moving, etc. So the
131
whole thing is a bit hard.
133
151
This raises PointlessCommit if there are no changes, no new merges,
134
152
and allow_pointless is false.
191
209
if self.rev_id is None:
192
210
self.rev_id = _gen_revision_id(self.branch, time.time())
212
self._remove_deletions()
194
214
# TODO: update hashcache
195
215
self.delta = compare_trees(self.basis_tree, self.work_tree,
196
216
specific_files=self.specific_files)