this repo has no description

Add JJ helpers to work with megamerges

hauleth.dev 431dec2c d3826252

verified
+29 -29
flake.lock
···
]
},
"locked": {
-
"lastModified": 1755825449,
-
"narHash": "sha256-XkiN4NM9Xdy59h69Pc+Vg4PxkSm9EWl6u7k6D5FZ5cM=",
+
"lastModified": 1758102940,
+
"narHash": "sha256-wwqf3+A8EiqwWpcAaPN20QXJLlpGPpwtLTrzgnngI2o=",
"owner": "lnl7",
"repo": "nix-darwin",
-
"rev": "8df64f819698c1fee0c2969696f54a843b2231e8",
+
"rev": "ebd0bfc11fc2b5cff37401e9b3703881ad5fabbd",
"type": "github"
},
"original": {
···
},
"darwin-stable": {
"locked": {
-
"lastModified": 1751290243,
-
"narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=",
+
"lastModified": 1758235313,
+
"narHash": "sha256-OGnmMaDFlg/6TcF/MUns9WGGGKXgbZi+kIT2xrWP0zM=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6",
+
"rev": "660ccb4ded7a6a715a79fdee58f064e8beecb65a",
"type": "github"
},
"original": {
"owner": "nixos",
-
"ref": "nixpkgs-24.11-darwin",
+
"ref": "nixpkgs-25.05-darwin",
"repo": "nixpkgs",
"type": "github"
}
···
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
-
"lastModified": 1754487366,
-
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
+
"lastModified": 1756770412,
+
"narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=",
"owner": "hercules-ci",
"repo": "flake-parts",
-
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
+
"rev": "4524271976b625a4a605beefd893f270620fd751",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1756579987,
-
"narHash": "sha256-duCce8zGsaMsrqqOmLOsuaV1PVIw/vXWnKuLKZClsGg=",
+
"lastModified": 1758250706,
+
"narHash": "sha256-Jv/V+PNi5RyqCUK2V6YJ0iCqdLPutU69LZas85EBUaU=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "99a69bdf8a3c6bf038c4121e9c4b6e99706a187a",
+
"rev": "363007f12930caf8b0ea59c0bf5be109c52ad0ef",
"type": "github"
},
"original": {
···
"lix": {
"flake": false,
"locked": {
-
"lastModified": 1753306924,
-
"narHash": "sha256-jLCEW0FvjFhC+c4RHzH+xbkSOxrnpFHnhjOw6sudhx0=",
-
"rev": "1a4393d0aac31aba21f5737ede1b171e11336d77",
+
"lastModified": 1757791921,
+
"narHash": "sha256-83qbJckLOLrAsKO88UI9N4QRatNEc3gUFtLMiAPwK0g=",
+
"rev": "b7c2f17e9133e8b85d41c58b52f9d4e3254f41da",
"type": "tarball",
-
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/1a4393d0aac31aba21f5737ede1b171e11336d77.tar.gz?rev=1a4393d0aac31aba21f5737ede1b171e11336d77"
+
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/b7c2f17e9133e8b85d41c58b52f9d4e3254f41da.tar.gz?rev=b7c2f17e9133e8b85d41c58b52f9d4e3254f41da"
},
"original": {
"type": "tarball",
···
"neorg": {
"flake": false,
"locked": {
-
"lastModified": 1751646203,
-
"narHash": "sha256-uQSrXTngyRSWRyPN7v7uVQOHw+8rLm8+KXxls4nT2K4=",
+
"lastModified": 1757505607,
+
"narHash": "sha256-FwxvApfOcnHH1kWYDccaKRGObLhT4zx/FzjrvasefVI=",
"owner": "nvim-neorg",
"repo": "neorg",
-
"rev": "790b0444c0c654131a722817dc893332e06c72b9",
+
"rev": "91db472c7f65a1a8f7fdc461e0fb040f565a95c4",
"type": "github"
},
"original": {
···
"norg-meta": "norg-meta"
},
"locked": {
-
"lastModified": 1756585044,
-
"narHash": "sha256-Pd71Z4muaqfFdbbW7gajF7mJurgPGK5V+dp1gDhB7io=",
+
"lastModified": 1758277139,
+
"narHash": "sha256-x6IhcmQI6JpM3G4kRhSA3ZSdB09l5prYPE2hK+Eb3Uw=",
"owner": "nvim-neorg",
"repo": "nixpkgs-neorg-overlay",
-
"rev": "9050eda53388acfa780b8e6e316c2ec5758cd492",
+
"rev": "0bb8d5b94424dacd788a71f3f1da68eafdf175de",
"type": "github"
},
"original": {
···
},
"nixpkgs-lib": {
"locked": {
-
"lastModified": 1753579242,
-
"narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=",
+
"lastModified": 1754788789,
+
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
-
"rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e",
+
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
"type": "github"
},
"original": {
···
},
"nixpkgs_4": {
"locked": {
-
"lastModified": 1756536218,
-
"narHash": "sha256-ynQxPVN2FIPheUgTFhv01gYLbaiSOS7NgWJPm9LF9D0=",
+
"lastModified": 1758213207,
+
"narHash": "sha256-rqoqF0LEi+6ZT59tr+hTQlxVwrzQsET01U4uUdmqRtM=",
"owner": "NixOS",
"repo": "nixpkgs",
-
"rev": "a918bb3594dd243c2f8534b3be01b3cb4ed35fd1",
+
"rev": "f4b140d5b253f5e2a1ff4e5506edbf8267724bde",
"type": "github"
},
"original": {
+3 -1
flake.nix
···
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
-
darwin-stable.url = "github:nixos/nixpkgs/nixpkgs-24.11-darwin";
+
darwin-stable.url = "github:nixos/nixpkgs/nixpkgs-25.05-darwin";
flake-parts.url = "github:hercules-ci/flake-parts";
home-manager = {
···
...
}: {
formatter = pkgs.alejandra;
+
+
legacyPackages = inputs'.darwin-stable.legacyPackages.callPackage ./pkgs {};
packages =
(pkgs.callPackage ./pkgs {})
+1 -1
modules/fish.nix
···
};
loginShellInit = ''
-
fish_add_path --move --path $HOME/.nix-profile/bin /run/wrappers/bin /etc/profiles/per-user/$USER/bin /nix/var/nix/profiles/default/bin /run/current-system/sw/bin
+
fish_add_path --move --path /run/wrappers/bin /etc/profiles/per-user/$USER/bin /nix/var/nix/profiles/default/bin /run/current-system/sw/bin
fish_add_path $HOME/.local/bin
'';
+1 -1
modules/fonts.nix
···
inputs,
...
}: let
-
pkgs-self = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
+
pkgs-self = inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
fonts = {
packages = [
+46 -4
modules/jj.nix
···
};
aliases = {
-
record = ["commit"];
-
ci = ["commit"];
-
rci = ["squash"];
-
lg = ["log"];
tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"];
pull = ["git" "fetch"];
push = ["git" "push"];
···
"--source" "roots(trunk()..mutable())"
"--destination" "trunk()"
];
+
+
# Put changes from `@` into another change
+
# Inverse of `extract`
+
inject = ["squash" "--from" "@" "--into"];
+
+
# Fetch changes from change into `@`
+
# Inverse of `inject`
+
extract = ["squash" "--into" "@" "--form"];
+
+
# 'jj sandwich xyz' to move xyz into the megamerge in parallel to everything
+
# else. See notes on 'megamerge()' above for how it's resolved.
+
sandwich = [ "rebase" "-B" "megamerge()" "-A" "trunk()" "-r"];
};
revset-aliases = {
"closest_bookmark(to)" = "heads(::to & bookmarks())";
+
+
# stack(x, n) is the set of mutable commits reachable from 'x', with 'n'
+
# parents. 'n' is often useful to customize the display and return set for
+
# certain operations. 'x' can be used to target the set of 'roots' to traverse,
+
# e.g. @ is the current stack.
+
"stack()" = "stack(@)";
+
"stack(x)" = "stack(x, 2)";
+
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)";
+
+
# Find the megamerge. Mostly useful in combination with other aliases, primarily
+
# 'sandwich'. Normally when there's only one megamerge, sandwich works perfectly
+
# fine and is basically "magic". However, there are more complex cases; consider
+
# something like this which represents a forked repository of an upstream:
+
#
+
#
+
# ----> P1 ... Pn -----------\
+
# / \
+
# /---> X --\ (main) \
+
# B M1 --> T1 ... Tn --> M2 --> @
+
# \---> Y --/
+
#
+
# X and Y are typical features on top of base B, combined inside megamerge M1.
+
# However, we may want changes T1...Tn to go on top of M1, because (in my case)
+
# they're custom and will never go upstream, but are correctly published as part
+
# of the fork; Tn is where the main bookmark points. Finally, we have changes P1
+
# ... Pn which are private and should never be pushed upstream at all.
+
#
+
# In this case, sandwich will fail because 'reachable(stack(), merges())' will
+
# resolve to {M1, M2}, which is an invalid argument for 'rebase -B' due to not
+
# having an all: prefix modifier. So to handle that case, we allow the user
+
# to either specify the merge via literal tag "megamerge". In this case if we
+
# 'bookmark set megamerge -r M1' then sandwich will always work correctly.
+
"megamerge()" = "coalesce(present(megamerge), reachable(stack(), merges()))";
};
git = {
+
colocate = true;
write-change-id-header = true;
push-new-bookmarks = true;
};
+1
modules/tools.nix
···
home.packages = [
# bfs
# pkgs-self.ubin-client
+
pkgs.ast-grep
pkgs.btop
pkgs.charm-freeze
# pkgs.comby