| ... | @@ -76,6 +76,8 @@ in | ... | @@ -76,6 +76,8 @@ in |
| 76 | bup = "jj b m --from 'heads(::@- & bookmarks()) ~ (master | bookmarks(glob:\"deployment*\"))' --to '@'"; | 76 | bup = "jj b m --from 'heads(::@- & bookmarks()) ~ (master | bookmarks(glob:\"deployment*\"))' --to '@'"; |
| 77 | moveself = "jj rebase -s @ -d"; | 77 | moveself = "jj rebase -s @ -d"; |
| 78 | logall = "jj log -r 'all()'"; | 78 | logall = "jj log -r 'all()'"; |
| | 79 | unmerged = "jj log -r 'unmerged()'"; |
| | 80 | um = "jj log -r 'unmerged()'"; |
| 79 | cherry = "jj git fetch && jj split -i -p -m 'SPLIT_CHANGES' && jj edit -r 'description(\"SPLIT_CHANGES\")' && jj desc -m '' --edit"; | 81 | cherry = "jj git fetch && jj split -i -p -m 'SPLIT_CHANGES' && jj edit -r 'description(\"SPLIT_CHANGES\")' && jj desc -m '' --edit"; |
| 80 | }; | 82 | }; |
| 81 | initContent = '' | 83 | initContent = '' |
| ... | @@ -146,13 +148,26 @@ in | ... | @@ -146,13 +148,26 @@ in |
| 146 | } | 148 | } |
| 147 | | 149 | |
| 148 | function jj() { | 150 | function jj() { |
| 149 | if [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then | 151 | if [[ "$1" = "new" && "$#" -eq 2 && "$2" != *@* && "$2" != -* ]]; then |
| | 152 | local stderr status |
| | 153 | stderr="$(mktemp)" |
| | 154 | command jj "$@" 2>"$stderr" |
| | 155 | status=$? |
| | 156 | if [[ $status -ne 0 ]] && command grep -Fq "Revision \`$2\` doesn't exist" "$stderr" && command grep -Fq "\`$2@origin\`" "$stderr"; then |
| | 157 | rm -f "$stderr" |
| | 158 | command jj new "$2@origin" |
| | 159 | return $? |
| | 160 | fi |
| | 161 | command cat "$stderr" >&2 |
| | 162 | rm -f "$stderr" |
| | 163 | return $status |
| | 164 | elif [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then |
| 150 | if command jj "$@" --dry-run; then | 165 | if command jj "$@" --dry-run; then |
| 151 | printf "Press any key to continue... " | 166 | printf "Press any key to continue... " |
| 152 | read -r | 167 | read -r |
| 153 | command jj "$@" | 168 | command jj "$@" |
| 154 | fi | 169 | fi |
| 155 | else if [[ "$*" != "undo" ]] || [[ "$*" != "redo" ]] | 170 | elif [[ "$*" != "undo" && "$*" != "redo" ]]; then |
| 156 | # auto-install deps when switching commits | 171 | # auto-install deps when switching commits |
| 157 | wrapWithAutoInstall jj "$@" | 172 | wrapWithAutoInstall jj "$@" |
| 158 | fi | 173 | fi |
| ... | @@ -254,6 +269,28 @@ in | ... | @@ -254,6 +269,28 @@ in |
| 254 | revsets = { | 269 | revsets = { |
| 255 | short-prefixes = "(trunk()..@)::"; | 270 | short-prefixes = "(trunk()..@)::"; |
| 256 | }; | 271 | }; |
| | 272 | "template-aliases" = { |
| | 273 | "format_log_author(commit)" = '' |
| | 274 | if(commit.mine(), "You", commit.author().name().match("[^ ]+")) |
| | 275 | ''; |
| | 276 | "format_log_timestamp(timestamp)" = '' |
| | 277 | if(timestamp.after("1 day ago"), timestamp.ago(), timestamp.local().format("%Y-%m-%d")) |
| | 278 | ''; |
| | 279 | "format_short_commit_header(commit)" = '' |
| | 280 | separate(" ", |
| | 281 | format_short_change_id_with_change_offset(commit), |
| | 282 | label("author", format_log_author(commit)), |
| | 283 | label("timestamp", format_log_timestamp(commit_timestamp(commit))), |
| | 284 | commit.bookmarks(), |
| | 285 | commit.tags(), |
| | 286 | commit.working_copies(), |
| | 287 | format_commit_labels(commit), |
| | 288 | if(config("ui.show-cryptographic-signatures").as_boolean(), |
| | 289 | format_short_cryptographic_signature(commit.signature()) |
| | 290 | ), |
| | 291 | ) |
| | 292 | ''; |
| | 293 | }; |
| 257 | aliases = { | 294 | aliases = { |
| 258 | "ab" = [ "abandon" ]; | 295 | "ab" = [ "abandon" ]; |
| 259 | "ci" = [ | 296 | "ci" = [ |