Skip to content

Add sync command, CLI entry point, and test infrastructure#333

Merged
ezyang merged 2 commits intomasterfrom
gh/ezyang/46/head
May 9, 2026
Merged

Add sync command, CLI entry point, and test infrastructure#333
ezyang merged 2 commits intomasterfrom
gh/ezyang/46/head

Conversation

@ezyang
Copy link
Copy Markdown
Owner

@ezyang ezyang commented May 9, 2026

Summary:

  • Add ghstack sync command that syncs PR descriptions from GitHub back to local commit messages
  • Add CLI entry point (src/ghstack/cli.py) with click-based commands for all ghstack operations
  • Add pytest infrastructure (conftest.py) to run .py.test files as tests
  • Add test prelude (src/ghstack/test_prelude.py) with helpers for writing integration tests
  • Add basic sync test (test/sync/basic.py.test) verifying PR description sync functionality

The sync command fetches PR titles and bodies from GitHub and updates the corresponding local commit messages, stripping the stack list from the body while preserving trailers like ghstack-source-id and Pull-Request.

Test Plan:

  • New test file test/sync/basic.py.test verifies the sync functionality works correctly
  • Test covers both direct and non-direct modes
  • Verifies PR titles update commit subjects
  • Verifies PR bodies update commit bodies
  • Verifies stack lists are stripped from commit messages
  • Verifies trailers are preserved

[ghstack-poisoned]
@ezyang
Copy link
Copy Markdown
Owner Author

ezyang commented May 9, 2026

Stack from ghstack (oldest at bottom):

[ghstack-poisoned]
ezyang added a commit that referenced this pull request May 9, 2026
Summary:
- Add `ghstack sync` command that syncs PR descriptions from GitHub back to local commit messages
- Add CLI entry point (`src/ghstack/cli.py`) with click-based commands for all ghstack operations
- Add pytest infrastructure (`conftest.py`) to run `.py.test` files as tests
- Add test prelude (`src/ghstack/test_prelude.py`) with helpers for writing integration tests
- Add basic sync test (`test/sync/basic.py.test`) verifying PR description sync functionality

The sync command fetches PR titles and bodies from GitHub and updates the corresponding local commit messages, stripping the stack list from the body while preserving trailers like ghstack-source-id and Pull-Request.

Test Plan:
- New test file `test/sync/basic.py.test` verifies the sync functionality works correctly
- Test covers both direct and non-direct modes
- Verifies PR titles update commit subjects
- Verifies PR bodies update commit bodies
- Verifies stack lists are stripped from commit messages
- Verifies trailers are preserved

ghstack-source-id: 02111a1
ghstack-comment-id: 4413312087
Pull-Request: #333
@ezyang ezyang enabled auto-merge (squash) May 9, 2026 18:25
@ezyang ezyang merged commit 8b26cae into master May 9, 2026
32 checks passed
@ezyang ezyang deleted the gh/ezyang/46/head branch May 9, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant