Beispiel #1
0
    def _proc(self):
        try:
            return self._real_proc
        except AttributeError:
            from .helper import GitHgHelper, NoHelperException
            # Ensure the helper is there.
            if GitHgHelper._helper is GitHgHelper:
                GitHgHelper._helper = False
            try:
                with GitHgHelper.query('feature', 'force'):
                    pass
                self._real_proc = GitHgHelper._helper
            except NoHelperException:
                self._real_proc = GitProcess(
                    'fast-import', '--quiet', stdin=subprocess.PIPE,
                    config={'core.ignorecase': 'false'})
            self.write(
                "feature force\n"
                "feature ls\n"
                "feature notes\n"
            )
            if self._done:
                self.write('feature done\n')

            return self._real_proc
Beispiel #2
0
    def _proc(self):
        if self._real_proc is None:
            from .helper import GitHgHelper
            # Ensure the helper is there.
            if GitHgHelper._helper is GitHgHelper:
                GitHgHelper._helper = False
            with GitHgHelper.query('feature', 'force'):
                pass
            self._real_proc = GitHgHelper._helper

            atexit.register(self.close, rollback=True)

        return self._real_proc
Beispiel #3
0
    def _proc(self):
        try:
            return self._real_proc
        except AttributeError:
            from .helper import GitHgHelper
            # Ensure the helper is there.
            if GitHgHelper._helper is GitHgHelper:
                GitHgHelper._helper = False
            with GitHgHelper.query('feature', 'force'):
                pass
            self._real_proc = GitHgHelper._helper
            self.write("feature force\n" "feature ls\n" "feature notes\n")
            if self._done:
                self.write('feature done\n')

            return self._real_proc
Beispiel #4
0
    def ls_tree(self, treeish, path='', recursive=False):
        from githg import GitHgHelper
        if treeish.startswith('refs/'):
            treeish = self.resolve_ref(treeish)

        if path.endswith('/') or recursive or path == '':
            path = path.rstrip('/')
            for line in GitHgHelper.ls_tree('%s:%s' % (treeish, path),
                                            recursive):
                mode, typ, sha1, p = line
                if path:
                    yield mode, typ, sha1, posixpath.join(path, p)
                else:
                    yield mode, typ, sha1, p
        else:
            # self._fast_import might not be initialized, so use the ls command
            # through the helper instead.
            with GitHgHelper.query('ls', treeish, path) as stdout:
                line = stdout.readline()
                if not line.startswith('missing '):
                    yield split_ls_tree(line[:-1])