예제 #1
0
    def setUp(self):
        super().setUp()
        self.working_tree = 'hg-test'
        self.source_dir = 'hg-checkout'
        self.clean_dir(self.working_tree)
        self.clean_dir(self.source_dir)
        os.chdir(self.working_tree)
        call(['hg', 'init'])
        with open('testing', 'w') as fp:
            fp.write('testing')
        call(['hg', 'add', 'testing'])
        call(['hg', 'commit', '-m', 'testing', '-u',
              'Test User <*****@*****.**>'])
        call(['hg', 'tag', '-u', 'test', 'test-tag'])
        self.expected_commit = call_with_output(['hg', 'id']).split()[0]
        self.expected_branch = call_with_output(['hg', 'branch'])
        self.expected_tag = 'test-tag'

        os.chdir('..')

        self.hg = sources.Mercurial(self.working_tree, self.source_dir,
                                    silent=True)
        self.hg.pull()

        self.source_details = self.hg._get_source_details()
예제 #2
0
    def setUp(self):
        super().setUp()
        name = 'git-source'  # must match what the tests expect

        def _add_and_commit_file(path, filename, contents=None, message=None):
            if not contents:
                contents = filename
            if not message:
                message = filename

            with open(os.path.join(path, filename), 'w') as fp:
                fp.write(contents)

            call(['git', '-C', name, 'add', filename])
            call(['git', '-C', name, 'commit', '-am', message])

        os.makedirs(name)
        call(['git', '-C', name, 'init'])
        call(['git', '-C', name, 'config',
              'user.name', 'Test User'])
        call(['git', '-C', name, 'config',
              'user.email', '*****@*****.**'])

        _add_and_commit_file(name, 'testing')
        call(['git', '-C', name, 'branch', 'test-branch'])

        _add_and_commit_file(name, 'testing-2')
        call(['git', '-C', name, 'tag', 'feature-tag'])

        _add_and_commit_file(name, 'testing-3')

        self.commit = call_with_output(
            ['git', '-C', name, 'rev-parse', 'HEAD'])
예제 #3
0
    def setUp(self):
        super().setUp()

        with return_to_cwd():
            os.makedirs(self.name)
            os.chdir(self.name)
            call(['hg', 'init'])
            with open('testing', 'w') as fp:
                fp.write('testing')

            call(['hg', 'add', 'testing'])
            call(['hg', 'commit', '-m', 'testing',
                  '-u', 'Test User <*****@*****.**>'])
            call(['hg', 'tag', 'feature-tag',
                  '-u', 'Test User <*****@*****.**>'])
            revno = call_with_output(['hg', 'id']).split()[0]

            self.commit = revno
예제 #4
0
    def setUp(self):
        def _add_and_commit_file(filename, content=None, message=None):
            if not content:
                content = filename
            if not message:
                message = filename

            with open(filename, 'w') as fp:
                fp.write(content)
            call(['git', 'add', filename])
            call(['git', 'commit', '-am', message])

        super().setUp()
        self.working_tree = 'git-test'
        self.source_dir = 'git-checkout'
        self.clean_dir(self.working_tree)
        os.chdir(self.working_tree)
        call(['git', 'init'])
        call(['git', 'config', 'user.name',
              '"Example Dev"'])
        call(['git', 'config', 'user.email',
              '*****@*****.**'])
        _add_and_commit_file('testing')
        self.expected_commit = call_with_output(
            ['git', 'rev-parse', 'HEAD'])

        _add_and_commit_file('testing-2')
        call(['git', 'tag', 'test-tag'])
        self.expected_tag = 'test-tag'

        _add_and_commit_file('testing-3')
        self.expected_branch = 'test-branch'
        call(['git', 'branch', self.expected_branch])

        os.chdir('..')

        self.git = sources.Git(self.working_tree, self.source_dir, silent=True,
                               source_commit=self.expected_commit)
        self.git.pull()

        self.source_details = self.git._get_source_details()
예제 #5
0
    def setUp(self):
        super().setUp()

        bzr_home = self.useFixture(fixtures.TempDir()).path
        self.useFixture(fixtures.EnvironmentVariable('BZR_HOME', bzr_home))
        self.useFixture(fixtures.EnvironmentVariable(
            'BZR_EMAIL',  'Test User <*****@*****.**>'))

        with return_to_cwd():
            os.makedirs(self.name)
            os.chdir(self.name)
            call(['bzr', 'init'])
            with open('testing', 'w') as fp:
                fp.write('testing')

            call(['bzr', 'add', 'testing'])
            call(['bzr', 'commit', '-m', 'testing'])
            call(['bzr', 'tag', 'feature-tag'])
            revno = call_with_output(['bzr', 'revno'])

            self.commit = revno
예제 #6
0
 def get_id(self):
     return subprocess_utils.call_with_output(['hg', 'id']).split()[0]
예제 #7
0
 def get_revno(self):
     return subprocess_utils.call_with_output(
         ['git', 'rev-list', 'HEAD', '--max-count=1'])
예제 #8
0
 def get_id(self):
     return subprocess_utils.call_with_output(['hg', 'id']).split()[0]
예제 #9
0
 def get_revno(self):
     return subprocess_utils.call_with_output(
         ['git', 'rev-list', 'HEAD', '--max-count=1'])