How to use the ghstack.diff.RE_PULL_REQUEST_RESOLVED_W_SP.sub function in ghstack

To help you get started, we’ve selected a few ghstack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ezyang / ghstack / ghstack / View on Github external
for s in stack:
        commit_id = s.commit_id()
        should_unlink = parsed_commits is None or commit_id in parsed_commits
        if not rewriting and not should_unlink:
            # Advance HEAD without reconstructing commit
            head = commit_id

        rewriting = True
        commit_msg = s.commit_msg()
        logging.debug("-- commit_msg:\n{}".format(textwrap.indent(commit_msg, '   ')))
        if should_unlink:
            commit_msg = RE_GHSTACK_SOURCE_ID.sub(
                ghstack.diff.RE_PULL_REQUEST_RESOLVED_W_SP.sub('', commit_msg)
            logging.debug("-- edited commit_msg:\n{}".format(
                textwrap.indent(commit_msg, '   ')))
        head = GitCommitHash(sh.git(
            "-p", head,

    sh.git('reset', '--soft', head)"""
Diffs successfully unlinked!

To undo this operation, run:
github ezyang / ghstack / ghstack / View on Github external
if old_pr_body is not None:
            # Look for tags we should preserve, and keep them
            m =
            if m:
                extra = (
                    "\n\nDifferential Revision: "
        commit_body = ''.join(commit.summary.splitlines(True)[1:]).lstrip()
        # Don't store ghstack-source-id in the PR body; it will become
        # stale quickly
        commit_body = RE_GHSTACK_SOURCE_ID.sub('', commit_body)
        # Don't store Pull request resolved in the PR body; it's
        # unnecessary
        commit_body = ghstack.diff.RE_PULL_REQUEST_RESOLVED_W_SP.sub('', commit_body)
        pr_body = (
            "{}:\n* (to be filled)\n\n{}{}"
        return title, pr_body