Beispiel #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()
Beispiel #2
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()
Beispiel #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
Beispiel #4
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'])
Beispiel #5
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"])
Beispiel #6
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"])
Beispiel #7
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
Beispiel #8
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()
Beispiel #9
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
Beispiel #10
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()
Beispiel #11
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()
Beispiel #12
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
Beispiel #13
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
Beispiel #14
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
Beispiel #15
0
 def get_id(self):
     return subprocess_utils.call_with_output(["hg", "id"]).split()[0]
Beispiel #16
0
 def get_revno(self):
     return subprocess_utils.call_with_output(
         ["git", "rev-list", "HEAD", "--max-count=1"])
Beispiel #17
0
 def get_id(self):
     return subprocess_utils.call_with_output(['hg', 'id']).split()[0]
Beispiel #18
0
 def get_revno(self):
     return subprocess_utils.call_with_output(
         ['git', 'rev-list', 'HEAD', '--max-count=1'])
Beispiel #19
0
 def get_revno(self):
     return subprocess_utils.call_with_output(
         ["git", "rev-list", "HEAD", "--max-count=1"]
     )
Beispiel #20
0
 def get_id(self):
     return subprocess_utils.call_with_output(["hg", "id"]).split()[0]