示例#1
0
    def test_checkout_specific_version_and_update(self):
        url = self.local_url
        version = self.local_version
        client = HgClient(self.local_path)
        self.assertFalse(client.path_exists())
        self.assertFalse(client.detect_presence())
        self.assertFalse(client.detect_presence())
        self.assertTrue(client.checkout(url, version))
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEqual(client.get_path(), self.local_path)
        self.assertEqual(client.get_url(), url)
        self.assertEqual(client.get_version(), version)

        new_version = self.local_version_second
        self.assertTrue(client.update(new_version))
        self.assertEqual(client.get_version(), new_version)

        self.assertTrue(client.update())
        self.assertEqual(client.get_version(), self.local_version)

        self.assertTrue(client.update(new_version))
        self.assertEqual(client.get_version(), new_version)

        self.assertTrue(client.update(''))
        self.assertEqual(client.get_version(), self.local_version)
示例#2
0
    def test_checkout_specific_version_and_update(self):
        url = self.local_url
        version = self.local_version
        client = HgClient(self.local_path)
        self.assertFalse(client.path_exists())
        self.assertFalse(client.detect_presence())
        self.assertFalse(client.detect_presence())
        self.assertTrue(client.checkout(url, version))
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEqual(client.get_path(), self.local_path)
        self.assertEqual(client.get_url(), url)
        self.assertEqual(client.get_version(), version)

        new_version = self.local_version_second
        self.assertTrue(client.update(new_version))
        self.assertEqual(client.get_version(), new_version)

        self.assertTrue(client.update())
        self.assertEqual(client.get_version(), self.local_version)

        self.assertTrue(client.update(new_version))
        self.assertEqual(client.get_version(), new_version)

        self.assertTrue(client.update(''))
        self.assertEqual(client.get_version(), self.local_version)
示例#3
0
    def test_checkout_specific_version_and_update(self):
        from vcstools.hg import HgClient
        directory = tempfile.mkdtemp()
        subdir = "checkout_specific_version_test"
        self.directories[subdir] = directory
        local_path = os.path.join(directory, "anyvc")
        url = self.readonly_url
        version = self.readonly_version
        client = HgClient(local_path)
        self.assertFalse(client.path_exists())
        self.assertFalse(client.detect_presence())
        self.assertFalse(client.detect_presence())
        self.assertTrue(client.checkout(url, version))
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEqual(client.get_path(), local_path)
        self.assertEqual(client.get_url(), url)
        self.assertEqual(client.get_version(), version)

        new_version = self.readonly_version_second
        self.assertTrue(client.update(new_version))
        self.assertEqual(client.get_version(), new_version)

        shutil.rmtree(directory)
        self.directories.pop(subdir)
 def test_checkout_specific_version_and_update(self):
     from vcstools.hg import HgClient
     directory = tempfile.mkdtemp()
     subdir = "checkout_specific_version_test"
     self.directories[subdir] = directory
     local_path = os.path.join(directory, "anyvc")
     url = self.readonly_url
     version = self.readonly_version
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url, version))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
     self.assertEqual(client.get_version(), version)
     
     new_version = self.readonly_version_second
     self.assertTrue(client.update(new_version))
     self.assertEqual(client.get_version(), new_version)
     
     shutil.rmtree(directory)
     self.directories.pop(subdir)
示例#5
0
 def test_checkout(self):
     url = self.local_url
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), self.local_path)
     self.assertEqual(client.get_url(), url)
     self.assertEqual(client.get_version(), self.local_version)
示例#6
0
 def test_checkout_into_subdir_without_existing_parent(self):
     local_path = os.path.join(self.local_path, "nonexistant_subdir")
     url = self.local_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
示例#7
0
 def test_checkout(self):
     url = self.local_url
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), self.local_path)
     self.assertEqual(client.get_url(), url)
     self.assertEqual(client.get_version(), self.local_version)
示例#8
0
 def test_checkout_into_subdir_without_existing_parent(self):
     local_path = os.path.join(self.local_path, "nonexistant_subdir")
     url = self.local_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
示例#9
0
 def test_checkout(self):
     from vcstools.hg import HgClient
     directory = tempfile.mkdtemp()
     self.directories["checkout_test"] = directory
     local_path = os.path.join(directory, "anyvc")
     url = self.readonly_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
 def test_checkout_into_subdir_without_existing_parent(self): # test for #3497
     from vcstools.hg import HgClient
     directory = tempfile.mkdtemp()
     self.directories["checkout_test"] = directory
     local_path = os.path.join(directory, "anyvc", "nonexistant_subdir")
     url = self.readonly_url
     client = HgClient(local_path)
     self.assertFalse(client.path_exists())
     self.assertFalse(client.detect_presence())
     self.assertFalse(client.detect_presence())
     self.assertTrue(client.checkout(url))
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_path(), local_path)
     self.assertEqual(client.get_url(), url)
    def test_diff_relpath(self):
        from vcstools.hg import HgClient
        client = HgClient(self.readonly_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals('diff --git readonly/added.txt readonly/added.txt\nnew file mode 100644\n--- /dev/null\n+++ readonly/added.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/deleted.txt readonly/deleted.txt\ndeleted file mode 100644\ndiff --git readonly/modified-fs.txt readonly/modified-fs.txt\n--- readonly/modified-fs.txt\n+++ readonly/modified-fs.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/modified.txt readonly/modified.txt\n--- readonly/modified.txt\n+++ readonly/modified.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\n\n', client.get_diff(basepath=os.path.dirname(self.readonly_path)))
示例#12
0
    def test_diff_relpath(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals(
            '''\
diff --git local/added.txt local/added.txt
new file mode 100644
--- /dev/null
+++ local/added.txt
@@ -0,0 +1,1 @@
+0123456789abcdef
\\ No newline at end of file
diff --git local/deleted.txt local/deleted.txt
deleted file mode 100644
diff --git local/modified-fs.txt local/modified-fs.txt
--- local/modified-fs.txt
+++ local/modified-fs.txt
@@ -0,0 +1,1 @@
+0123456789abcdef
\\ No newline at end of file
diff --git local/modified.txt local/modified.txt
--- local/modified.txt
+++ local/modified.txt
@@ -0,0 +1,1 @@
+0123456789abcdef
\\ No newline at end of file''',
            client.get_diff(basepath=os.path.dirname(self.local_path)))
示例#13
0
 def test_status(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         "M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n", client.get_status()
     )
示例#14
0
 def testStatusUntracked(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         'M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n? added-fs.txt\n',
         client.get_status(untracked=True))
示例#15
0
 def test_status_relpath(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         'M local/modified-fs.txt\nM local/modified.txt\nA local/added.txt\nR local/deleted.txt\n! local/deleted-fs.txt\n',
         client.get_status(basepath=os.path.dirname(self.local_path)))
示例#16
0
    def test_diff_relpath(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals('diff --git local/added.txt local/added.txt\nnew file mode 100644\n--- /dev/null\n+++ local/added.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git local/deleted.txt local/deleted.txt\ndeleted file mode 100644\ndiff --git local/modified-fs.txt local/modified-fs.txt\n--- local/modified-fs.txt\n+++ local/modified-fs.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git local/modified.txt local/modified.txt\n--- local/modified.txt\n+++ local/modified.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file', client.get_diff(basepath=os.path.dirname(self.local_path)))
示例#17
0
 def test_status_relpath(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         'M readonly/modified-fs.txt\nM readonly/modified.txt\nA readonly/added.txt\nR readonly/deleted.txt\n! readonly/deleted-fs.txt\n',
         client.get_status(basepath=os.path.dirname(self.readonly_path)))
示例#18
0
 def test_checkout_dir_exists(self):
     url = self.remote_path
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     os.makedirs(self.local_path)
     self.assertTrue(client.checkout(url))
     # non-empty
     self.assertFalse(client.checkout(url))
示例#19
0
 def test_checkout_dir_exists(self):
     url = self.remote_path
     client = HgClient(self.local_path)
     self.assertFalse(client.path_exists())
     os.makedirs(self.local_path)
     self.assertTrue(client.checkout(url))
     # non-empty
     self.assertFalse(client.checkout(url))
示例#20
0
 def test_status_relpath(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         "M local/modified-fs.txt\nM local/modified.txt\nA local/added.txt\nR local/deleted.txt\n! local/deleted-fs.txt\n",
         client.get_status(basepath=os.path.dirname(self.local_path)),
     )
示例#21
0
    def test_diff(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEquals(
            'diff --git ./added.txt ./added.txt\nnew file mode 100644\n--- /dev/null\n+++ ./added.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./deleted.txt ./deleted.txt\ndeleted file mode 100644\ndiff --git ./modified-fs.txt ./modified-fs.txt\n--- ./modified-fs.txt\n+++ ./modified-fs.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./modified.txt ./modified.txt\n--- ./modified.txt\n+++ ./modified.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file',
            client.get_diff())
示例#22
0
 def testStatusUntracked(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals(
         'M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n? added-fs.txt\n',
         client.get_status(untracked=True))
 def test_get_url_by_reading(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.readonly_url)
     self.assertEqual(client.get_version(), self.readonly_version)
     self.assertEqual(client.get_version(self.readonly_version_init[0:6]), self.readonly_version_init+'+')
     self.assertEqual(client.get_version("test_tag"), self.readonly_version_init+'+')
示例#24
0
    def test_diff(self):

        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEquals(
            "diff --git ./added.txt ./added.txt\nnew file mode 100644\n--- /dev/null\n+++ ./added.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./deleted.txt ./deleted.txt\ndeleted file mode 100644\ndiff --git ./modified-fs.txt ./modified-fs.txt\n--- ./modified-fs.txt\n+++ ./modified-fs.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./modified.txt ./modified.txt\n--- ./modified.txt\n+++ ./modified.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file",
            client.get_diff(),
        )
示例#25
0
    def test_diff_relpath(self):
        from vcstools.hg import HgClient
        client = HgClient(self.readonly_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())

        self.assertEquals(
            'diff --git readonly/added.txt readonly/added.txt\nnew file mode 100644\n--- /dev/null\n+++ readonly/added.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/deleted.txt readonly/deleted.txt\ndeleted file mode 100644\ndiff --git readonly/modified-fs.txt readonly/modified-fs.txt\n--- readonly/modified-fs.txt\n+++ readonly/modified-fs.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git readonly/modified.txt readonly/modified.txt\n--- readonly/modified.txt\n+++ readonly/modified.txt\n@@ -0,0 +1,1 @@\n+0123456789abcdef\n\\ No newline at end of file\n\n',
            client.get_diff(basepath=os.path.dirname(self.readonly_path)))
 def test_get_url_by_reading(self):
     url = self.local_url
     client = HgClient(self.local_path)
     client.checkout(url, self.local_version)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.local_url)
     self.assertEqual(client.get_version(), self.local_version)
     self.assertEqual(client.get_version(self.local_version_init[0:6]), self.local_version_init)
     self.assertEqual(client.get_version("test_tag"), self.local_version_init)
示例#27
0
 def test_get_url_by_reading(self):
     url = self.local_url
     client = HgClient(self.local_path)
     client.checkout(url, self.local_version)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.local_url)
     self.assertEqual(client.get_version(), self.local_version)
     self.assertEqual(client.get_version(self.local_version_init[0:6]), self.local_version_init)
     self.assertEqual(client.get_version("test_tag"), self.local_version_init)
示例#28
0
 def test_get_url_by_reading(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEqual(client.get_url(), self.readonly_url)
     self.assertEqual(client.get_version(), self.readonly_version)
     self.assertEqual(client.get_version(self.readonly_version_init[0:6]),
                      self.readonly_version_init + '+')
     self.assertEqual(client.get_version("test_tag"),
                      self.readonly_version_init + '+')
示例#29
0
    def test_status(self):
        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEquals(
            '''\
M modified-fs.txt
M modified.txt
A added.txt
R deleted.txt
! deleted-fs.txt
''', client.get_status())
示例#30
0
    def test_status_relpath(self):
        client = HgClient(self.local_path)
        self.assertTrue(client.path_exists())
        self.assertTrue(client.detect_presence())
        self.assertEquals(
            '''\
M local/modified-fs.txt
M local/modified.txt
A local/added.txt
R local/deleted.txt
! local/deleted-fs.txt
'''.replace("/", os.path.sep),
            client.get_status(basepath=os.path.dirname(self.local_path)))
示例#31
0
 def testStatusUntracked(self):
     client = HgClient(self.local_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals('M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n? added-fs.txt\n', client.get_status(untracked=True))
 def testStatusUntracked(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals('M modified-fs.txt\nM modified.txt\nA added.txt\nR deleted.txt\n! deleted-fs.txt\n? added-fs.txt\n', client.get_status(untracked=True))
 def test_status_relpath(self):
     from vcstools.hg import HgClient
     client = HgClient(self.readonly_path)
     self.assertTrue(client.path_exists())
     self.assertTrue(client.detect_presence())
     self.assertEquals('M readonly/modified-fs.txt\nM readonly/modified.txt\nA readonly/added.txt\nR readonly/deleted.txt\n! readonly/deleted-fs.txt\n', client.get_status(basepath=os.path.dirname(self.readonly_path)))