Skip to content

Commit

Permalink
configurable disconnect border
Browse files Browse the repository at this point in the history
  • Loading branch information
gulbanana committed Mar 20, 2024
1 parent 3bea289 commit 6880c57
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 7 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
## [0.15.3](releases/tag/v0.15.3)

### Added
- Git remotes in the status bar, with push & fetch commands.
- Display Git tags (readonly; they aren't really a Jujutsu concept).
- Relatively comprehensive branch management support - create them, delete them, push
and fetch them. Delete doesn't work quite the same way as in `jj`; removing local and
remote branches are separate gestures, rather than deleting the remote on a later push.
- Show Git remotes in the status bar, with push & fetch commands.
- Display Git tags (readonly; they aren't really a Jujutsu concept).
- Display edges to commits that aren't in the queried revset, by drawing a line to nowhere.
- Detect changes made by other Jujutsu clients and merge the operation log automatically.
- Window title includes the workspace path (when one is open).
- New config option gg.queries.log-page-size for tuning performance on large repositories.
- Improved keyboard support and focus behaviour.
- New config options:
* `gg.queries.log-page-size` for tuning performance on large repositories.
* `gg.ui.indicate-disconnected-branches` to control whether local-only branches are marked.

### Fixed
- GG now understands divergent changes, and can act on commits that have a shared change id.
Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ These changes may or may not be implemented in the future.
* design: decide whether to remove edit menu and maybe add others
* design: consider common signature control
* epic: categorical expansion - trays, modals, pinned commits etc
* epic: config editor UI (for core stuff, as well as gg's own settings)
* chore: windows codesigning will break in august 2024; needs a new approach
3 changes: 3 additions & 0 deletions src-tauri/src/config/gg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ large-repo-heuristic = 100000
# auto-snapshot =

[gg.ui]
# When set, branches that aren't pushed anywhere will be visually marked.
indicate-disconnected-branches = true

# "light" or "dark". If not set, your OS settings will be used.
# theme-override =
7 changes: 7 additions & 0 deletions src-tauri/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub trait GGSettings {
fn query_auto_snapshot(&self) -> Option<bool>;
fn query_check_immutable(&self) -> Option<bool>;
fn ui_theme_override(&self) -> Option<String>;
fn ui_indicate_disconnected_branches(&self) -> bool;
}

impl GGSettings for UserSettings {
Expand All @@ -32,4 +33,10 @@ impl GGSettings for UserSettings {
fn ui_theme_override(&self) -> Option<String> {
self.config().get_string("gg.ui.theme-override").ok()
}

fn ui_indicate_disconnected_branches(&self) -> bool {
self.config()
.get_bool("gg.ui.indicate-disconnected-branches")
.unwrap_or(true)
}
}
1 change: 1 addition & 0 deletions src-tauri/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub enum RepoConfig {
latest_query: String,
status: RepoStatus,
theme: Option<String>,
indicate_disconnected_branches: bool,
},
#[allow(dead_code)]
TimeoutError,
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/worker/gui_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ impl WorkspaceSession<'_> {
default_query,
latest_query,
status: self.format_status(),
theme: self.settings.ui_theme_override()
theme: self.settings.ui_theme_override(),
indicate_disconnected_branches: self.settings.ui_indicate_disconnected_branches()
})
}

Expand Down
6 changes: 5 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import StatusBar from "./shell/StatusBar.svelte";
import ModalOverlay from "./shell/ModalOverlay.svelte";
import ErrorDialog from "./shell/ErrorDialog.svelte";
import { onMount } from "svelte";
import { onMount, setContext } from "svelte";
import IdSpan from "./controls/IdSpan.svelte";
import InputDialog from "./shell/InputDialog.svelte";
import type { InputRequest } from "./messages/InputRequest";
Expand Down Expand Up @@ -53,6 +53,9 @@
}
});
let theme = { indicate_disconnected_branches: true };
setContext("theme", theme);
onEvent("gg://context/revision", mutateRevision);
onEvent("gg://context/tree", mutateTree);
onEvent("gg://context/branch", mutateRef);
Expand All @@ -69,6 +72,7 @@
$revisionSelectEvent = undefined;
if (config.type == "Workspace") {
theme.indicate_disconnected_branches = config.indicate_disconnected_branches;
$repoStatusEvent = config.status;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages/RepoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
import type { DisplayPath } from "./DisplayPath";
import type { RepoStatus } from "./RepoStatus";

export type RepoConfig = { "type": "Initial" } | { "type": "Workspace", absolute_path: DisplayPath, git_remotes: Array<string>, default_query: string, latest_query: string, status: RepoStatus, theme: string | null, } | { "type": "TimeoutError" } | { "type": "LoadError", absolute_path: DisplayPath, message: string, } | { "type": "WorkerError", message: string, };
export type RepoConfig = { "type": "Initial" } | { "type": "Workspace", absolute_path: DisplayPath, git_remotes: Array<string>, default_query: string, latest_query: string, status: RepoStatus, theme: string | null, indicate_disconnected_branches: boolean, } | { "type": "TimeoutError" } | { "type": "LoadError", absolute_path: DisplayPath, message: string, } | { "type": "WorkerError", message: string, };
8 changes: 7 additions & 1 deletion src/objects/BranchObject.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
import Chip from "../controls/Chip.svelte";
import Object from "./Object.svelte";
import Zone from "./Zone.svelte";
import { getContext } from "svelte";
import { repoConfigEvent } from "../stores";
export let header: RevHeader;
export let ref: Extract<StoreRef, { type: "LocalBranch" | "RemoteBranch" }>;
let operand: Operand = { type: "Ref", header, ref };
let label: string;
let state: "add" | "change" | "remove";
let disconnected: boolean;
Expand Down Expand Up @@ -59,7 +63,9 @@
break;
}
let operand: Operand = { type: "Ref", header, ref };
if (!getContext<any>("theme").indicate_disconnected_branches) {
disconnected = false;
}
</script>

<Object {operand} {label} {tip} conflicted={ref.has_conflict} let:context let:hint>
Expand Down

0 comments on commit 6880c57

Please sign in to comment.