Ignore:
Timestamp:
05-03-09 23:56:33 (4 years ago)
Author:
thomas
Message:
  • moap/command/cl.py:
  • moap/test/test_commands_cl.py: moap cl diff should only show files once even if they're mentioned multiple times. Fixes #303.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/moap/test/test_commands_cl.py

    r348 r384  
    363363        l = len("2007-07-30") 
    364364        self.assertEquals(stdout.getvalue()[l:], expected[l:]) 
     365 
     366    def testDoubleDiff(self): 
     367        # see https://thomas.apestaart.org/moap/trac/ticket/303 
     368 
     369        # Override any externally set CHANGE_LOG_NAME and _EMAIL_ADDRESS 
     370        os.environ['CHANGE_LOG_NAME'] = 'Hugo van der Hardcore' 
     371        os.environ['CHANGE_LOG_EMAIL_ADDRESS'] ='hugo@ninenin.jas' 
     372 
     373        os.system('svn co file://%s %s > /dev/null' % ( 
     374            self.repodir, self.livedir)) 
     375        self.liveWriteFile('ChangeLog', '') 
     376        os.system('svn add %s > /dev/null' % os.path.join(self.livedir, 
     377            'ChangeLog')) 
     378        self.liveWriteFile('test', '') 
     379        os.system('svn add %s > /dev/null' % os.path.join(self.livedir, 
     380            'test')) 
     381        os.system('svn commit -m "add" %s' % 
     382            os.path.join(self.livedir)) 
     383 
     384        self.liveWriteFile('test', 'some contents') 
     385 
     386        log.debug('unittest', 'moap cl prep -c') 
     387        c = cl.ChangeLog(stdout=common.FakeStdOut()) 
     388        c.parse(['-C', self.livedir, 'prepare', '-c', ]) 
     389        # add the test file a second time 
     390        handle = open(os.path.join(self.livedir, 'ChangeLog'), 'a') 
     391        handle.write('\t* test:\n') 
     392        handle.close() 
     393 
     394 
     395        # FIXME: the diff command will diff relative paths; 
     396        # so running just moap cl diff will not actually change to the repo 
     397        # path and fail to show diffs 
     398        oldPath = os.getcwd() 
     399        os.chdir(self.livedir) 
     400        log.debug('unittest', 'moap cl diff') 
     401        stdout = StringIO.StringIO() 
     402        c = cl.ChangeLog(stdout=stdout) 
     403        c.parse(['-C', self.livedir, 'diff', ]) 
     404        os.chdir(oldPath) 
     405 
     406        firstline = time.strftime('%Y-%m-%d') + '  ' + \ 
     407                    'Hugo van der Hardcore' + '  <' + 'hugo@ninenin.jas' + '>' 
     408        expected = firstline + """ 
     409 
     410\treviewed by: <delete if not using a buddy> 
     411\tpatch by: <delete if not someone else's patch> 
     412 
     413\t* test: 
     414 
     415\t* test: 
     416Index: test 
     417=================================================================== 
     418--- test\t(revision 1) 
     419+++ test\t(working copy) 
     420@@ -0,0 +1 @@ 
     421+some contents 
     422\ No newline at end of file 
     423""" 
     424        # skip the date 
     425        l = len("2007-07-30") 
     426        self.assertEquals(stdout.getvalue()[l:], expected[l:]) 
     427 
    365428 
    366429    def testPrepareTagged(self): 
Note: See TracChangeset for help on using the changeset viewer.