Rev 3604: Implement the oft-discussed automatic-add-and-delete at commit time. in http://people.ubuntu.com/~robertc/baz2.0/5158
Robert Collins
robertc at robertcollins.net
Tue Aug 5 10:43:54 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/5158
------------------------------------------------------------
revno: 3604
revision-id: robertc at robertcollins.net-20080805094341-uelcr4qz98trh2yj
parent: pqm at pqm.ubuntu.com-20080805011407-wmq7130znc0e6c4x
committer: Robert Collins <robertc at robertcollins.net>
branch nick: 5158
timestamp: Tue 2008-08-05 19:43:41 +1000
message:
Implement the oft-discussed automatic-add-and-delete at commit time.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
bzrlib/tests/test_bundle.py test.py-20050630184834-092aa401ab9f039c
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
bzrlib/tests/test_revert.py test_revert.py-20060828180832-fqb1v6ecpyvnlitj-1
bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
bzrlib/tests/workingtree_implementations/test_executable.py test_executable.py-20060628162557-tr7h57kl80l3ma8i-1
bzrlib/tests/workingtree_implementations/test_merge_from_branch.py test_merge_from_bran-20060904034200-12jxyk2zlhpufxe1-1
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS 2008-08-04 22:41:18 +0000
+++ b/NEWS 2008-08-05 09:43:41 +0000
@@ -10,10 +10,15 @@
CHANGES:
+ * ``bzr commit`` no longer automatically notices deleted files (unless
+ ``-a`` or ``--auto-add-delete`` is supplied.) Additionally, when
+ ``-a`` or ``--auto-add-delete`` is supplied bzr will do a
+ ``bzr add`` at the start of the commit. (Robert Collins, #5158)
+
* Knit format repositories are deprecated and bzr will now emit
warnings whenever it encounters one. Use ``bzr upgrade`` to upgrade
knit repositories to pack format. (Andrew Bennetts)
-
+
FEATURES:
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-08-04 07:29:51 +0000
+++ b/bzrlib/builtins.py 2008-08-05 09:43:41 +0000
@@ -2161,6 +2161,8 @@
_see_also = ['bugs', 'uncommit']
takes_args = ['selected*']
takes_options = [
+ Option('auto-add-delete', short_name='a',
+ help="Automatically add new files and delete missing files."),
ListOption('exclude', type=str, short_name='x',
help="Do not consider changes made to a given path."),
Option('message', type=unicode,
@@ -2217,7 +2219,7 @@
def run(self, message=None, file=None, verbose=False, selected_list=None,
unchanged=False, strict=False, local=False, fixes=None,
- author=None, show_diff=False, exclude=None):
+ author=None, show_diff=False, exclude=None, auto_add_delete=False):
from bzrlib.errors import (
PointlessCommit,
ConflictsInTree,
@@ -2279,7 +2281,8 @@
allow_pointless=unchanged, strict=strict, local=local,
reporter=None, verbose=verbose, revprops=properties,
author=author,
- exclude=safe_relpath_files(tree, exclude))
+ exclude=safe_relpath_files(tree, exclude),
+ auto_add_delete=auto_add_delete)
except PointlessCommit:
# FIXME: This should really happen before the file is read in;
# perhaps prepare the commit; get the message; then actually commit
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2008-08-04 22:07:34 +0000
+++ b/bzrlib/commit.py 2008-08-05 09:43:41 +0000
@@ -205,7 +205,8 @@
config=None,
message_callback=None,
recursive='down',
- exclude=None):
+ exclude=None,
+ auto_add_delete=False):
"""Commit working copy as a new revision.
:param message: the commit message (it or message_callback is required)
@@ -236,6 +237,8 @@
:param exclude: None or a list of relative paths to exclude from the
commit. Pending changes to excluded files will be ignored by the
commit.
+ :param auto_add_delete: If True automatically add unversioned files (as
+ per bzr add) and remove missing files.
"""
mutter('preparing to commit')
@@ -255,7 +258,7 @@
else:
raise BzrError("The message or message_callback keyword"
" parameter is required for commit().")
-
+ self.auto_add_delete = auto_add_delete
self.bound_branch = None
self.any_entries_changed = False
self.any_entries_deleted = False
@@ -717,7 +720,10 @@
# raise an exception as soon as we find a single unknown.
for unknown in self.work_tree.unknowns():
raise StrictCommitFailed()
-
+ elif self.auto_add_delete:
+ # XXX: the smart_add api really needs a cleanup
+ self.work_tree.smart_add([self.work_tree.abspath('.')])
+ auto_add_delete = self.auto_add_delete
specific_files = self.specific_files
exclude = self.exclude
report_changes = self.reporter.is_verbose()
@@ -766,15 +772,18 @@
# skip/record deleted files matching that filter.
if not specific_files or is_inside_any(specific_files, path):
if content_summary[0] == 'missing':
- if not deleted_paths:
- # path won't have been split yet.
- path_segments = splitpath(path)
- deleted_dict = deleted_paths
- for segment in path_segments:
- deleted_dict = deleted_dict.setdefault(segment, {})
- self.reporter.missing(path)
- deleted_ids.append(file_id)
- continue
+ if auto_add_delete:
+ if not deleted_paths:
+ # path won't have been split yet.
+ path_segments = splitpath(path)
+ deleted_dict = deleted_paths
+ for segment in path_segments:
+ deleted_dict = deleted_dict.setdefault(segment, {})
+ self.reporter.missing(path)
+ deleted_ids.append(file_id)
+ continue
+ else:
+ raise errors.MissingFilesCommitFailed([path])
# TODO: have the builder do the nested commit just-in-time IF and
# only if needed.
if content_summary[0] == 'tree-reference':
@@ -804,8 +813,11 @@
parent_id, definitely_changed, existing_ie, report_changes,
content_summary)
- # Unversion IDs that were found to be deleted
- self.work_tree.unversion(deleted_ids)
+ if deleted_ids:
+ if self.strict:
+ raise StrictCommitFailed()
+ # Unversion IDs that were found to be deleted
+ self.work_tree.unversion(deleted_ids)
def _commit_nested_tree(self, file_id, path):
"Commit a nested tree."
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2008-08-03 00:36:46 +0000
+++ b/bzrlib/errors.py 2008-08-05 09:43:41 +0000
@@ -1077,6 +1077,18 @@
'the current encoding.'
+class MissingFilesCommitFailed(BzrError):
+
+ _fmt = ("Some files were missing but have not been removed by 'bzr rm'. "
+ "You can supply -a to the commit, remove them with 'bzr rm', tell "
+ "bzr they have been renamed with 'bzr mv', or restore them if they "
+ "were accidentally deleted via 'bzr revert'. The files were: "
+ "%(files)s.")
+
+ def __init__(self, files):
+ BzrError.__init__(self, files=files)
+
+
class UpgradeReadonly(BzrError):
_fmt = "Upgrade URL cannot work with readonly URLs."
@@ -1091,11 +1103,6 @@
self.format = format
-class StrictCommitFailed(Exception):
-
- _fmt = "Commit refused because there are unknowns in the tree."
-
-
class NoSuchRevision(InternalBzrError):
_fmt = "%(branch)s has no revision %(revision)s"
=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py 2008-08-05 00:06:19 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py 2008-08-05 09:43:41 +0000
@@ -235,6 +235,36 @@
'Committed revision 2.\n' % (expected, ),
err)
+ def test_commit_missing_error(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo'])
+ tree.add('foo')
+ self.get_transport('.').delete('foo')
+ self.run_bzr_error(["files were missing"],
+ ['commit', '-m', 'do a commit'])
+
+ def test_commit_auto_add_and_delete(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo', 'bar'])
+ tree.add('foo')
+ self.get_transport('.').delete('foo')
+ self.run_bzr(['commit', '-m' , 'first post', '--auto-add-delete'])
+ self.assertEqual(None, tree.path2id('foo'))
+ self.assertNotEqual(None, tree.path2id('bar'))
+
+ def test_commit_auto_add_and_delete_strict_wins(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo', 'bar'])
+ tree.add('foo')
+ # First with the unadded 'bar'
+ self.run_bzr_error(['Commit refused '],
+ ['commit', '-m' , 'first post', '-a', '--strict'])
+ # Now with a deleted 'foo'
+ tree.add('bar')
+ self.get_transport('.').delete('foo')
+ self.run_bzr_error(['Commit refused '],
+ ['commit', '-m' , 'first post', '-a', '--strict'])
+
def test_empty_commit_message(self):
tree = self.make_branch_and_tree('.')
self.build_tree_contents([('foo.c', 'int main() {}')])
=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py 2008-03-07 14:15:10 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py 2008-08-05 09:43:41 +0000
@@ -122,7 +122,7 @@
os.remove('a/sub/c.txt')
os.rmdir('a/sub')
os.remove('a/b.txt')
- a_tree.commit(message='Removed a.txt')
+ a_tree.commit(message='Removed a.txt', auto_add_delete=True)
self.build_tree_contents([
('b/sub/a.txt', 'hello\nsomething\n'),
('b/b.txt', 'hello\nsomething\n'),
=== modified file 'bzrlib/tests/test_bundle.py'
--- a/bzrlib/tests/test_bundle.py 2008-06-11 04:20:16 +0000
+++ b/bzrlib/tests/test_bundle.py 2008-08-05 09:43:41 +0000
@@ -688,7 +688,7 @@
trans_id = tt.trans_id_tree_file_id('link-1')
tt.delete_contents(trans_id)
tt.apply()
- self.tree1.commit('Delete symlink', rev_id='l at cset-0-4')
+ self.tree1.commit('Delete symlink', rev_id='l at cset-0-4', auto_add_delete=True)
self.get_valid_bundle('l at cset-0-3', 'l at cset-0-4')
def test_binary_bundle(self):
@@ -709,7 +709,7 @@
trans_id = tt.trans_id_tree_file_id('binary-1')
tt.delete_contents(trans_id)
tt.apply()
- self.tree1.commit('delete binary', rev_id='b at cset-0-2')
+ self.tree1.commit('delete binary', rev_id='b at cset-0-2', auto_add_delete=True)
self.get_valid_bundle('b at cset-0-1', 'b at cset-0-2')
# Rename & modify
=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py 2008-04-18 18:11:56 +0000
+++ b/bzrlib/tests/test_commit.py 2008-08-05 09:43:41 +0000
@@ -116,7 +116,7 @@
wt.commit(message='add hello')
os.remove('hello')
- wt.commit('removed hello', rev_id='rev2')
+ wt.commit('removed hello', rev_id='rev2', auto_add_delete=True)
tree = b.repository.revision_tree('rev2')
self.assertFalse(tree.has_id('hello-id'))
@@ -188,7 +188,7 @@
wt.commit(message='remove hello',
specific_files=['hello'],
allow_pointless=False,
- rev_id='test at rev-3')
+ rev_id='test at rev-3', auto_add_delete=True)
eq = self.assertEquals
eq(b.revno(), 3)
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2008-07-30 04:34:59 +0000
+++ b/bzrlib/tests/test_errors.py 2008-08-05 09:43:41 +0000
@@ -116,12 +116,6 @@
error = errors.InstallFailed([None])
self.assertEqual("Could not install revisions:\nNone", str(error))
- def test_lock_active(self):
- error = errors.LockActive("lock description")
- self.assertEqualDiff("The lock for 'lock description' is in use and "
- "cannot be broken.",
- str(error))
-
def test_knit_data_stream_incompatible(self):
error = errors.KnitDataStreamIncompatible(
'stream format', 'target format')
@@ -147,11 +141,26 @@
" known method in options: ['bad', 'no-eol']",
str(error))
+ def test_lock_active(self):
+ error = errors.LockActive("lock description")
+ self.assertEqualDiff("The lock for 'lock description' is in use and "
+ "cannot be broken.",
+ str(error))
+
def test_medium_not_connected(self):
error = errors.MediumNotConnected("a medium")
self.assertEqualDiff(
"The medium 'a medium' is not connected.", str(error))
+ def test_missing_files_commit_failure(self):
+ error = errors.MissingFilesCommitFailed(["Foo", "Bar"])
+ self.assertEqualDiff(
+ "Some files were missing but have not been removed by 'bzr rm'. "
+ "You can supply -a to the commit, remove them with 'bzr rm', tell "
+ "bzr they have been renamed with 'bzr mv', or restore them if they "
+ "were accidentally deleted via 'bzr revert'. The files were: "
+ "['Foo', 'Bar'].", str(error))
+
def test_no_public_branch(self):
b = self.make_branch('.')
error = errors.NoPublicBranch(b)
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2008-07-09 20:15:29 +0000
+++ b/bzrlib/tests/test_log.py 2008-08-05 09:43:41 +0000
@@ -192,7 +192,7 @@
os.unlink('child/file1')
file('child/file2', 'wb').write('hello\n')
self.run_bzr(['commit', '-m', 'remove file1 and modify file2',
- 'child'])
+ 'child', '-a'])
os.chdir('parent')
self.run_bzr('merge ../child')
wt.commit('merge child branch')
@@ -473,7 +473,7 @@
os.unlink('child/f1')
file('child/f2', 'wb').write('hello\n')
self.run_bzr(['commit', '-m', 'removed f1 and modified f2',
- 'child'])
+ 'child', '-a'])
os.chdir('parent')
self.run_bzr('merge ../child')
wt.commit('merge branch 1')
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2008-07-16 16:59:32 +0000
+++ b/bzrlib/tests/test_merge.py 2008-08-05 09:43:41 +0000
@@ -178,7 +178,7 @@
tree_a.add('b/c')
tree_a.commit('added c')
os.rmdir('z/b')
- tree_z.commit('removed b')
+ tree_z.commit('removed b', auto_add_delete=True)
merge_inner(tree_z.branch, tree_a, base_tree, this_tree=tree_z)
self.assertEqual([
conflicts.MissingParent('Created directory', 'b', 'b-id'),
@@ -275,7 +275,7 @@
tree_b.lock_write()
self.addCleanup(tree_b.unlock)
os.unlink('B/a')
- tree_b.commit('3')
+ tree_b.commit('3', auto_add_delete=True)
try:
tree_b.merge_from_branch(tree_a.branch)
except AttributeError:
=== modified file 'bzrlib/tests/test_merge_core.py'
--- a/bzrlib/tests/test_merge_core.py 2008-06-11 07:22:00 +0000
+++ b/bzrlib/tests/test_merge_core.py 2008-08-05 09:43:41 +0000
@@ -532,7 +532,7 @@
wta.commit('a_revision', allow_pointless=False)
self.run_bzr('branch a b')
os.remove('a/file')
- wta.commit('removed file', allow_pointless=False)
+ wta.commit('removed file', allow_pointless=False, auto_add_delete=True)
file('b/file', 'wb').write('changed contents\n')
wtb = WorkingTree.open('b')
wtb.commit('changed file', allow_pointless=False)
@@ -550,7 +550,7 @@
b_wt = WorkingTree.open('b')
os.chmod('b/file', 0755)
os.remove('a/file')
- a_wt.commit('removed a')
+ a_wt.commit('removed a', auto_add_delete=True)
self.assertEqual(a_wt.branch.revno(), 2)
self.assertFalse(os.path.exists('a/file'))
b_wt.commit('exec a')
@@ -586,7 +586,7 @@
self.run_bzr('branch a b')
b_wt = WorkingTree.open('b')
os.remove('b/file')
- b_wt.commit('r1')
+ b_wt.commit('r1', auto_add_delete=True)
file('b/file', 'wb').write('THAT')
b_wt.add('file')
b_wt.commit('r2')
=== modified file 'bzrlib/tests/test_revert.py'
--- a/bzrlib/tests/test_revert.py 2007-12-29 21:43:44 +0000
+++ b/bzrlib/tests/test_revert.py 2008-08-05 09:43:41 +0000
@@ -126,7 +126,7 @@
tree.add('file')
tree.commit('added file', rev_id='rev1')
os.unlink('file')
- tree.commit('removed file')
+ tree.commit('removed file', auto_add_delete=True)
self.failIfExists('file')
tree.revert(old_tree=tree.branch.repository.revision_tree('rev1'))
self.failUnlessExists('file')
=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py 2008-08-05 00:06:19 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py 2008-08-05 09:43:41 +0000
@@ -91,6 +91,37 @@
class TestCommit(TestCaseWithWorkingTree):
+ def test_commit_auto_add_delete(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo', 'bar'])
+ tree.add('foo')
+ self.get_transport('.').delete('foo')
+ tree.commit('do a commit', auto_add_delete=True)
+ self.assertEqual(None, tree.path2id('foo'))
+ self.assertNotEqual(None, tree.path2id('bar'))
+
+ def test_commit_auto_add_directory(self):
+ # ensure that the children of an auto added directory are added.
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])
+ tree.commit('do a commit', auto_add_delete=True)
+ self.assertNotEqual(None, tree.path2id('foo'))
+ self.assertNotEqual(None, tree.path2id('foo/bar'))
+ self.assertNotEqual(None, tree.path2id('foo/bar/baz'))
+
+ def test_commit_auto_add_and_delete_strict_wins(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo', 'bar'])
+ tree.add('foo')
+ # First with the unadded 'bar'
+ self.assertRaises(errors.StrictCommitFailed, tree.commit, 'first post',
+ auto_add_delete=True, strict=True)
+ # Now with a deleted 'foo'
+ tree.add('bar')
+ self.get_transport('.').delete('foo')
+ self.assertRaises(errors.StrictCommitFailed, tree.commit, 'first post',
+ auto_add_delete=True, strict=True)
+
def test_autodelete_renamed(self):
tree_a = self.make_branch_and_tree('a')
self.build_tree(['a/dir/', 'a/dir/f1', 'a/dir/f2'])
@@ -102,7 +133,7 @@
tree_a.rename_one('dir/f1', 'dir/a')
tree_a.rename_one('dir/f2', 'dir/z')
osutils.rmtree('a/dir')
- tree_a.commit('autoremoved')
+ tree_a.commit('autoremoved', auto_add_delete=True)
tree_a.lock_read()
try:
@@ -123,7 +154,7 @@
# Rename one entry out of this directory
tree_a.rename_one('dir/f1', 'dir2/a')
osutils.rmtree('a/dir')
- tree_a.commit('autoremoved')
+ tree_a.commit('autoremoved', auto_add_delete=True)
tree_a.lock_read()
try:
@@ -155,7 +186,7 @@
tree_b.add(['xyz'], ['xyz-id'])
tree_b.rename_one('a/m', 'xyz/m')
osutils.rmtree('B/a')
- tree_b.commit('delete in B')
+ tree_b.commit('delete in B', auto_add_delete=True)
paths = [(path, ie.file_id)
for path, ie in tree_b.iter_entries_by_dir()]
@@ -187,7 +218,7 @@
# On WT2, set_conflicts is unsupported, but the rmtree has the same
# effect.
pass
- tree_b.commit('autoremove a, without touching xyz/m')
+ tree_b.commit('autoremove a, without touching xyz/m', auto_add_delete=True)
paths = [(path, ie.file_id)
for path, ie in tree_b.iter_entries_by_dir()]
self.assertEqual([('', root_id),
@@ -241,6 +272,14 @@
self.assertEqual(1, len(changes))
self.assertEqual((None, 'a/b'), changes[0][1])
+ def test_commit_missing_error(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo'])
+ tree.add('foo')
+ self.get_transport('.').delete('foo')
+ self.assertRaises(errors.MissingFilesCommitFailed,
+ tree.commit, 'do a commit')
+
def test_commit_sets_last_revision(self):
tree = self.make_branch_and_tree('tree')
committed_id = tree.commit('foo', rev_id='foo')
@@ -354,7 +393,7 @@
# now we have a tree with a through d in the inventory, but only
# a present on disk. After commit b-id, c-id and d-id should be
# missing from the inventory, within the same tree transaction.
- wt.commit('commit stuff')
+ wt.commit('commit stuff', auto_add_delete=True)
self.assertTrue(wt.has_id('a-id'))
self.assertFalse(wt.has_or_had_id('b-id'))
self.assertFalse(wt.has_or_had_id('c-id'))
@@ -387,7 +426,7 @@
this_dir = self.get_transport()
this_dir.delete_tree('b')
wt.lock_write()
- wt.commit('commit deleted rename')
+ wt.commit('commit deleted rename', auto_add_delete=True)
self.assertTrue(wt.has_id('a-id'))
self.assertFalse(wt.has_or_had_id('b-id'))
self.assertFalse(wt.has_or_had_id('c-id'))
=== modified file 'bzrlib/tests/workingtree_implementations/test_executable.py'
--- a/bzrlib/tests/workingtree_implementations/test_executable.py 2007-10-17 17:03:06 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_executable.py 2008-08-05 09:43:41 +0000
@@ -121,7 +121,7 @@
# commit, they are still marked correctly
os.remove('b1/a')
os.remove('b1/b')
- self.wt.commit('removed', rev_id='r2')
+ self.wt.commit('removed', rev_id='r2', auto_add_delete=True)
self.check_empty(self.wt)
@@ -144,7 +144,7 @@
os.remove('b1/a')
os.remove('b1/b')
- self.wt.commit('removed', rev_id='r2')
+ self.wt.commit('removed', rev_id='r2', auto_add_delete=True)
# now wt2 can pull and the files should be removed
=== modified file 'bzrlib/tests/workingtree_implementations/test_merge_from_branch.py'
--- a/bzrlib/tests/workingtree_implementations/test_merge_from_branch.py 2008-03-07 14:15:10 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_merge_from_branch.py 2008-08-05 09:43:41 +0000
@@ -63,7 +63,7 @@
tree_a.commit('added file')
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
os.unlink('tree_a/file')
- tree_a.commit('deleted file')
+ tree_a.commit('deleted file', auto_add_delete=True)
self.build_tree_contents([('tree_b/file', 'text-b')])
tree_b.commit('changed file')
tree_a.merge_from_branch(tree_b.branch)
@@ -88,7 +88,7 @@
tree_a.commit('added file', rev_id='rev_1')
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
os.unlink('tree_a/file')
- tree_a.commit('deleted file')
+ tree_a.commit('deleted file', auto_add_delete=True)
self.build_tree_contents([('tree_b/file', 'text-b')])
tree_b.commit('changed file')
self.assertRaises(errors.PointlessMerge, tree_a.merge_from_branch,
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2008-07-29 13:03:44 +0000
+++ b/bzrlib/workingtree_4.py 2008-08-05 09:43:41 +0000
@@ -1804,7 +1804,7 @@
@staticmethod
def make_source_parent_tree(source, target):
"""Change the source tree into a parent of the target."""
- revid = source.commit('record tree')
+ revid = source.commit('record tree', auto_add_delete=True)
target.branch.repository.fetch(source.branch.repository, revid)
target.set_parent_ids([revid])
return target.basis_tree(), target
More information about the bazaar-commits
mailing list