Blue text in alternating rows was hard to see on dark terminal backgrounds.
Changed alternating row colors from blue/yellow to white/yellow for better visibility on dark terminals.
- Blue text (hard to see on dark backgrounds)
- Yellow text
- White text (clearly visible)
- Yellow text
Added ability to open PR diffs in Meld tool for better visual comparison.
# Open diff in Meld
bitbucket pr -d <pr_num> --meld
# With URL
bitbucket pr -u "https://bitbucket.org/workspace/repo/pull-requests/123" -d --meld- Fetches the diff from Bitbucket API
- Parses the unified diff format
- Creates temporary files for "before" and "after" versions
- Opens each changed file in Meld for side-by-side comparison
- Temporary files are stored in
/tmp/bitbucket-pr-{pr_number}/
Meld must be installed on your system:
macOS:
brew install meldLinux:
# Ubuntu/Debian
sudo apt install meld
# Fedora/RHEL
sudo dnf install meld- Visual Comparison: Side-by-side view of changes
- Syntax Highlighting: Better code readability
- Navigation: Easy navigation between changes
- Merge Tool: Use Meld's powerful merge capabilities
- Better for Large Diffs: Easier to understand complex changes
Quick Review with Meld:
cd /tmp
bitbucket pr -u "https://bitbucket.org/your-workspace/your-repo/pull-requests/244" -d --meldCompare Multiple Files: For PRs with multiple file changes, Meld will open a separate window for each file.
Fallback Behavior: If Meld is not installed or encounters an error, the command will fall back to displaying the diff in the terminal.
# 1. Check what files changed
bitbucket pr -u "https://..." --diffstat
# 2. If changes look interesting, open in Meld
bitbucket pr -u "https://..." -d --meld# Get stats AND open in Meld
PR_URL="https://bitbucket.org/your-workspace/your-repo/pull-requests/244"
echo "=== Checking Statistics ==="
bitbucket pr -u "$PR_URL" --diffstat
echo -e "\n=== Opening in Meld ==="
bitbucket pr -u "$PR_URL" -d --meld-
lib/bitbucket/pr.js- Changed diffstat colors from
blue/yellowtowhite/yellow - Added
parseDiffToFiles()function to parse unified diffs - Updated
diff()function to support--meldflag - Added file creation and Meld launching logic
- Changed diffstat colors from
-
bin/bitbucket.js- Added
--meldcommand-line option
- Added
The tool parses unified diff format and extracts:
- File names
- Before content (lines starting with
-) - After content (lines starting with
+) - Context lines (lines starting with space)
Files are created in /tmp/bitbucket-pr-{pr_number}/ with naming:
before_{filename}- Original versionafter_{filename}- Modified version
Example:
/tmp/bitbucket-pr-244/
├── before_api_cancel.js
└── after_api_cancel.js
# Now shows white/yellow instead of blue/yellow
bitbucket pr --diffstat 244
bitbucket pr -u "https://..." --diffstat# Traditional method
bitbucket pr -d 244 --meld
# URL method (works from anywhere!)
bitbucket pr -u "https://bitbucket.org/team/repo/pull-requests/123" -d --meldbitbucket pr --help
# Look for:
# -d, --diff [pr_num] Diff Pull Request (optional with -u)
# --meld Open diff in Meld tool (use with -d or --diff)Install Meld:
# macOS
brew install meld
# Linux
sudo apt install meld # Ubuntu/DebianTry adjusting your terminal theme or colors:
- Use a dark theme with good contrast
- Adjust terminal color settings
- Try a different terminal emulator
Check if Meld is in your PATH:
which meldIf not found, you may need to create a symlink or add it to PATH.
This is expected behavior for PRs with multiple files. Each file gets its own Meld window for comparison.
Potential future improvements:
- Support for other diff tools (Beyond Compare, KDiff3, etc.)
- Configurable diff tool preference
- Option to open all files in one Meld window (directory comparison)
- Cleanup temporary files automatically
- Color scheme customization for diffstat