Beispiel #1
0
 def testOffsetCheckin(self):
     tree1 = {'file.txt': 'fc1',
              'subdir1/subdirfile1.txt': 'fc2'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     write_tree(wd.root, {'newfile.txt': 'nf'}, create_root = False)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(subtree, {'subdirfile1.txt': 'fc2',
                                'newfile.txt': 'nf'})
Beispiel #2
0
 def testOffsetCheckin(self):
     tree1 = {'file.txt': 'fc1',
              'subdir1/subdirfile1.txt': 'fc2'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     write_tree(wd.root, {'newfile.txt': 'nf'}, create_root = False)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(subtree, {'subdirfile1.txt': b'fc2',
                                'newfile.txt': b'nf'})
Beispiel #3
0
 def testUpdateResume(self):
     """ Test the case that some parts of the workdir are already
     up to date (like after an aborted update)."""
     wd = self.createWorkdir(self.repoUrl, {
         'file1.txt': 'f1 v1',
         'file2.txt': 'f2 v1',
         'file3.txt': 'f3 v1'
     })
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl, {
         'file1.txt': 'f1 v2',
         'file2.txt': 'f2 v2',
         'file3.txt': 'f3 v2'
     })
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(
         self.repoUrl,
         {
             'file1.txt': 'f1 v2',  # unexpected v2
             'file2.txt': 'f2 v1',  # normal v1
             'file3.txt': 'f3 mod'
         },  # normal modification, but not v2
         revision=rev1)
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist=boar_dirs)
     self.assertEquals(updated_tree, {
         'file1.txt': 'f1 v2',
         'file2.txt': 'f2 v2',
         'file3.txt': 'f3 mod'
     })
Beispiel #4
0
 def testUpdateDeletionWithOffset(self):
     """ Only file3.txt should be deleted by the update, since it
     is unchanged. The other two should remain untouched."""
     wd = self.createWorkdir(
         self.repoUrl, {
             'subdir/d/file1.txt': 'f1',
             'subdir/d/file2.txt': 'f2',
             'subdir/d/file3.txt': 'f3'
         })
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl, {})
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl, {
         'd/file1.txt': 'f1 mod',
         'd/file2.txt': 'f2 mod',
         'd/file3.txt': 'f3'
     },
                                    revision=rev1,
                                    offset=u"subdir")
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist=boar_dirs)
     self.assertEquals(updated_tree, {
         'd/file1.txt': 'f1 mod',
         'd/file2.txt': 'f2 mod'
     })
Beispiel #5
0
 def testEmptyFile(self):
     tree = {'file.txt': ''}
     wd = self.createWorkdir(self.repoUrl, tree)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     co_tree = read_tree(wd.root, skiplist=boar_dirs)
     self.assertEquals(tree, co_tree)
Beispiel #6
0
 def testEmptyFile(self):
     tree = {'file.txt': ''}
     wd = self.createWorkdir(self.repoUrl, tree)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     co_tree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEquals(tree, co_tree)
Beispiel #7
0
 def testWriteAndReadTree(self):
     """ Really only test helper functions write_tree() and
     read_tree() themselves"""
     tree = {"tjosan.txt": "tjosan content",
             "subdir/nisse.txt": "nisse content"}
     testdir = self.createTmpName()
     write_tree(testdir, tree)
     tree2 = read_tree(testdir)
     self.assertEqual(tree, tree2)
Beispiel #8
0
 def testWriteAndReadTree(self):
     """ Really only test helper functions write_tree() and
     read_tree() themselves"""
     tree = {"tjosan.txt": b"tjosan content",
             "subdir/nisse.txt": b"nisse content"}
     testdir = self.createTmpName()
     write_tree(testdir, tree)
     tree2 = read_tree(testdir)
     self.assertEqual(tree, tree2)
Beispiel #9
0
    def testInclude(self):
        tree = {'file.txt': 'f1', 'file.ignore': 'f2'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.checkout()
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist=boar_dirs)
        self.assertEquals({'file.txt': 'f1'}, co_tree)
Beispiel #10
0
    def testInclude(self):
        tree = {'file.txt': 'f1',
                'file.ignore': 'f2'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.checkout()
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEquals({'file.txt': 'f1'}, co_tree)
Beispiel #11
0
    def testExpectedMetaFilesUpdate(self):
        tree = {'file.txt': 'f1'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()
        wd.front.set_session_ignore_list(u"TestSession", ["*.ignore"])
        wd.update_to_latest()
        wd.get_changes()
        full_tree_filenames = set(read_tree(wd.root).keys())
        expected_filenames = set(
            [u'file.txt', u'.boar/info', u'.boar/wd_version.txt'])

        self.assertEquals(expected_filenames, full_tree_filenames)
Beispiel #12
0
    def testExpectedMetaFilesUpdate(self):
        tree = {'file.txt': 'f1'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()
        wd.front.set_session_ignore_list(u"TestSession", ["*.ignore"])
        wd.update_to_latest()
        wd.get_changes()
        full_tree_filenames = set(read_tree(wd.root).keys())
        expected_filenames = set([u'file.txt',
                                  u'.boar/info',
                                  u'.boar/wd_version.txt'])

        self.assertEquals(expected_filenames, full_tree_filenames)
Beispiel #13
0
 def testIgnoreStickyness(self):
     tree = {'file.txt': 'f1', 'file.ignore': 'f2'}
     wd = self.createWorkdir(self.repoUrl, tree)
     wd.front.set_session_ignore_list(u"TestSession", ["*.ignore"])
     wd.checkout()
     wd.checkin()
     id = wd.checkin(allow_empty=True)
     # Need to change this test if we make non-changing commits become NOPs.
     self.assertEquals(id, 5)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     co_tree = read_tree(wd.root, skiplist=boar_dirs)
     self.assertEquals({'file.txt': 'f1'}, co_tree)
Beispiel #14
0
 def testImportDryRun(self):
     """ Test that nothing is changed by a dry run commit """
     wd = self.createWorkdir(self.repoUrl, {"file1.txt": "fc1", # modified
                                            "file2.txt": "fc2"}) # deleted
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, {"file1.txt": "fc1 mod", # modified
                                            'file3.txt': 'fc3'}) # new
     id = wd.checkin(dry_run = True)
     self.assertEquals(id, 0)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     newtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEquals(newtree, {'file1.txt': 'fc1',
                                 'file2.txt': 'fc2'})
Beispiel #15
0
 def testImportDryRun(self):
     """ Test that nothing is changed by a dry run commit """
     wd = self.createWorkdir(self.repoUrl, {"file1.txt": "fc1", # modified
                                            "file2.txt": "fc2"}) # deleted
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, {"file1.txt": "fc1 mod", # modified
                                            'file3.txt': 'fc3'}) # new
     id = wd.checkin(dry_run = True)
     self.assertEqual(id, 0)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     newtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(newtree, {'file1.txt': b'fc1',
                                 'file2.txt': b'fc2'})
Beispiel #16
0
 def testIgnoreStickyness(self):
     tree = {'file.txt': 'f1',
             'file.ignore': 'f2'}
     wd = self.createWorkdir(self.repoUrl, tree)
     wd.front.set_session_ignore_list(u"TestSession", ["*.ignore"])
     wd.checkout()
     wd.checkin()
     id = wd.checkin(allow_empty = True)
     # Need to change this test if we make non-changing commits become NOPs.
     self.assertEquals(id, 5)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     co_tree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEquals({'file.txt': 'f1'}, co_tree)
Beispiel #17
0
 def testUpdate(self):
     wd = self.createWorkdir(self.repoUrl,
                             {'file2.txt': 'f2'})
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl,
                             {'file2.txt': 'f2 mod2', # modified file
                              'file3.txt': 'f3'}) # new file
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl,
                                    {'file2.txt': 'f2 mod1'},
                                    revision = rev1)
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist = boar_dirs)
     self.assertEqual(updated_tree, {'file2.txt': b'f2 mod1',
                                     'file3.txt': b'f3'})
Beispiel #18
0
 def testUpdate(self):
     wd = self.createWorkdir(self.repoUrl,
                             {'file2.txt': 'f2'})
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl,
                             {'file2.txt': 'f2 mod2', # modified file
                              'file3.txt': 'f3'}) # new file
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl,
                                    {'file2.txt': 'f2 mod1'},
                                    revision = rev1)
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist = boar_dirs)
     self.assertEquals(updated_tree, {'file2.txt': 'f2 mod1',
                                      'file3.txt': 'f3'})
Beispiel #19
0
    def testIgnoreWithRename(self):
        tree = {'file.txt': b'f1'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.front.set_session_ignore_list(u"TestSession", ["*.ignore"])
        wd.checkout()
        wd.checkin()

        tree = {'file-renamed.txt': b'f1',
                'file.ignore': b'f2'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()
        
        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEqual({'file-renamed.txt': b'f1'}, co_tree)
Beispiel #20
0
 def testAddOnlyCommit(self):
     """ Add-only commits should ignore modifications and
     deletions, and only commit new files, if any. """
     tree1 = {'modified.txt': 'mod1',
              'deleted.txt': 'del'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     tree2 = {'modified.txt': 'mod2',
              'new.txt': 'new'}
     wd = self.createWorkdir(self.repoUrl, tree2)
     wd.checkin(add_only = True)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     newtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(newtree, {'modified.txt': 'mod1',
                                'deleted.txt': 'del',
                                'new.txt': 'new'})
Beispiel #21
0
 def testAddOnlyCommit(self):
     """ Add-only commits should ignore modifications and
     deletions, and only commit new files, if any. """
     tree1 = {'modified.txt': 'mod1', 'deleted.txt': 'del'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     tree2 = {'modified.txt': 'mod2', 'new.txt': 'new'}
     wd = self.createWorkdir(self.repoUrl, tree2)
     wd.checkin(add_only=True)
     wd = self.createWorkdir(self.repoUrl)
     wd.checkout()
     newtree = read_tree(wd.root, skiplist=boar_dirs)
     self.assertEqual(newtree, {
         'modified.txt': 'mod1',
         'deleted.txt': 'del',
         'new.txt': 'new'
     })
Beispiel #22
0
 def testUpdateDeletion(self):
     """ Only file3.txt should be deleted by the update, since it
     is unchanged. The other two should remain untouched."""
     wd = self.createWorkdir(self.repoUrl,
                             {'file1.txt': 'f1',
                              'file2.txt': 'f2',
                              'file3.txt': 'f3'})
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl, {})
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl,
                                    {'file1.txt': 'f1 mod',
                                     'file2.txt': 'f2 mod',
                                     'file3.txt': 'f3'},
                                    revision = rev1)
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist = boar_dirs)
     self.assertEquals(updated_tree, {'file1.txt': 'f1 mod',
                                      'file2.txt': 'f2 mod'})
Beispiel #23
0
    def testIncludeModifications(self):
        """Expected behavior is that modifications of previously
        committed (but now ignored) files should be ignored. But they
        should still be checked out if they exist."""
        tree = {'file.txt': 'f1',
                'file.ignore': 'f2',
                'file-modified.ignore': 'f3'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()

        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.update_to_latest()
        write_tree(wd.root, {'file-modified.ignore': 'f3 mod'}, False, overwrite=True)
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEquals(tree, co_tree)
Beispiel #24
0
    def testIncludeModifications(self):
        """Expected behavior is that modifications of previously
        committed (but now ignored) files should be ignored. But they
        should still be checked out if they exist."""
        tree = {'file.txt': b'f1',
                'file.ignore': b'f2',
                'file-modified.ignore': b'f3'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()

        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.update_to_latest()
        write_tree(wd.root, {'file-modified.ignore': 'f3 mod'}, False, overwrite=True)
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEqual(tree, co_tree)
Beispiel #25
0
 def testUpdateWithOffset(self):
     wd = self.createWorkdir(self.repoUrl, {'subdir/d/file2.txt': 'f2'})
     rev1 = wd.checkin()
     wd = self.createWorkdir(
         self.repoUrl,
         {
             'subdir/d/file2.txt': 'f2 mod2',  # modified file
             'subdir/d/file3.txt': 'f3'
         })  # new file
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl,
                                    {'d/file2.txt': 'f2 mod1'},
                                    revision=rev1,
                                    offset=u"subdir")
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist=boar_dirs)
     self.assertEquals(updated_tree, {
         'd/file2.txt': 'f2 mod1',
         'd/file3.txt': 'f3'
     })
Beispiel #26
0
 def testUpdateResume(self):
     """ Test the case that some parts of the workdir are already
     up to date (like after an aborted update)."""
     wd = self.createWorkdir(self.repoUrl,
                             {'file1.txt': 'f1 v1',
                              'file2.txt': 'f2 v1',
                              'file3.txt': 'f3 v1'})
     rev1 = wd.checkin()
     wd = self.createWorkdir(self.repoUrl,
                             {'file1.txt': 'f1 v2',
                              'file2.txt': 'f2 v2',
                              'file3.txt': 'f3 v2'})
     rev2 = wd.checkin()
     wd_update = self.createWorkdir(self.repoUrl,
                                    {'file1.txt': 'f1 v2',  # unexpected v2
                                     'file2.txt': 'f2 v1',  # normal v1
                                     'file3.txt': 'f3 mod'},# normal modification, but not v2
                                    revision = rev1)
     wd_update.update_to_latest()
     updated_tree = read_tree(wd_update.root, skiplist = boar_dirs)
     self.assertEquals(updated_tree, {'file1.txt': 'f1 v2',
                                      'file2.txt': 'f2 v2',
                                      'file3.txt': 'f3 mod'})