Changeset 383


Ignore:
Timestamp:
05-03-09 23:12:11 (4 years ago)
Author:
thomas
Message:

patch by: Arek Korbik

  • moap/test/test_vcs_bzr.py:
  • moap/test/test_vcs_git.py:
  • moap/vcs/bzr.py:
  • moap/vcs/git.py: Fix for quotes in commit messages. Fixes #280.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r381 r383  
     12009-03-05  Thomas Vander Stichele  <thomas at apestaart dot org> 
     2 
     3        patch by: Arek Korbik 
     4 
     5        * moap/test/test_vcs_bzr.py: 
     6        * moap/test/test_vcs_git.py: 
     7        * moap/vcs/bzr.py: 
     8        * moap/vcs/git.py: 
     9          Fix for quotes in commit messages. 
     10          Fixes #280. 
     11 
    1122009-03-05  Thomas Vander Stichele  <thomas at apestaart dot org> 
    213 
  • trunk/moap/test/test_vcs_bzr.py

    r366 r383  
    4343        os.system('rm -rf %s' % checkout) 
    4444 
     45class TestCommit(BzrTestCase): 
     46    def testQuotedCommit(self): 
     47        filename = os.path.join(self.checkout, 'one_line_file.txt') 
     48        open(filename, 'w').write('This is one line file.\n') 
     49        cmd = 'bzr add %s' % filename 
     50        (status, output) = commands.getstatusoutput(cmd) 
     51        self.failIf(status, "Non-null status %r" % status) 
     52 
     53        v = bzr.VCSClass(self.checkout)  
     54        self.failUnless(v) 
     55        v.commit(['one_line_file.txt', ], "I contain quotes like ' and \"") 
     56 
     57  
    4558class TestTree(BzrTestCase): 
    4659    def testBzr(self): 
  • trunk/moap/test/test_vcs_git.py

    r366 r383  
    1616    def setUp(self): 
    1717        self.repository = tempfile.mkdtemp(prefix="moap.test.repo.") 
    18         oldPath = os.getcwd() 
     18        self.oldPath = os.getcwd() 
    1919        os.chdir(self.repository) 
    2020        os.system('git init > /dev/null') 
     
    2525 
    2626        os.system('git add README > /dev/null') 
    27         os.system('git commit -a -m "readme > /dev/null"') 
     27        os.system('git commit -a -m "readme" > /dev/null') 
    2828 
    29         os.chdir(oldPath) 
     29        os.chdir(self.oldPath) 
    3030        self.checkout = tempfile.mkdtemp(prefix="moap.test.checkout.") 
    3131        os.rmdir(self.checkout) 
     
    3636         
    3737    def tearDown(self): 
     38        os.chdir(self.oldPath) 
    3839        os.system('rm -rf %s' % self.checkout) 
    3940        os.system('rm -rf %s' % self.repository) 
     
    5455        self.failIf(git.detect(checkout)) 
    5556        os.system('rm -rf %s' % checkout) 
     57 
     58class TestCommit(GitTestCase): 
     59    def testQuotedCommit(self): 
     60        filename = os.path.join(self.checkout, 'one_line_file.txt') 
     61        open(filename, 'w').write('This is one line file.\n') 
     62        os.chdir(self.checkout) 
     63        cmd = 'git add one_line_file.txt' 
     64        (status, output) = commands.getstatusoutput(cmd) 
     65        self.failIf(status, "Non-null status %r, output %r" % (status, output)) 
     66 
     67        v = git.VCSClass(self.checkout)  
     68        self.failUnless(v) 
     69        v.commit(['one_line_file.txt', ], "I contain quotes like ' and \"") 
    5670 
    5771class TestTree(GitTestCase): 
  • trunk/moap/vcs/bzr.py

    r366 r383  
    6565            oldPath = os.getcwd() 
    6666            os.chdir(self.path) 
    67             os.system("bzr commit -m \"%s\" %s" % (message, " ".join(paths))) 
     67            temp = util.writeTemp([message, ]) 
     68            os.system("bzr commit --file %s %s" % (temp, " ".join(paths))) 
     69            os.unlink(temp) 
    6870        finally: 
    6971            os.chdir(oldPath) 
  • trunk/moap/vcs/git.py

    r366 r383  
    8282            if status != 0: 
    8383                raise vcs.VCSException(output) 
    84             cmd = "git commit -m '%s' %s" % (message, " ".join(paths)) 
     84            temp = util.writeTemp([message, ]) 
     85            cmd = "git commit -F %s %s" % (temp, " ".join(paths)) 
    8586            self.debug("Running %s" % cmd) 
    8687            status, output = commands.getstatusoutput(cmd) 
     88            os.unlink(temp) 
    8789            if status != 0: 
    8890                raise vcs.VCSException(output) 
Note: See TracChangeset for help on using the changeset viewer.