Example #1
0
 def setUp(self):
     SubversionSetup.setUp(self)
     process = Process(quiet=True)
     process.system('svn mv -m"Rename" "file://%s/tags" "file://%s/tag"' %
         (self.packagedir, self.packagedir))
     process.system('svn mv -m"Rename" "file://%s/branches" "file://%s/branch"' %
         (self.packagedir, self.packagedir))
Example #2
0
 def checkout(self, path='trunk', target=None):
     process = Process(quiet=True)
     if target is None:
         self.checkoutdir = join(self.tempdir, self.packagename)
     else:
         self.checkoutdir = join(self.tempdir, target, self.packagename)
     process.system('svn checkout file://%s/%s %s' % (self.repo,
         path, self.checkoutdir))
     os.chdir(self.checkoutdir)
Example #3
0
 def clone(self):
     process = Process(quiet=True)
     process.system('git clone testpackage testclone')
     self.clonedir = join(self.tempdir, 'testclone')
     # Park the server on a branch because "Updating the currently
     # checked-out branch may cause confusion."
     self.dirstack.push('testpackage')
     process.system('git checkout -b parking')
     self.dirstack.pop()
Example #4
0
 def clone(self):
     process = Process(quiet=True)
     process.system('git clone testpackage testclone')
     self.clonedir = join(self.tempdir, 'testclone')
     # Park the server on a branch because "Updating the currently
     # checked-out branch may cause confusion."
     self.dirstack.push('testpackage')
     process.system('git checkout -b parking')
     self.dirstack.pop()
Example #5
0
 def _fake_clone(self):
     # Fake a checkout, the real thing is too expensive
     process = Process(quiet=True)
     source = self._fake_source
     package = join(dirname(__file__), 'tests', source)
     archive = zipfile.ZipFile(package, 'r')
     archive.extractall()
     os.rename(source[:-4], 'testclone')
     self.dirstack.push('testclone')
     if self.scm.version_info[:2] >= (1, 7):
         url = process.popen('svn info')[1][2][5:]
     else:
         url = process.popen('svn info')[1][1][5:]
     process.system('svn switch --relocate %s file://%s/trunk' % (url, self.packagedir))
     self.dirstack.pop()
     self.clonedir = join(self.tempdir, 'testclone')
Example #6
0
 def test_env(self):
     env = os.environ.copy()
     env['HELLO'] = 'Hello world'
     process = Process(env=env)
     rc = process.system('echo ${HELLO} > output')
     self.assertEqual(rc, 0)
     self.assertEqual(process.pipe('cat output'), 'Hello world')
Example #7
0
 def test_env(self):
     env = os.environ.copy()
     env['HELLO'] = 'Hello world'
     process = Process(env=env)
     rc = process.system('echo ${HELLO} > output')
     self.assertEqual(rc, 0)
     self.assertEqual(process.pipe('cat output'), 'Hello world')
Example #8
0
 def _fake_clone(self):
     # Fake a checkout, the real thing is too expensive
     process = Process(quiet=True)
     source = self._fake_source
     package = join(dirname(__file__), 'tests', source)
     archive = zipfile.ZipFile(package, 'r')
     archive.extractall()
     os.rename(source[:-4], 'testclone')
     self.dirstack.push('testclone')
     if self.scm.version_info[:2] >= (1, 7):
         url = process.popen('svn info')[1][2][5:]
     else:
         url = process.popen('svn info')[1][1][5:]
     process.system('svn switch --relocate %s file://%s/trunk' %
                    (url, self.packagedir))
     self.dirstack.pop()
     self.clonedir = join(self.tempdir, 'testclone')
    def testGetGitifySubversion(self):
        """
        Support git-svn-helpers/gitify style dual git/svn checkouts/clones.
        """
        # Simulate a git-svn-helpers/gitify style dual svn/git checkout/clone
        svn_url = urlparse.urlunsplit(('file', '', self.packagedir, '', ''))
        git_svn_clonedir = self.clonedir + '.git-svn'
        process = Process(quiet=True)
        process.system(
            'git svn clone -s {0} {1}'.format(svn_url, git_svn_clonedir))
        os.rename(
            os.path.join(git_svn_clonedir, '.git'),
            os.path.join(self.clonedir, '.git'))

        scms = SCMFactory()
        self.assertEqual(scms.get_scm_from_url(svn_url).name, 'svn')
        self.assertEqual(scms.get_scm_from_sandbox(self.clonedir).name, 'svn')
 def testAmbiguousSandbox(self):
     scms = SCMFactory()
     process = Process()
     self.dirstack.push(self.packagedir)
     process.system('hg init .')
     process.system('hg add README.txt setup.py testpackage/__init__.py')
     process.system('hg commit -m"Import"')
     self.dirstack.pop()
     self.assertRaises(SystemExit, scms.get_scm, None, self.packagedir)
Example #11
0
 def clone(self):
     process = Process(quiet=True)
     process.system('git clone testpackage testclone')
     self.clonedir = join(self.tempdir, 'testclone')
     # Park the server on a branch
     self.dirstack.push('testpackage')
     process.system('git checkout parking')
     self.dirstack.pop()
     # Make sure the clone is on master
     self.dirstack.push('testclone')
     process.system('git checkout master')
     self.dirstack.pop()
Example #12
0
 def remove(self, dir):
     process = Process(quiet=True)
     process.system('git rm setup.py')
Example #13
0
 def modifyprop(self, dir):
     process = Process(quiet=True)
     if self.scm.version_info[:2] >= (1, 8):
         process.system('svn propset format "text/x-python" setup.py')
     else:
         process.system('svn propset svn:format "text/x-python" setup.py')
Example #14
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('git branch %s' % branchid)
     process.system('git checkout %s' % branchid)
Example #15
0
 def update(self, dir):
     process = Process(quiet=True)
     process.system('git checkout master')
Example #16
0
 def test_bad_cmd(self):
     process = Process()
     rc = process.system('$ "Hello world" 2> output')
     self.assertEqual(rc, 127)
Example #17
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('hg tag %s' % tagid)
     process.system('hg update %s' % tagid)
Example #18
0
 def test_quiet(self):
     process = Process(quiet=True)
     rc = process.system('echo "Hello world"')
     self.assertEqual(rc, 0)
Example #19
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('svn cp -m"Tag" file://%s/trunk %s' %
                    (self.packagedir, tagid))
     process.system('svn co %s testtag' % tagid)
     self.tagdir = join(self.tempdir, 'testtag')
Example #20
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('git branch %s' % branchid)
     process.system('git checkout %s' % branchid)
Example #21
0
 def clone(self):
     process = Process(quiet=True)
     process.system('svn checkout file://%s/trunk testclone' % self.packagedir)
     self.clonedir = join(self.tempdir, 'testclone')
Example #22
0
 def test_bad_cmd(self):
     process = Process()
     rc = process.system('$ "Hello world" 2> output')
     self.assertEqual(rc, 127)
Example #23
0
 def update(self, dir):
     process = Process(quiet=True)
     process.system('git checkout master')
Example #24
0
 def clone(self):
     process = Process(quiet=True)
     process.system('hg clone testpackage testclone')
     self.clonedir = join(self.tempdir, 'testclone')
Example #25
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('git tag %s' % tagid)
     process.system('git checkout %s' % tagid)
Example #26
0
 def test_simple(self):
     process = Process()
     rc = process.system('echo "Hello world" > output')
     self.assertEqual(rc, 0)
     self.assertEqual(process.pipe('cat output'), 'Hello world')
Example #27
0
 def clone(self):
     process = Process(quiet=True)
     process.system('svn checkout file://%s/trunk testclone' %
                    self.packagedir)
     self.clonedir = join(self.tempdir, 'testclone')
Example #28
0
 def modifyprop(self, dir):
     process = Process(quiet=True)
     process.system('svn propset svn:format "text/x-python" setup.py')
Example #29
0
 def modifyprop(self, dir):
     process = Process(quiet=True)
     process.system('svn propset svn:format "text/x-python" setup.py')
Example #30
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('svn cp -m"Tag" file://%s/trunk %s' % (self.packagedir, tagid))
     process.system('svn co %s testtag' % tagid)
     self.tagdir = join(self.tempdir, 'testtag')
Example #31
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('svn cp -m"Branch" file://%s/trunk %s' %
                    (self.packagedir, branchid))
     process.system('svn co %s testbranch' % branchid)
     self.branchdir = join(self.tempdir, 'testbranch')
Example #32
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('svn cp -m"Branch" file://%s/trunk %s' % (self.packagedir, branchid))
     process.system('svn co %s testbranch' % branchid)
     self.branchdir = join(self.tempdir, 'testbranch')
Example #33
0
 def update(self, dir):
     process = Process(quiet=True)
     process.system('hg update')
Example #34
0
 def clone(self):
     process = Process(quiet=True)
     process.system('hg clone testpackage testclone')
     self.clonedir = join(self.tempdir, 'testclone')
Example #35
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('hg branch %s' % branchid)
Example #36
0
 def update(self, dir):
     process = Process(quiet=True)
     process.system('hg update')
Example #37
0
 def remove(self, dir):
     process = Process(quiet=True)
     process.system('git rm setup.py')
Example #38
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('hg tag %s' % tagid)
     process.system('hg update %s' % tagid)
Example #39
0
 def tag(self, dir, tagid):
     process = Process(quiet=True)
     process.system('git tag %s' % tagid)
     process.system('git checkout %s' % tagid)
Example #40
0
 def test_simple(self):
     process = Process()
     rc = process.system('echo "Hello world" > output')
     self.assertEqual(rc, 0)
     self.assertEqual(process.pipe('cat output'), 'Hello world')
Example #41
0
 def branch(self, dir, branchid):
     process = Process(quiet=True)
     process.system('hg branch %s' % branchid)
Example #42
0
 def test_quiet(self):
     process = Process(quiet=True)
     rc = process.system('echo "Hello world"')
     self.assertEqual(rc, 0)