Rev 33: Ensure that we refuse to upload if the working tree contains in http://code.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk

Vincent Ladeuil v.ladeuil+lp at free.fr
Sat Apr 26 16:25:07 BST 2008


At http://code.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk

------------------------------------------------------------
revno: 33
revision-id: v.ladeuil+lp at free.fr-20080426152503-1n4uag99khkjs3af
parent: v.ladeuil+lp at free.fr-20080425223950-7c6304jwrrh1mvq4
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: upload
timestamp: Sat 2008-04-26 17:25:03 +0200
message:
  Ensure that we refuse to upload if the working tree contains
  changes or conflicts.
  
  * test_upload.py:
  (TestUploadMixin.test_upload_when_changes,
  TestUploadMixin.test_upload_when_conflicts): New tests.
modified:
  __init__.py                    __init__.py-20080307145942-xx1xgifrreovahgz-1
  test_upload.py                 test_upload.py-20080307145942-xx1xgifrreovahgz-2
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2008-04-25 22:39:50 +0000
+++ b/__init__.py	2008-04-26 15:25:03 +0000
@@ -82,15 +82,10 @@
 
         wt = workingtree.WorkingTree.open(directory)
         changes = wt.changes_from(wt.basis_tree())
-       
-        #TODO: Needs tests
+
         if changes.has_changed():
             raise errors.UncommittedChanges(wt)
 
-        #TODO: Needs tests
-        if len(wt.conflicts()) > 0:
-            raise errors.ConflictsInTree
-
         self.branch = wt.branch
 
         if location is None:

=== modified file 'test_upload.py'
--- a/test_upload.py	2008-04-25 22:39:50 +0000
+++ b/test_upload.py	2008-04-26 15:25:03 +0000
@@ -27,6 +27,7 @@
     revisionspec,
     tests,
     transport,
+    workingtree,
     )
 from bzrlib.smart import server as smart_server
 
@@ -277,6 +278,23 @@
         self.do_upload(revision=[revspec])
         self.assertUpFileEqual('foo', 'hello')
 
+    def test_upload_when_changes(self):
+        self.make_local_branch()
+        self.add_file('a', 'foo')
+        self.set_file_content('a', 'bar')
+        self.assertRaises(errors.UncommittedChanges, self.do_upload)
+
+    def test_upload_when_conflicts(self):
+        self.make_local_branch()
+        self.add_file('a', 'foo')
+        self.run_bzr('branch branch other')
+        self.modify_file('a', 'bar')
+        other_tree = workingtree.WorkingTree.open('other')
+        self.set_file_content('a', 'baz', 'other/')
+        other_tree.commit('modify file a')
+        self.run_bzr('merge -d branch other', retcode=1)
+        self.assertRaises(errors.UncommittedChanges, self.do_upload)
+
 
 class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin):
 



More information about the bazaar-commits mailing list