Update upstream source from tag 'upstream/0.1.40'
Update to upstream version '0.1.40'
with Debian dir abfce8e88ef20c50b2d5ed5276695bc280ae3f22
Jochen Sprickerhof
6 years ago
0 | 0 | language: python |
1 | 1 | python: |
2 | - "2.6" | |
3 | 2 | - "2.7" |
4 | - "3.2" | |
5 | - "3.3" | |
6 | 3 | - "3.4" |
7 | env: | |
8 | # lucid | |
9 | # - HG='1.4.2' BZR=2.1.4 GIT=v1.7.0.4 SVN=1.6.6 PYYAML=3.10 | |
10 | # natty | |
11 | # - HG='1.6.3' BZR=2.3.4 GIT=v1.7.4.1 SVN=1.6.6 PYYAML=3.10 | |
12 | # - HG='1.7.5' BZR=2.3.4 GIT=v1.7.4.1 SVN=1.6.6 PYYAML=3.10 | |
13 | # # oneiric | |
14 | # - HG='1.9.1' BZR=2.4.1 GIT=v1.7.5.4 SVN=1.6.12 PYYAML=3.10 | |
15 | # precise | |
16 | - HG='2.0.2' BZR=2.5.0 GIT=v1.7.9.5 SVN=1.6.17 PYYAML=3.10 | |
17 | # quantal | |
18 | - HG='2.2.2' BZR=2.6.0+bzr6595 GIT=v1.7.10.4 SVN=1.7.5 PYYAML=3.10 | |
19 | # trusty | |
20 | - HG='2.8.2' BZR=2.6.0+bzr6595 GIT=v1.9.1 SVN=1.8.8 PYYAML=3.10 SQLITE=sqlite-amalgamation-3071501.zip | |
21 | # bzr 2.1.1 only builds with python 2.6 | |
22 | matrix: | |
23 | exclude: | |
24 | - python: "2.7" | |
25 | env: HG='1.4.2' BZR=2.1.4 GIT=v1.7.0.4 SVN=1.6.6 PYYAML=3.10 | |
26 | - python: "3.2" | |
27 | env: HG='1.4.2' BZR=2.1.4 GIT=v1.7.0.4 SVN=1.6.6 PYYAML=3.10 | |
28 | - python: "3.3" | |
29 | env: HG='1.4.2' BZR=2.1.4 GIT=v1.7.0.4 SVN=1.6.6 PYYAML=3.10 | |
30 | - python: "3.4" | |
31 | env: HG='1.4.2' BZR=2.1.4 GIT=v1.7.0.4 SVN=1.6.6 PYYAML=3.10 | |
4 | - "3.5" | |
32 | 5 | before_install: |
33 | 6 | - export REPO=`pwd` |
34 | 7 | install: |
35 | 8 | - sudo apt-get update |
36 | - sudo apt-get install -qq python3-yaml python3-dev | |
37 | - sudo apt-get install -qq libapr1 libapr1-dev libaprutil1 libaprutil1-dev libneon27 libneon27-dev libc6-dev g++ gcc | |
38 | - if [ $SQLITE ]; then (wget http://www.sqlite.org/$SQLITE && mkdir -p $HOME/builds/subversion-$SVN/sqlite-amalgamation && unzip -j $SQLITE -d $HOME/builds/subversion-$SVN/sqlite-amalgamation); fi | |
9 | - sudo apt-get install -qq python-yaml python-dateutil | |
10 | - sudo apt-get install -qq python3-yaml python3-dateutil | |
11 | - sudo apt-get install -qq git mercurial bzr subversion | |
39 | 12 | - echo $PYTHONPATH |
40 | 13 | - python -c 'import sys;print(sys.path)' |
41 | - python setup.py build | |
42 | # cannot build mercurial and bzr using py3k, but cannot use python2 in python2.6 case | |
43 | - export PY2K=`python -c 'import sys; print("python2" if (sys.version_info[0] == 3) else "python")'` | |
44 | - pip install 'coverage<4' | |
45 | - pip install cython | |
46 | - pip install pep8 | |
47 | - pip install "pyyaml<=$PYYAML" > pyaml-warnings.log 2>&1 || (cat pyaml-warnings.log && false) | |
48 | - pip install python-dateutil | |
49 | - cd $HOME/builds && wget https://www.mercurial-scm.org/release/mercurial-$HG.tar.gz && tar -xf mercurial-$HG.tar.gz && cd mercurial-$HG && sudo $PY2K setup.py install > hg_install.log 2>&1 || (cat hg_install.log && false) | |
50 | # did not find single source for old git tarballs | |
51 | - cd $HOME/builds && git clone git://git.kernel.org/pub/scm/git/git.git && cd git && git checkout $GIT && make prefix=/usr all > git_install.log 2>&1 || (cat git_install.log && false) && sudo make prefix=/usr install && cd $HOME/builds | |
52 | - cd $HOME/builds && wget http://archive.ubuntu.com/ubuntu/pool/main/b/bzr/bzr_$BZR.orig.tar.gz && tar -xf bzr_$BZR.orig.tar.gz && cd bzr-* && sudo $PY2K setup.py install build_ext --allow-python-fallback > bzr_install.log 2>&1 || (cat bzr_install.log && false) && cd $HOME/builds | |
53 | # subversion has complex dependencies | |
54 | - cd $HOME/builds && wget http://archive.apache.org/dist/subversion/subversion-$SVN.tar.gz && tar -xf subversion-$SVN.tar.gz && cd subversion-$SVN && ./configure --without-berkeley-db --without-apache --without-neon --without-swig --disable-nls > svn_install.log 2>&1 || (cat svn_install.log && false) && make -j && sudo make install > svn_install.log 2>&1 || (cat svn_install.log && false) && cd $HOME/builds | |
14 | - python setup.py install | |
55 | 15 | - hg --version |
56 | 16 | - bzr --version |
57 | 17 | - git --version |
58 | 18 | - svn --version |
59 | # Set git config to silence some stuff in the tests | |
60 | - git config --global user.email "foo@example.com" | |
61 | - git config --global user.name "Foo Bar" | |
62 | # Set the hg user | |
63 | - echo -e "[ui]\nusername = Your Name <your@mail.com>" >> ~/.hgrc | |
64 | # Set the bzr user | |
65 | - bzr whoami "Your Name <name@example.com>" | |
66 | - cd $REPO | |
67 | 19 | # command to run tests |
68 | 20 | script: |
69 | - nosetests --with-coverage --cover-package vcstools | |
21 | - python -m nose --with-coverage --cover-package vcstools test | |
70 | 22 | notifications: |
71 | 23 | email: false |
2 | 2 | |
3 | 3 | 0.1 |
4 | 4 | === |
5 | ||
6 | 0.1.40 | |
7 | ------ | |
8 | ||
9 | - Trivial style and testing changes | |
5 | 10 | |
6 | 11 | 0.1.39 |
7 | 12 | ------ |
27 | 27 | url="http://wiki.ros.org/vcstools", |
28 | 28 | download_url="http://download.ros.org/downloads/vcstools/", |
29 | 29 | keywords=["scm", "vcs", "git", "svn", "hg", "bzr"], |
30 | classifiers=["Programming Language :: Python", | |
31 | "Programming Language :: Python :: 2", | |
32 | "Programming Language :: Python :: 3", | |
33 | "License :: OSI Approved :: BSD License"], | |
30 | classifiers=[ | |
31 | "Programming Language :: Python", | |
32 | "Programming Language :: Python :: 2", | |
33 | "Programming Language :: Python :: 3", | |
34 | "License :: OSI Approved :: BSD License" | |
35 | ], | |
34 | 36 | description="VCS/SCM source control library for svn, git, hg, and bzr", |
35 | 37 | long_description="""\ |
36 | 38 | Library for managing source code trees from multiple version control systems. |
494 | 494 | |
495 | 495 | return response |
496 | 496 | |
497 | def get_status(self, basepath=None, untracked=False): | |
497 | def get_status(self, basepath=None, untracked=False, porcelain=False): | |
498 | status_flag = '--porcelain' if porcelain else '-s' | |
498 | 499 | response = None |
499 | 500 | if basepath is None: |
500 | 501 | basepath = self._path |
502 | 503 | rel_path = normalized_rel_path(self._path, basepath) |
503 | 504 | # git command only works inside repo |
504 | 505 | # self._path is safe against command injection, as long as we check path.exists |
505 | command = "git status -s " | |
506 | command = "git status {0} ".format(status_flag) | |
506 | 507 | if not untracked: |
507 | 508 | command += " -uno" |
508 | 509 | _, response, _ = run_shell_command(command, |
516 | 517 | rel_path, |
517 | 518 | line[3:]) |
518 | 519 | if LooseVersion(self.gitversion) > LooseVersion('1.7'): |
519 | command = "git submodule foreach --recursive git status -s" | |
520 | command = "git submodule foreach --recursive git status {0}".format(status_flag) | |
520 | 521 | if not untracked: |
521 | 522 | command += " -uno" |
522 | 523 | _, response2, _ = run_shell_command(command, |
133 | 133 | def get_diff(self, basepath=None): |
134 | 134 | return self.vcs.get_diff(basepath) |
135 | 135 | |
136 | def get_status(self, basepath=None, untracked=False): | |
137 | return self.vcs.get_status(basepath, untracked) | |
136 | def get_status(self, basepath=None, untracked=False, **kwargs): | |
137 | return self.vcs.get_status(basepath, untracked, **kwargs) | |
138 | 138 | |
139 | 139 | def get_log(self, relpath=None, limit=None): |
140 | 140 | return self.vcs.get_log(relpath, limit) |
235 | 235 | raise NotImplementedError( |
236 | 236 | "Base class get_diff method must be overridden") |
237 | 237 | |
238 | def get_status(self, basepath=None, untracked=False): | |
238 | def get_status(self, basepath=None, untracked=False, **kwargs): | |
239 | 239 | """ |
240 | 240 | Calls scm status command. Output must be terminated by newline |
241 | 241 | unless empty. |
244 | 244 | In SVN, this would be new files only. In git, |
245 | 245 | hg, bzr, this would be changes that have not been added for |
246 | 246 | commit. |
247 | ||
248 | Extra keyword arguments are passed along to the underlying vcs code. | |
249 | See the specific implementations of get_status() for extra options. | |
247 | 250 | |
248 | 251 | :param basepath: status path will be relative to this, if any |
249 | 252 | :param untracked: whether to also show changes that would not commit |
0 | 0 | [DEFAULT] |
1 | 1 | Depends: subversion, mercurial, git-core, bzr, python-yaml, python-dateutil |
2 | 2 | Depends3: subversion, mercurial, git-core, bzr, python3-yaml |
3 | Suite: oneiric precise quantal raring saucy trusty utopic vivid wily xenial yakkety wheezy jessie | |
3 | Suite: oneiric precise quantal raring saucy trusty utopic vivid wily xenial yakkety zesty artful bionic wheezy jessie stretch | |
4 | 4 | X-Python3-Version: >= 3.2 |
43 | 43 | from vcstools.bzr import BzrClient, _get_bzr_version |
44 | 44 | |
45 | 45 | |
46 | os.environ['EMAIL'] = 'Your Name <name@example.com>' | |
47 | ||
48 | ||
46 | 49 | class BzrClientTestSetups(unittest.TestCase): |
47 | 50 | |
48 | 51 | @classmethod |
49 | 52 | def setUpClass(self): |
50 | try: | |
51 | subprocess.check_call(["bzr", "whoami"]) | |
52 | except subprocess.CalledProcessError: | |
53 | subprocess.check_call(["bzr", "whoami", '"ros ros@ros.org"']) | |
54 | ||
55 | 53 | self.root_directory = tempfile.mkdtemp() |
56 | 54 | self.directories = dict(setUp=self.root_directory) |
57 | 55 | self.remote_path = os.path.join(self.root_directory, "remote") |
51 | 51 | except ImportError: |
52 | 52 | from SocketServer import TCPServer, BaseRequestHandler |
53 | 53 | |
54 | os.environ['GIT_AUTHOR_NAME'] = 'Your Name' | |
55 | os.environ['GIT_COMMITTER_NAME'] = 'Your Name' | |
56 | os.environ['GIT_AUTHOR_EMAIL'] = 'name@example.com' | |
57 | os.environ['EMAIL'] = 'Your Name <name@example.com>' | |
58 | ||
54 | 59 | |
55 | 60 | class GitClientTestSetups(unittest.TestCase): |
56 | 61 | |
480 | 485 | |
481 | 486 | def testStatusClean(self): |
482 | 487 | client = GitClient(self.remote_path) |
483 | self.assertEquals('', client.get_status()) | |
488 | self.assertEquals('', client.get_status(porcelain=True)) | |
484 | 489 | |
485 | 490 | def test_get_environment_metadata(self): |
486 | 491 | # Verify that metadata is generated |
814 | 819 | # produce many tags to make git log command fail if all are added |
815 | 820 | for count in range(4000): |
816 | 821 | subprocess.check_call("git tag modified-%s" % count, shell=True, cwd=self.local_path) |
817 | po = subprocess.Popen("git log -n 1 --pretty=format:\"%H\"", shell=True, cwd=self.local_path, stdout=subprocess.PIPE) | |
822 | po = subprocess.Popen( | |
823 | "git log -n 1 --pretty=format:\"%H\"", | |
824 | shell=True, cwd=self.local_path, stdout=subprocess.PIPE) | |
818 | 825 | self.last_version = po.stdout.read().decode('UTF-8').rstrip('"').lstrip('"') |
819 | 826 | |
820 | 827 | def test_orphaned_overflow(self): |
856 | 863 | client = GitClient(self.local_path) |
857 | 864 | self.assertTrue(client.path_exists()) |
858 | 865 | self.assertTrue(client.detect_presence()) |
859 | self.assertEquals('diff --git ./added.txt ./added.txt\nnew file mode 100644\nindex 0000000..454f6b3\n--- /dev/null\n+++ ./added.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./deleted-fs.txt ./deleted-fs.txt\ndeleted file mode 100644\nindex e69de29..0000000\ndiff --git ./deleted.txt ./deleted.txt\ndeleted file mode 100644\nindex e69de29..0000000\ndiff --git ./modified-fs.txt ./modified-fs.txt\nindex e69de29..454f6b3 100644\n--- ./modified-fs.txt\n+++ ./modified-fs.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ./modified.txt ./modified.txt\nindex e69de29..454f6b3 100644\n--- ./modified.txt\n+++ ./modified.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file', client.get_diff().rstrip()) | |
866 | self.assertEquals( | |
867 | '''\ | |
868 | diff --git ./added.txt ./added.txt | |
869 | new file mode 100644 | |
870 | index 0000000..454f6b3 | |
871 | --- /dev/null | |
872 | +++ ./added.txt | |
873 | @@ -0,0 +1 @@ | |
874 | +0123456789abcdef | |
875 | \\ No newline at end of file | |
876 | diff --git ./deleted-fs.txt ./deleted-fs.txt | |
877 | deleted file mode 100644 | |
878 | index e69de29..0000000 | |
879 | diff --git ./deleted.txt ./deleted.txt | |
880 | deleted file mode 100644 | |
881 | index e69de29..0000000 | |
882 | diff --git ./modified-fs.txt ./modified-fs.txt | |
883 | index e69de29..454f6b3 100644 | |
884 | --- ./modified-fs.txt | |
885 | +++ ./modified-fs.txt | |
886 | @@ -0,0 +1 @@ | |
887 | +0123456789abcdef | |
888 | \\ No newline at end of file | |
889 | diff --git ./modified.txt ./modified.txt | |
890 | index e69de29..454f6b3 100644 | |
891 | --- ./modified.txt | |
892 | +++ ./modified.txt | |
893 | @@ -0,0 +1 @@ | |
894 | +0123456789abcdef | |
895 | \\ No newline at end of file''', | |
896 | client.get_diff().rstrip()) | |
860 | 897 | |
861 | 898 | def testDiffRelpath(self): |
862 | 899 | client = GitClient(self.local_path) |
863 | 900 | self.assertTrue(client.path_exists()) |
864 | 901 | self.assertTrue(client.detect_presence()) |
865 | self.assertEquals('diff --git ros/added.txt ros/added.txt\nnew file mode 100644\nindex 0000000..454f6b3\n--- /dev/null\n+++ ros/added.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ros/deleted-fs.txt ros/deleted-fs.txt\ndeleted file mode 100644\nindex e69de29..0000000\ndiff --git ros/deleted.txt ros/deleted.txt\ndeleted file mode 100644\nindex e69de29..0000000\ndiff --git ros/modified-fs.txt ros/modified-fs.txt\nindex e69de29..454f6b3 100644\n--- ros/modified-fs.txt\n+++ ros/modified-fs.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file\ndiff --git ros/modified.txt ros/modified.txt\nindex e69de29..454f6b3 100644\n--- ros/modified.txt\n+++ ros/modified.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file', client.get_diff(basepath=os.path.dirname(self.local_path)).rstrip()) | |
902 | self.assertEquals( | |
903 | '''\ | |
904 | diff --git ros/added.txt ros/added.txt | |
905 | new file mode 100644 | |
906 | index 0000000..454f6b3 | |
907 | --- /dev/null | |
908 | +++ ros/added.txt | |
909 | @@ -0,0 +1 @@ | |
910 | +0123456789abcdef | |
911 | \\ No newline at end of file | |
912 | diff --git ros/deleted-fs.txt ros/deleted-fs.txt | |
913 | deleted file mode 100644 | |
914 | index e69de29..0000000 | |
915 | diff --git ros/deleted.txt ros/deleted.txt | |
916 | deleted file mode 100644 | |
917 | index e69de29..0000000 | |
918 | diff --git ros/modified-fs.txt ros/modified-fs.txt | |
919 | index e69de29..454f6b3 100644 | |
920 | --- ros/modified-fs.txt | |
921 | +++ ros/modified-fs.txt | |
922 | @@ -0,0 +1 @@ | |
923 | +0123456789abcdef | |
924 | \\ No newline at end of file | |
925 | diff --git ros/modified.txt ros/modified.txt | |
926 | index e69de29..454f6b3 100644 | |
927 | --- ros/modified.txt | |
928 | +++ ros/modified.txt | |
929 | @@ -0,0 +1 @@ | |
930 | +0123456789abcdef | |
931 | \\ No newline at end of file''', | |
932 | client.get_diff(basepath=os.path.dirname(self.local_path)).rstrip()) | |
866 | 933 | |
867 | 934 | def testStatus(self): |
868 | 935 | client = GitClient(self.local_path) |
869 | 936 | self.assertTrue(client.path_exists()) |
870 | 937 | self.assertTrue(client.detect_presence()) |
871 | self.assertEquals('A ./added.txt\n D ./deleted-fs.txt\nD ./deleted.txt\n M ./modified-fs.txt\nM ./modified.txt\n', client.get_status()) | |
938 | self.assertEquals( | |
939 | '''\ | |
940 | A ./added.txt | |
941 | D ./deleted-fs.txt | |
942 | D ./deleted.txt | |
943 | M ./modified-fs.txt | |
944 | M ./modified.txt | |
945 | ''', | |
946 | client.get_status(porcelain=True)) | |
872 | 947 | |
873 | 948 | def testStatusRelPath(self): |
874 | 949 | client = GitClient(self.local_path) |
875 | 950 | self.assertTrue(client.path_exists()) |
876 | 951 | self.assertTrue(client.detect_presence()) |
877 | self.assertEquals('A ros/added.txt\n D ros/deleted-fs.txt\nD ros/deleted.txt\n M ros/modified-fs.txt\nM ros/modified.txt\n', client.get_status(basepath=os.path.dirname(self.local_path))) | |
952 | self.assertEquals( | |
953 | '''\ | |
954 | A ros/added.txt | |
955 | D ros/deleted-fs.txt | |
956 | D ros/deleted.txt | |
957 | M ros/modified-fs.txt | |
958 | M ros/modified.txt | |
959 | ''', | |
960 | client.get_status(basepath=os.path.dirname(self.local_path), porcelain=True)) | |
878 | 961 | |
879 | 962 | def testStatusUntracked(self): |
880 | 963 | client = GitClient(self.local_path) |
881 | 964 | self.assertTrue(client.path_exists()) |
882 | 965 | self.assertTrue(client.detect_presence()) |
883 | self.assertEquals('A ./added.txt\n D ./deleted-fs.txt\nD ./deleted.txt\n M ./modified-fs.txt\nM ./modified.txt\n?? ./added-fs.txt\n', client.get_status(untracked=True)) | |
966 | self.assertEquals( | |
967 | '''\ | |
968 | A ./added.txt | |
969 | D ./deleted-fs.txt | |
970 | D ./deleted.txt | |
971 | M ./modified-fs.txt | |
972 | M ./modified.txt | |
973 | ?? ./added-fs.txt | |
974 | ''', | |
975 | client.get_status(untracked=True, porcelain=True)) | |
884 | 976 | |
885 | 977 | |
886 | 978 | class GitExportClientTest(GitClientTestSetups): |
933 | 1025 | ['master', 'test_branch', 'remotes/origin/master', |
934 | 1026 | 'remotes/origin/test_branch']) |
935 | 1027 | |
1028 | ||
936 | 1029 | class GitTimeoutTest(unittest.TestCase): |
937 | 1030 | |
938 | 1031 | class MuteHandler(BaseRequestHandler): |
952 | 1045 | self.root_directory = tempfile.mkdtemp() |
953 | 1046 | self.local_path = os.path.join(self.root_directory, "ros") |
954 | 1047 | |
955 | ||
956 | 1048 | def test_checkout_timeout(self): |
957 | ## SSH'ing to a mute server will hang for a very long time | |
1049 | # SSH'ing to a mute server will hang for a very long time | |
958 | 1050 | url = 'ssh://test@127.0.0.1:{0}/test'.format(self.mute_port) |
959 | 1051 | client = GitClient(self.local_path) |
960 | 1052 | start = time.time() |
40 | 40 | import tarfile |
41 | 41 | import filecmp |
42 | 42 | from contextlib import closing |
43 | from distutils.version import LooseVersion | |
44 | ||
45 | from vcstools.git import GitClient, _get_git_version | |
43 | ||
44 | from vcstools.git import GitClient | |
46 | 45 | |
47 | 46 | |
48 | 47 | class GitClientTestSetups(unittest.TestCase): |
145 | 144 | def tearDownClass(self): |
146 | 145 | for d in self.directories: |
147 | 146 | shutil.rmtree(self.directories[d]) |
148 | pass | |
149 | 147 | |
150 | 148 | def tearDown(self): |
151 | 149 | if os.path.exists(self.local_path): |
152 | 150 | shutil.rmtree(self.local_path) |
153 | 151 | if os.path.exists(self.export_path): |
154 | 152 | shutil.rmtree(self.export_path) |
155 | pass | |
156 | 153 | |
157 | 154 | |
158 | 155 | class GitClientTest(GitClientTestSetups): |
343 | 340 | self.assertTrue(subclient2.path_exists()) |
344 | 341 | self.assertTrue(subsubclient2.path_exists()) |
345 | 342 | |
346 | def test_checkout_master_with_subs(self): | |
343 | def test_checkout_master_with_subs2(self): | |
347 | 344 | url = self.remote_path |
348 | 345 | client = GitClient(self.local_path) |
349 | 346 | subclient = GitClient(self.sublocal_path) |
435 | 432 | url = self.remote_path |
436 | 433 | client = GitClient(self.local_path) |
437 | 434 | self.assertTrue(client.checkout(url)) |
438 | output = client.get_status() | |
439 | self.assertEqual('', output, output) | |
435 | output = client.get_status(porcelain=True) # porcelain=True ensures stable format | |
436 | self.assertEqual('', output, "Expected empty string, got `{0}`".format(output)) | |
440 | 437 | |
441 | 438 | with open(os.path.join(self.local_path, 'fixed.txt'), 'a') as f: |
442 | 439 | f.write('0123456789abcdef') |
448 | 445 | f.write('012345cdef') |
449 | 446 | subprocess.check_call("touch subsubnew.txt", shell=True, cwd=self.subsublocal_path) |
450 | 447 | |
451 | output = client.get_status() | |
452 | self.assertEqual( | |
453 | ' M ./fixed.txt\n M ./submodule\n M ./subfixed.txt\n M ./subsubmodule\n M ./subsubfixed.txt', output.rstrip()) | |
454 | ||
455 | output = client.get_status(untracked=True) | |
456 | self.assertEqual( | |
457 | ' M ./fixed.txt\n M ./submodule\n?? ./new.txt\n M ./subfixed.txt\n M ./subsubmodule\n?? ./subnew.txt\n M ./subsubfixed.txt\n?? ./subsubnew.txt', output.rstrip()) | |
458 | ||
459 | output = client.get_status(basepath=os.path.dirname(self.local_path), untracked=True) | |
460 | self.assertEqual(' M local/fixed.txt\n M local/submodule\n?? local/new.txt\n M local/subfixed.txt\n M local/subsubmodule\n?? local/subnew.txt\n M local/subsubfixed.txt\n?? local/subsubnew.txt', output.rstrip()) | |
448 | output = client.get_status(porcelain=True) # porcelain=True ensures stable format | |
449 | self.assertEqual('''\ | |
450 | M ./fixed.txt | |
451 | M ./submodule | |
452 | M ./subfixed.txt | |
453 | M ./subsubmodule | |
454 | M ./subsubfixed.txt''', output.rstrip()) | |
455 | ||
456 | output = client.get_status(untracked=True, porcelain=True) | |
457 | self.assertEqual('''\ | |
458 | M ./fixed.txt | |
459 | M ./submodule | |
460 | ?? ./new.txt | |
461 | M ./subfixed.txt | |
462 | M ./subsubmodule | |
463 | ?? ./subnew.txt | |
464 | M ./subsubfixed.txt | |
465 | ?? ./subsubnew.txt''', output.rstrip()) | |
466 | ||
467 | output = client.get_status( | |
468 | basepath=os.path.dirname(self.local_path), | |
469 | untracked=True, | |
470 | porcelain=True) | |
471 | self.assertEqual('''\ | |
472 | M local/fixed.txt | |
473 | M local/submodule | |
474 | ?? local/new.txt | |
475 | M local/subfixed.txt | |
476 | M local/subsubmodule | |
477 | ?? local/subnew.txt | |
478 | M local/subsubfixed.txt | |
479 | ?? local/subsubnew.txt''', output.rstrip()) | |
461 | 480 | |
462 | 481 | def test_diff(self): |
463 | 482 | url = self.remote_path |
478 | 497 | |
479 | 498 | output = client.get_diff() |
480 | 499 | self.assertEqual(1094, len(output)) |
481 | self.assertTrue('diff --git ./fixed.txt ./fixed.txt\nindex e69de29..454f6b3 100644\n--- ./fixed.txt\n+++ ./fixed.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\\ No newline at end of file' in output) | |
482 | self.assertTrue('diff --git ./submodule/subsubmodule/subsubfixed.txt ./submodule/subsubmodule/subsubfixed.txt\nindex e69de29..1a332dc 100644\n--- ./submodule/subsubmodule/subsubfixed.txt\n+++ ./submodule/subsubmodule/subsubfixed.txt\n@@ -0,0 +1 @@\n+012345cdef\n\\ No newline at end of file' in output) | |
500 | self.assertTrue('''\ | |
501 | diff --git ./fixed.txt ./fixed.txt | |
502 | index e69de29..454f6b3 100644 | |
503 | --- ./fixed.txt | |
504 | +++ ./fixed.txt | |
505 | @@ -0,0 +1 @@ | |
506 | +0123456789abcdef | |
507 | \\ No newline at end of file''' in output) | |
508 | self.assertTrue('''\ | |
509 | diff --git ./submodule/subsubmodule/subsubfixed.txt ./submodule/subsubmodule/subsubfixed.txt | |
510 | index e69de29..1a332dc 100644 | |
511 | --- ./submodule/subsubmodule/subsubfixed.txt | |
512 | +++ ./submodule/subsubmodule/subsubfixed.txt | |
513 | @@ -0,0 +1 @@ | |
514 | +012345cdef | |
515 | \\ No newline at end of file''' in output) | |
483 | 516 | |
484 | 517 | output = client.get_diff(basepath=os.path.dirname(self.local_path)) |
485 | 518 | self.assertEqual(1174, len(output)) |
486 | self.assertTrue('diff --git local/fixed.txt local/fixed.txt\nindex e69de29..454f6b3 100644\n--- local/fixed.txt\n+++ local/fixed.txt\n@@ -0,0 +1 @@\n+0123456789abcdef\n\ No newline at end of file' in output, output) | |
487 | self.assertTrue('diff --git local/submodule/subsubmodule/subsubfixed.txt local/submodule/subsubmodule/subsubfixed.txt\nindex e69de29..1a332dc 100644\n--- local/submodule/subsubmodule/subsubfixed.txt\n+++ local/submodule/subsubmodule/subsubfixed.txt\n@@ -0,0 +1 @@\n+012345cdef\n\ No newline at end of file' in output, output) | |
519 | self.assertTrue('''\ | |
520 | diff --git local/fixed.txt local/fixed.txt | |
521 | index e69de29..454f6b3 100644 | |
522 | --- local/fixed.txt | |
523 | +++ local/fixed.txt | |
524 | @@ -0,0 +1 @@ | |
525 | +0123456789abcdef | |
526 | \ No newline at end of file''' in output, output) | |
527 | self.assertTrue(''' | |
528 | diff --git local/submodule/subsubmodule/subsubfixed.txt local/submodule/subsubmodule/subsubfixed.txt | |
529 | index e69de29..1a332dc 100644 | |
530 | --- local/submodule/subsubmodule/subsubfixed.txt | |
531 | +++ local/submodule/subsubmodule/subsubfixed.txt | |
532 | @@ -0,0 +1 @@ | |
533 | +012345cdef | |
534 | \ No newline at end of file''' in output, output) |