def testSpecFor(self): r = TestRepo('foo', TestClock()) ref = r['refs/heads/master'] spec = { 'cool_file': ('whazzap', 0755), # executable 'subdir': { 'crazy times': ('this is awesome', 0644) } } c = ref.make_full_tree_commit('Initial Commit', spec) self.assertEquals(spec, r.spec_for(c)) # can take a raw tree hash too self.assertEquals( r.spec_for(r.run('rev-parse', '%s:subdir' % c.hsh).strip()), { 'crazy times': ('this is awesome', 0644) } )
def testMergeSpecs(self): r = TestRepo('foo', TestClock()) ref = r['refs/heads/master'] spec = { 'cool_file': ('whazzap', 0755), # executable 'subdir': { 'crazy times': ('this is awesome', 0644) }, 'nested': { 'nested_file': 'one thing', 'nested_carry': 'can\'t touch this', }, 'carry_over': 'this is the same before and after', } ref.make_commit('Initial Commit', spec) c = ref.make_commit('Differential Commit', { 'cool_file': None, 'subdir': 'now its a file', 'nested': { 'nested_file': 'other thing' }, 'other_dir': { 'neat-o': 'it\'s a neat file!' }, }) self.assertEquals(r.spec_for(c), { 'subdir': ('now its a file', 0644), 'other_dir': { 'neat-o': ('it\'s a neat file!', 0644) }, 'nested': { 'nested_file': ('other thing', 0644), 'nested_carry': ('can\'t touch this', 0644) }, 'carry_over': ('this is the same before and after', 0644), })
def testMergeSpecs(self): r = TestRepo('foo', TestClock()) ref = r['refs/heads/master'] spec = { 'cool_file': ('whazzap', 0755), # executable 'subdir': { 'crazy times': ('this is awesome', 0644) }, 'nested': { 'nested_file': 'one thing', 'nested_carry': 'can\'t touch this', }, 'carry_over': 'this is the same before and after', } ref.make_commit('Initial Commit', spec) c = ref.make_commit('Differential Commit', { 'cool_file': None, 'subdir': 'now its a file', 'nested': { 'nested_file': 'other thing' }, 'other_dir': { 'neat-o': 'it\'s a neat file!' }, }) self.assertEquals(r.spec_for(c), { 'subdir': ('now its a file', 0644), 'other_dir': { 'neat-o': ('it\'s a neat file!', 0644) }, 'nested': { 'nested_file': ('other thing', 0644), 'nested_carry': ('can\'t touch this', 0644) }, 'carry_over': ('this is the same before and after', 0644), })