Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multiple diff opt args #188

Closed

Conversation

svenwest
Copy link
Contributor

  • feat: Add split command that spills current revision into worktree and empties its patch
  • CI workflow updates
  • Update black target-version to py35
  • Use python3 in Makefiles and shebangs
  • Minor cleanups for refresh --spill
  • Remove inheritance from object
  • Windows: Pass environment variables to Popen as dict of strings
  • test(branch --rename): Clean up and add tests to cover issue stg branch --rename forgets to update refs for hidden patches #68
  • Add quoting in t1001-branch-rename.sh
  • stgbashprompt should not be executable
  • Minor improvements to contrib scripts
  • Remove various old contrib scripts
  • Remove publish command
  • Update TODO file
  • Changelog updates
  • bug(stg pull on a branch without upstream set is causing an Exception #83): fix stg pull when no upstream is configured
  • Improve pull without tracking
  • bug(stg refresh errors out when index contains added files and path limiting is given #85): fix refresh crashes when index contains added files and path limiting
  • Improved variable naming for refresh
  • config: Add series.description
  • stg series: add --no-description flag
  • Add series --no-description option to stgit.zsh
  • Changelog updates
  • Repair new with patchdescr.template (Existance of patchdescr.tmpl causes TypeError #87)
  • Use isort diagnostic with --diff option
  • Use get_object() in rev_parse()
  • Better stack rename abstraction
  • Move log deletion/clear to Stack
  • Teach Stack to clone itself
  • Stack state initialization message improvements
  • Stack "state" naming
  • Refactor StackState._parents
  • Refactor StackState metadata generation
  • Repair stg log with patches from subdir
  • Ensure newline at end of meta file
  • Add Python 3.9 classifier to setup.py
  • Use super() where applicable
  • Stack metadata version 4
  • Use reStructuredText-style docstrings
  • Split tests for import
  • Various control-flow cleanups to imprt.py
  • Avoid importing invalid and duplicate patch names
  • Use Patches.make_name() in various commands
  • Strip comments from trailers for stg mail --auto
  • Add test for importing patch with ".." in name
  • Add StGit release checklist
  • Update changelog for 1.0
  • Rename import quilt series test script
  • Use tempfile.TemporaryDirectory in imprt.py
  • Allow importing mail and series from urls (RFE: "stg import -u" should also handle mbox format #94)
  • Fix typos in release README
  • wip-changelog
  • Repair potential hang in DiffTreeProcess
  • refresh: Support --diff with --edit
  • Add --diff-opts option to refresh
  • Various StackState improvements
  • Remove message attribute from StackState
  • Add support for core.hooksPath
  • Add test
  • Quote HOOKDIR in t2703-refresh-pre-commit-hook.sh
  • Configure init.defaultBranch in test repos
  • Use PyPy 3.7 in CI
  • Remove unused argument from mergetool()
  • Modify test refresh submodules from non-root dir
  • Improved Index and TemporaryIndex initialization
  • Add Worktree.default() method
  • Absolute Worktree.directory
  • Allow goto-ing a sha1 hash (Feature request: Can a parameter be given to "stg goto" so that it can go to a commit ID rather than a patch name #93)
  • Patches delete(), update(), and rename()
  • Use Patches instead of Patch everywhere
  • Remove Patch class
  • Rename _patch_ref_prefix() and _patch_ref()
  • Remove Stack.head_top_equal()
  • Sign commits when the `commit.gpgsign' git option is set to true
  • Update the test-suite with GPG-related entries
  • Supplement GPG tests
  • Add -C option to stg import and stg fold
  • mail: use the whole series when generating the diffstat
  • tests: add %(diffstat)s test for mails with cover letter
  • Add zsh completions for -C for import and fold
  • Update MANIFEST.in with AUTHORS.md and README.md
  • Update release instructions to use signed tags
  • Update changelog for v1.1 release
  • Use PEP 440 local version formant for git hash
  • Repair crash when attempting to export empty patch
  • Accommodate ref names with non-breaking spaces
  • Exact command name matches are unambiguous
  • Rearchitect squash edit message to include all commits.
  • Reorder squash message to ease readibility.
  • Include 'name' in squash's edit message.
  • Ensure a newline after each commit in 'stg squash'.
  • Use 'rstrip' over 'strip'; remove TODO
  • Add --interactive option to rebase
  • Add --verbose option to 'stg new'
  • Empty 'squash' commit message aborts the squash.
  • Update squash instructions to include empty messages.
  • Normalize StGit and Git spellings
  • Resolve 'flake8' errors.
  • Add dev-env target to Makefile
  • Re-architect 'rebase --interactive' to remove special 'squash' logic.
  • Add --autostash to 'stg rebase'
  • Update t/README to reflect STG test config names.
  • Fix 'prove' error with bang line.
  • Add .cov-files to .gitignore.
  • Add tests to exercise missing coverage in 'stg edit'.
  • Add 'edit' instruction to 'rebase --interactive'.
  • Use correct 'diff' command in 'stg new'.
  • Tell 'coverage' that our loops have exits.
  • Edit gains the power to rename the patch.
  • Update stgedit.vim for Patch header
  • Portable printf in t2203-rebase-interactive.sh
  • Python3 configparser
  • Repair isort issue in main.py
  • Test for goto non-existant commit hash
  • Test invalid number of redos
  • Allow mail template to be empty
  • No covererage for Person.repr()
  • Trivial coverage improvement in export.py
  • Add link to coverage.io to CONTRIBUTING.md
  • Add coverage settings to ignore debug code.
  • new: commit.verbose is a boolean
  • Remove unneeded '# pragma: no cover' lines.
  • 'stg edit' aborts on empty patch description; add instructions.
  • completion: Add --no-description for stg series
  • Add test case for stg new without --verbose.
  • Fix off-by-one-error for 'stg rebase -i delete'
  • Improve while loop in __do_rebase_interactive
  • 'stg rebase --interactive' learns 'fixup' instruction
  • Update changelog since v1.1 release
  • More changelog updates
  • Workaround child process reaping race on Windows
  • Do not close stdin before killing child bg process
  • Run.run_background() returns subprocess.Popen
  • Repair Run.run_background()
  • Renumber some pull/pop test scripts to make room
  • Normalize float tests' whitespace
  • Improve performance of t1500-float.sh
  • Refactor various commands' options declarations
  • Repair error handling of float --series
  • Add float --noapply
  • Add push --noapply
  • Correct verbiage for float --noapply help str
  • More changelog updates
  • Various improvements to setup.py
  • Find viable bash.exe for running hooks on Windows
  • Enable python -m stgit
  • Use setuptools instead of distutils for packaging
  • No git or python version checks in setup.py
  • Use different dynamic version system
  • Install stg executable using entrypoint mechanism
  • Add script to help test StGit packaging
  • Repair lint issue in setup.py
  • Yet another lint repair
  • Add docs deps to coverage CI job
  • Repair import sort in pkgtest.py
  • Repair zsh completion for stg float
  • Update changelog
  • Use include_package_data in setup.py
  • More robust setup.py code generation
  • Do not use data_files in setup.py
  • Repair unused import in setup.py
  • Use README.md in setup.py long_description
  • Improve checks for refresh --spill opts
  • Add tests for invalid stg edit arguments
  • CI: do apt-get update before install
  • Add tests for editing diffs
  • Correct outcome for bad diff edit with stg edit -d
  • Add tests for stg edit with binary diffs
  • Do not show binary diffs when editing patch
  • Add v1.1 and v1.0 to upgrade test suite
  • Minor cleanups to stackupgrade
  • Cleanup .gitignore
  • Repair black exclude for build directory
  • Move tests for editing trailers to new script
  • Allow adding multiple trailers at once
  • Add --sign-by, --ack-by, and --review-by
  • Zsh completion for stg rebase new-base-id
  • Zsh patches completions comprehend --branch
  • Repair zsh completion for changed files
  • stg import now extracts Message-ID header
  • Improve test coverage for stg pull
  • Zsh completion learns stg new --verbose
  • Zsh completions guard patch names
  • Do not include binary diffs with stg new -v
  • Stack metadata version 5
  • Load stack.json as str instead of bytes for Py3.5
  • Repair stg-edit man page formatting
  • Repair pkgtest.py and _version.py for tags
  • Add stgit.new.verbose config option
  • Update changelog for v1.2
  • Repair regression with stgit.autosign
  • Update changelog for v1.3
  • Repair stack upgrade with stg branch --list
  • Repair stack upgrade with stg branch --list
  • Reorder and reduce squash() arguments
  • Use test_commit_bulk in t2600-squash.sh
  • Enhance squash --save-template test
  • Add tests for out-of-order squashes
  • Repair crash in stg squash (stg squash fails #157)
  • Ensure coveralls uses coverage[toml]
  • Zsh completions learn stg float --noapply
  • Add Python 3.10 to CI
  • Reorder CI jobs
  • Add stg import --message-id option
  • Add Python 3.10 classifier
  • Output simplified Python version
  • Add post-v1.3 changelog entries
  • Update t0004-main.sh for updated Python version
  • Zsh complete multiple patches for stg sink
  • Better programmatic use of main()
  • Trivial line break change for edit instructions
  • Update tests for updated git pull semantics
  • Disallow committing empty patches by default
  • Repair formatting issues in commit.py
  • Update changelog for recent commits
  • Zsh completion learns stg commit --allow-empty
  • Update changelog for v1.4
  • Remove no-op line from new.py
  • Replace StackTransaction._abort() with exception
  • Remove StackTransaction.abort()
  • Provide transaction message to trans.run()
  • StackTransaction._checkout requires non-None iw
  • Rename StackTransaction _bad_head to _updated_head
  • Reorganize StackTransaction properties
  • Make all StackTransaction arguments required
  • Check bad head and clean iw before StackTransaction
  • Rename StackTransaction.execute()
  • 'stg rebase --interactive' learns 'hide' instruction
  • Change os.system() call to avoid invoking 'python'
  • Use bulk commit in t1302-repair-interop.sh
  • Normalize formatting of t1200-push-modified.sh.
  • Add t1306-repair-patchrefs.sh
  • Repair stg repair with amended first patch
  • Add target install-completion into Makefile
  • Add targets to install zsh and fish completions
  • Repair patch state blob reuse
  • Unroll bad head check in StackTransaction._checkout()
  • stack: strip trailing dots from short_name
  • Test for generated patchname with trailing period
  • Restore stg sink --nopush capability
  • Merge upstream git test library
  • Tests redirect to err file when grepping stderr
  • More robust checks in t2300-refresh-subdir.sh
  • Minor updates to refresh.py code style
  • Update float and push --noapply help
  • Add missing push --noapply option to zsh completions
  • Zsh complete all patches for stg refresh -p
  • Repair t3300-edit.sh
  • Trigger CI for pushes to all branches
  • Pick --noapply does not reverse patches
  • Preserve picked patch name when possible
  • Improve patch name generation
  • Replace isascii() call for compat with Python <3.7
  • Repair broken reference in mail.py
  • Add python3.10 to pkgtest.py
  • Update changelog for v1.5
  • Test push/pop of patch that removes curdir
  • Drop explicity support for PyPy
  • Begin rust reimplementation of StGit
  • Use clap for command line argument parsing
  • Use git2 crate
  • Implement stg series
  • Implement stg init
  • Improve errors
  • Add patchname module
  • Specific Error::NonUtf8BranchName error
  • Colorized error messages
  • Update to clap 3.0.0-beta.5
  • Nascent patch description editing abstractions
  • Use tempfile crate
  • Updated transient dependencies
  • More work on new
  • Satisfy clippy
  • Better error checking in stack.json deserialize
  • Separate Stack and StackState structs
  • Beginnings of stack transactions
  • Update transient dependencies
  • Transaction is baked enough for stg new to work
  • Select debug/release with STG_RUST for testing
  • Default signatures without config
  • Use exit code 2 for all handled errors
  • Create stack module for stack code
  • Handle python main returning None
  • Proper implementation for stg id
  • Update t0004-main.sh tests for rust version
  • Repair is_head_top()
  • Improve stg new to pass more tests
  • Move transaction.rs to stack module
  • Command mapping with get_commands()
  • Command aliases
  • Update dependencies
  • Repair Display for PatchName
  • Low-overhead command line processing in main()
  • Compatible return codes
  • Implement stg top
  • Silence some dead code warnings
  • Many clippy repairs
  • Implement stg prev
  • Various repairs to stg series
  • Implement patch ranges for stg series
  • Repair log tests and implement stgit.autosign
  • Repair base id for stg id
  • Implement stg next
  • Allow non-breaking spaces in patch names
  • Update test for stg status alias
  • Repair commit hook
  • Update dependencies
  • Improved App setup in main()
  • Make AllPatches iterater usable for transaction
  • Add wrapped Signature and Repository structs
  • Ensure correct patch refs when stack is constructed
  • Learn author.name/email and committer.name/email
  • Move CommitData to wrap module
  • Comprehend unborn branches
  • Don't use wrapped Repository or Signature
  • StackTransaction owns Stack
  • Use Oids instead of Commits for parents
  • CommitData use Oids
  • Use indexmap::IndexSet for parent computations
  • New stack::serde module
  • Two-level stack state deserialization
  • Simplify state state by using tree id
  • Add base commit to Stack
  • StackTransaction use Commits instead of Oids
  • Remove Stack.head_tree
  • Repair index/worktree dirty checks
  • Stack head and base naming
  • Move StackTransaction struct up in file
  • Add Stack.transaction() function
  • StackTransaction.checkout() sets current_tree_id
  • Update to clap-3.0.0
  • Custom Debug for PatchName
  • Repair StackTransaction.base()
  • Repair patch state blobs
  • Cleanup reuse of prev patch state blobs
  • Implement stg push
  • Implement stg pop
  • Implement push --noapply
  • Add use_index_and_worktree flag for transactions
  • Implement stg goto
  • Make --color global to all subcommands
  • Move user-facing push/pop output to StackTransaction
  • Implement stg sink
  • Implement stg float
  • Improve patch range errors
  • Derive Debug for PatchDescriptor
  • Implement stg delete
  • Implement stg rename
  • Implement stg hide
  • Add long about for stg id
  • Allow hyphen values for --diff-opt arg
  • Implement stg show
  • Do not change to workdir when executing aliases
  • Repair signatures in patch descriptions
  • Move OsStrExt to narrower scope
  • Move with_temp_index() helper
  • Use impl IntoIterator for commit_ex() parents
  • Repair find() in patchdescription.rs
  • Eliminate wrap module
  • Use --diff opt in stg new
  • Improved trailer options
  • Add CommitExtended extension trait
  • Add TimeExtended extension trait for git2::Time
  • TemporaryIndex extension trait for git2::Repository
  • PatchDescription message becomes non-Option
  • Add StackStateAccess trait
  • Punt to python with python instead of pyo3
  • Disable git2 default features
  • Update to clap 3.0.10
  • Signify patch deletion with '#'
  • Stack no longer keeps a git2::Reference
  • Update stack's branch ref and head after execute
  • Add StackTransaction.push_patches()
  • Make StackTransaction.rename_patch() idempotent
  • Normalized patch edit command line options
  • New stupid module for invoking git
  • Add file-based temp index to TemporaryIndex trait
  • Push patches using git executable
  • Add pre-commit hook infrastructure
  • Improve hooks, eliminate CommitData
  • Implement stg refresh
  • Rename PatchDescriptor to PatchState
  • Use TimeExtended trait in State
  • Use 'patchname' naming consistently
  • Implement stg spill
  • Decompose refresh implementation
  • Add --refresh option to stg new
  • Update Zsh completions for refresh and new
  • Update Zsh completions for show
  • Add Zsh completions for spill
  • Zsh completion for id --branch
  • Update Zsh completion of aliases
  • Update Zsh completions to comprehend --color
  • Print "(new)" patch status for new patches
  • Pushed patch status "modified" for complex merges
  • Pushing patch halts on write tree errors
  • Update function definition order in transaction.rs
  • Rename StackTransaction.push_new from push_applied
  • Use stupid to check for merged patches
  • Repair push conflict detection
  • Rename Overlay from PatchEditOverlay
  • Add DiffBuffer to PatchDescription
  • Create patchedit module
  • Overhaul patchedit
  • stupid commands can write ref to stdin
  • Implement stg edit
  • Patchedit allow implicit edit
  • Update tests for new stg edit
  • Add encoding_rs dependency
  • Add CommitMessage enum
  • Print updated patch indication when refreshing
  • Repair notes copy during transaction
  • Patchedit comprehend '-' for stdin/stdout
  • Abort patchedit if all parsed fields are absent
  • Robust date/time parsing
  • Respect order of edit trailer options
  • Combine use items in patchedit
  • PatchDescription instruction and diff_instruction
  • Repair default stgit.namelength
  • Update PatchName::make()
  • Transaction builder
  • Eliminate TransactionContext
  • Provide stdout to TransactionBuilder
  • Avoid trivial merges during push
  • Repair pushing already merged parent
  • Ensure transaction indicates top patch
  • Transaction print deleted patch groups
  • Push patches with temp index reuse
  • Integrate transaction check merge with push
  • Reuse temp index for merge checks
  • Lexically order stupid functions
  • Add rudimentary doc strings to stupid
  • Add SignatureExtended trait
  • Rename RepositoryCommitExtended from CommitExtended
  • Strict author and committer from git2::Commit
  • Add commit_with_options() extension method
  • Add stgit.gpgsign configuration option
  • Rename --sign to --signoff
  • Update clap to 3.0.13
  • Implement stg clean
  • Implement stg diff
  • Use Stack.branch_head() where required
  • Implement stg commit
  • Repair glob over stgit.alias
  • Use anyhow for errors
  • Add helper function for patchname errors
  • Respect --color option for diff and show
  • Implement stg patches
  • Use bstr for converting signatures to OsStr
  • Repair stg edit -d
  • Implement stg files
  • Implement stg uncommit
  • Print merge conflicts for appropriate errors
  • Ensure "merged" when pushing already merged patches
  • Implement stack upgrade
  • Update to clap 3.1
  • Use git2 in instead of git in a couple places
  • Use exclude closure instead of slice for get_aliases
  • Implement stg export
  • Implement stg import
  • Add StupidContext for running stupid commands
  • Implement stg reset
  • Implement stg undo and stg redo
  • Implement stg fold
  • Update dependencies
  • Implement stg log
  • Extend git2::Repository
  • Warning and info message printing
  • parse_stgit_revision returns Object instead of Oid
  • Implement stg branch
  • Use color in stg log output
  • Broken pipe error message for stg log
  • Implement stg repair
  • Implement stg pick
  • Implement stg sync
  • Rename StackTransaction.push_new() to new_applied()
  • Add documentation for stack::transaction
  • Add documentation for remaining stack::* modules
  • Add documentation for alias module
  • Add/improve documentation to main module
  • Error printing respects --color, when possible
  • Add tests for color related behaviors
  • Various cleanups to main
  • Update dependencies
  • Add doc strings to subcommand modules
  • Add documentation to patchedit module
  • Add documentation to argset module
  • Add documentation to commit module
  • Add documentation to hook module
  • Yet more documentation for various modules
  • Remove unused code from signature module
  • Use parse_stgit_revision for edit's --set-tree
  • Distinct conflict and repo state checks
  • Repair spill to be robust against path conflicts
  • Remove stg clone command
  • Implement stg squash
  • Implement stg pull
  • Distinguish editable and edited patch descriptions
  • Implement stg rebase
  • Add CommitExtended::is_no_change() helper method
  • Fix conflict detection at transaction execute time
  • Use anyhow for active repository state errors
  • Use anyhow instead of TransactionAborted error
  • Rename FoldConflicts to CausedConflicts
  • Normalize error messages to start with uppercase
  • Repair handling 'prev: "None"' in stack.json
  • Repair stg series -s edge case
  • Use inlined named format parameters where possible
  • Add import-compressed and import-url features
  • Remove stg mail
  • Use git read-tree for all transaction checkouts
  • More compatible patch range parsing
  • Normalize patch range args
  • Add patchrange::parse_single()
  • Zsh command and alias completions from stg -h
  • Repair zsh branch option detection
  • Test Rust implementation by default
  • Update README.md and INSTALL for Rust impl
  • Repair stg edit --set-tree to not run the editor
  • Repair hook use unix MetadataExt instead of linux
  • Update CI workflow for Rust implementation
  • Avoid case-insensitive patch name collisions
  • Update CI to build and test on MacOS
  • Repair clippy lint warning
  • Multiple diff-opts

jpgrayson added 30 commits May 12, 2022 17:32
Use STG_RUST=debug STG_RUST=release to execute tests with debug or
release builds, respectively.
The test suite does not set user.name and user.email, instead relying on
GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, etc. environment variables.

CheckedSignature is reworked to no longer rely on
Repository::signature(), which only knows how to derive a signature from
the user.name and user.email configuration. The env vars are consulted
first, and only when absent are user.name and user.email consulted.
This improves compatibility with the test suite, but may need to be
revisited.
The user-provided StGit revision is parsed

Add -b/--branch option for id. This is a new feature compared to the
Python version.

Another difference vs Python version: the provided revspec is not always
peeled to a commit object. This specifically affects the output of
annotated tags where, e.g. `stg id v1.3` shows the id of the commit the
tag points to where as `git rev-parse v1.3` shows the id of the tag
itself.
When no patches are applied, the head is the top, by definition.
- Use patchdesc.tmpl when user does not provide a message.
- Check for conflicts in index before starting transaction.
The cmd module now takes responsibility for collecting all the StGit
commands.

The new StGitCommand struct defines a common function call interface for
commands. Each command module defines a get_command() function that
returns its StGitCommand instance.

In main(), the clap::App can now be setup more generically, without
main() having to have knowledge of each individual command.
Aliases in the Rust version differ from aliases in the Python version
and now behave like Git aliases.

- Aliases for external commands must be prefixed with '!'. E.g.:

      git config stgit.alias.long-status '!git status --long'

  would enable:

      stg long-status

- Aliases for StGit commands are not prefixed. E.g.:

      git config stgit.alias.list 'series --short'

  would enable:

      stg list

Other details:

- Aliases that attempt to override any builtin command are ignored
- Added builtin aliases: add, mv, resolved, rm, status.
- Builtin aliases may be overridden or removed (by making empty).
- Recursive aliases are detected

Resolves stacked-git#97
cc, git2, libc, serde_json, syn
Forward fmt() to PatchName's inner String to allow format parameters to
be applied correctly. This specifically affected `stg series` where the
patch name sometimes needs to be displayed with a minimum width.
Minimize the overhead of running StGit subcommands by avoiding two
relatively heavy lifts unless needed:

1. Do not lookup aliases unless the user provides an unknown subcommand.
2. Do not construct clap::App instances for all subcommands; only
   construct the App for the user-specified subcommand unless the user
   provides an unknown subcommand.

The net of this is that in the happy path, where the user provides a
known stgit subcommand on the command line, main() will get right to
work on that subcommand without a bunch of unneeded overhead.
Use GENERAL_ERROR (1) and COMMAND_ERROR (2) constants to better match
the python implementation's return code strategy.

A remaining and intentional difference is that any error detected during
command line parsing is a GENERAL_ERROR whereas the Python
implementation would return COMMAND_ERROR for many classes of command
line problem, for example for option conflicts.
Also:
- make the -b/--branch argument available to multiple subcommands.
- make --color available too
These dead functions will be used later...
- Proper option conflicts with -a/--all
- Implement --showbranch
- Correct help for --showbranch
- Implement --missing
- Implement --short
- Update tests
The user may now specify the patch range(s) to be shown via patch range
arguments.

This implementation differs from the Python version in that the patch
ranges specified must be (a) in-order and (b) contiguous. The Python
version did not impose either of those constraints, which allowed for
some hilariously wrong/misleading outputs.

New tests are implemented.
The base is the first patch's *parent*.
This is done for compatibility with the Python version.
The new `stg status` alias behaves slightly differently w.r.t. the
Python version, but more aligned with `git status` in that submodule
paths are shown relative to the worktree root.
jpgrayson and others added 29 commits May 17, 2022 15:37
Instead of using a single PatchDesription structure to represent both the
outgoing/editable patch description and the incoming/user-edited
description, now use two different structures.

The specific motivation is to be able to distinguish the cases from the
user-edited patch description:

- "Patch:" header present with patch name value
- "Patch:" header present with empty patch name value
- "Patch:" header absent

When the "Patch:" header is absent, the patch name now reverts to the
original patch name, whereas when the "Patch:" header is present with an
empty value the patch name is generated from the message.

The driving assumption is that the "Patch:" header being entirely absent
indicates that the user is just writing a message and isn't trying to
rename or otherwise alter the patch name.

On the other hand, when "Patch: " is found with an empty value, the user
explicitly deleted the pre-filled patch name. This is interpreted as the
user desiring for the patch name to be regenerated from the message. If the
user had wanted to retain the original patch name, they would have simply
left the "Patch:" header and value unaltered.
Compat:

- For interactive rebase, the "squash" and "fixup" instructions may no
  longer be used with the first patch in the instructions list. The stated
  semantics of both squash and fixup is that they squash the labeled patch
  with the preceding patch, which is not possible/valid when there is no
  preceding patch.
This method tests whether a commit's tree is the same as its parent's tree,
which indicates no changes.
The repository state was being inspected instead of checking for conflicts
in the index.
The dedicated error was no longer necessary since this error now only
happens in the check_repository_state() method.
There is only one place this error happens, so don't need an explicit error
variant.
The FoldConflicts error variant was being used in several commands to
indicated that the StGit command caused conflicts; the new name better
reflects that.
This is consistent with clap's error message and the Python implementation,
where most error messages start with uppercase letters.
The string "None" may show up as a value for "prev" in stack.json if the
stack was upgraded by the Python implementation of StGit. This value is now
treated the same as `null` instead of attempting to parse it as an object
id.
If `stg series -s` was run with no applied patches and the number of
unapplied patches was less than stgit.shortnr, a panic would occur due to
indexing out-of-bounds of a patches vector.
These build-time features allow several dependencies that only relate to
`stg import` to be optional.

- import-compressed: bzip2, flate2, tar
- import-url: curl

Also remove "url" as a dependency, since it was unused.
This is the last command that relied on the Python implementation of StGit,
but it is not being implemented in Rust, at least for the time being.

The rationale is that it is not clear that `stg mail` provides sufficient
value versus running `git send-email`. Consider, for example:

    $ stg mail p0..p4

The alternative using git would be:

    $ git send-email $(stg id p0)..$(stg id p4)

Or:

    $ git send-email refs/patches/main/p0..refs/patches/main/p4

N.B. `git send-email` provides a very wide selection of options, both on
the command line and in the config, to fine-tune how emails are sent. `stg
mail` only offered a subset of those capabilities.

Perhaps the most obvious feature that `stg mail` had that `git send-email`
does not [quite] have is customizable patch templates. This feature,
however, may be more trouble than its worth since it allows patch emails to
deviate from git email standards. Note that git allows the branch
description to be used as the cover letter (i.e. with
--cover-from-description), so that seems like a viable replacement for `stg
mail`'s cover letter template.
The merge capability of `git read-tree -u -m` is needed more broadly than
previously thought. So when performing checkouts at stack transaction
execute time, use `git read-tree` instead of
git2::Repository.checkout_tree() for all cases except the trivial case when
discarding any outstanding work tree changes.

Also correct the error mapping so that any read-tree error is reported to
the user properly.
The Python implementation's parse_patches() function has the semantic where
open-ended patch ranges (i.e. "[patch]..") may be bounded to the last
applied patch when the beginning patch of the open-ended range is an
applied patch. That semantic is now implemented in the Rust version.

Also enhance patch range parsing to identify misspelled patch names and
report relevant similar patch names in user-facing error messages.
Various commands are updated to use the same internal and user-facing
conventions for patch ranges. Patch range arguments have a user-facing
value name of  "patch", which means usage strings show either "[patch]..."
or "<patch>...", depending on whether the argument is optional.

This user-facing naming deemphasizes the range capability, instead
emphasizing the simpler case of specifying individual patch name arguments.
Improved documentation is needed to allow users to discover the range
capability.

Also update usage strings for various commands.
This function parses a single patch name argument, verifying that it is
known to the stack and is in an allowed list (applied, unapplied, hidden).
It also performs string similarity matching on unknown patches and provides
user-facing error messages with the similar patch names.

This isolates use of the strsim crate to the patchrange module.
The Zsh completions script is updated such that StGit subcommands and
aliases are now derived from the `stg -h` output from the Rust
implementation.

The stg executable is now fast enough that caching the parsed command list
is no longer necessary.

And since the description of aliases contain the complete alias expansion,
the completion script can also derive what it needs to know about aliases
from the `stg -h` output without having to consult `git config`. This works
for both StGit's built-in aliases as well as user-defined aliases, which
means the completions script no longer needs baked-in knowledge of the
built-in aliases.
When searching for -b/--branch options in the command line, false positives
would occur due to not checking that the index of the -b/--branch option
was valid.
The STG_TEST_PROFILE indicates which cargo build profile should be tested;
currently either "dev" or "release" (where "debug" may be used as an alias
to "dev").

The Python implementation may still be tested by setting STG_TEST_PYTHON to
a non-empty value.
When running `stg edit --set-tree`, disable implicit edit such that the
editor is not invoked.
Since only the mode bits are needed (for testing whether a hook is
executable), the more general unix MetadataExt can be used instead of the
linux-specific MetadataExt. This matches the cfg test and allows StGit to
build on non-Linux UNIX platforms (e.g. MacOS).
Lints are performed via `cargo fmt` and `cargo clippy`.

Both the API docs and the legacy man pages are built.

Both the unit test suite (`cargo test`) and the system test suite are run.

The build matrix currently covers release & dev build profiles and stable &
nightly Rust toolchains. Adding operating systems is anticipated.

Added scheduled build so that StGit can be tested against new nightly and
stable Rust toolchain releases even when StGit code isn't changing.

Do not [currently] need a deep fetch-depth when cloning the repository
because the version is not derived from `git describe` output.
On platforms using case-insensitive filesystems, having two patch names in
the same stack that only differ by case will cause patch reference
collisions. E.g. `p0` and `P0` would use the same reference file:
`.git/refs/patches/<branch>/p0`.

To avoid this hazard, StGit is modified to disallow case-insensitive
collisions of patch names within a stack. When new patch names are
generated with PatchName::uniquify(), a case-insensitive comparision is
performed to ensure the uniqified name differs by more than just case from
all other patch names in the stack.

And the new Stack::collides() method is used instead of Stack::has_patch()
to test whether user-provided patch names collide with any existing patch
names.
A few of the tests rely on sed behavior specific to GNU sed, where MacOS
ships with BSD sed. So gnu-sed is installed for the MacOS test.
@svenwest svenwest closed this May 22, 2022
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.

2 participants