1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Single source of guidance wording for `apm sync`.
//
// All copy-pasteable recovery messages that sync emits live here.
// Never scatter literal guidance strings through the sync flow —
// always reference a named constant from this module so future
// wording changes are a single-point edit.
//
// Placeholders used inside string bodies:
// <default> — the project's default branch name (e.g. "main")
// <id> — ticket short id
// <slug> — branch slug (e.g. "ticket/abc123-my-feature")
// <count> — number of commits (numeric string, caller supplies)
// <commits> — the word "commit" or "commits" (caller supplies)
//
// Callers substitute via `.replace("<default>", branch_name)` etc.
// at the print site; this module stays purely declarative.
/// Printed when local `<default>` is behind `origin/<default>` (fast-forward
/// possible in principle) but `git merge --ff-only` refused because uncommitted
/// local changes would be overwritten by the update.
pub const MAIN_BEHIND_DIRTY_OVERLAP: &str = "\
apm sync: cannot fast-forward <default> — uncommitted local changes overlap with incoming commits.
Resolve by committing or stashing your changes first, then re-run apm sync:
git stash
apm sync
git stash pop
Or, if you want to discard your local changes:
git checkout -- .
apm sync";
/// Printed when local `<default>` and `origin/<default>` have diverged
/// (each side has commits the other lacks) and the working tree is clean.
pub const MAIN_DIVERGED_CLEAN: &str = "\
apm sync: <default> has diverged from origin/<default> — cannot fast-forward.
Your local <default> has commits not on origin, and origin has commits not on local.
Resolve by rebasing or merging manually, then push:
git fetch origin
git rebase origin/<default> # or: git merge origin/<default>
git push origin <default>
After resolving, re-run apm sync.";
/// Printed when local `<default>` and `origin/<default>` have diverged
/// (each side has commits the other lacks) and the working tree is dirty.
pub const MAIN_DIVERGED_DIRTY: &str = "\
apm sync: <default> has diverged from origin/<default> and your working tree has uncommitted changes.
Stash your changes first, then resolve the divergence manually:
git stash
git fetch origin
git rebase origin/<default> # or: git merge origin/<default>
git push origin <default>
git stash pop
After resolving, re-run apm sync.";
/// Printed when local `<default>` has commits not yet pushed to `origin/<default>`.
/// Sync never pushes; the user must push explicitly.
/// Placeholders: `<default>`, `<remote>`, `<count>`, `<commits>`.
pub const MAIN_AHEAD: &str = "\
<default> is ahead of <remote> by <count> <commits>. Merged tickets will not be detected as closeable until you push — run `git push` when ready.";
/// Printed when a non-checked-out `ticket/*` or `epic/*` ref has local commits
/// not yet pushed to `origin`. Sync never pushes; the user must push explicitly.
/// Placeholder: `<slug>`.
pub const TICKET_OR_EPIC_AHEAD: &str = "\
info: <slug> is ahead of origin — push when ready: git push origin <slug>";
/// Printed for a non-checked-out `ticket/*` or `epic/*` ref whose local tip
/// and `origin` tip have diverged (local has unpushed commits AND origin has
/// commits not on local). Sync cannot safely update either side.
pub const TICKET_OR_EPIC_DIVERGED: &str = "\
apm sync: branch <slug> has diverged from origin/<slug> — skipping automatic update.
To resolve, check out the branch and merge or rebase manually:
git checkout <slug>
git fetch origin
git rebase origin/<slug> # or: git merge origin/<slug>
git push origin <slug>
After resolving, re-run apm sync.";
/// Printed when `apm sync` detects the repo is mid-merge, mid-rebase, or
/// mid-cherry-pick (`.git/MERGE_HEAD`, `.git/rebase-merge`, `.git/rebase-apply`,
/// or `.git/CHERRY_PICK_HEAD` exists). Any sync work done in this state would
/// compound the incomplete operation.
pub const MID_MERGE_IN_PROGRESS: &str = "\
apm sync: repository is mid-merge, mid-rebase, or mid-cherry-pick — cannot sync now.
Finish or abort the in-progress operation first, then re-run apm sync.
To abort a merge:
git merge --abort
To abort a rebase:
git rebase --abort
To abort a cherry-pick:
git cherry-pick --abort";
/// Printed when a ticket worktree is `Behind` origin but has uncommitted changes —
/// the fast-forward is skipped to avoid clobbering local work.
/// Placeholders: `<branch>`, `<path>`, `<files>`.
pub const WORKTREE_DIRTY_SKIP: &str = "\
apm sync: worktree <path> (<branch>) has uncommitted changes — skipping fast-forward.
Dirty files:
<files>
Commit or stash your changes first, then re-run apm sync:
git -C <path> stash
apm sync
git -C <path> stash pop";
/// Printed when a ticket worktree's branch is `Ahead` of origin (local has unpushed commits).
/// Placeholders: `<branch>`, `<path>`.
pub const WORKTREE_AHEAD: &str = "\
info: <branch> worktree at <path> is ahead of origin — push when ready: git -C <path> push origin <branch>";
/// Printed when a ticket worktree's branch has `Diverged` from origin
/// (each side has commits the other lacks). Manual resolution required.
/// Placeholders: `<branch>`, `<path>`.
pub const WORKTREE_DIVERGED: &str = "\
apm sync: worktree <path> (<branch>) has diverged from origin — cannot fast-forward.
To resolve, fetch and rebase manually inside the worktree:
git -C <path> fetch origin
git -C <path> rebase origin/<branch>
git -C <path> push origin <branch>
After resolving, re-run apm sync.";