Conflicts
In Oxygen a conflict is data, not an error. A conflicted state can be committed, pushed, pulled, tagged and built on. You resolve it when you are ready, and the resolution is an ordinary change.
stateDiagram-v2
[*] --> Clean
Clean --> Conflicted: pull or merge brings concurrent edits<br/>to the same lines
Conflicted --> Conflicted: commit, push, pull<br/>(nothing is blocked)
Conflicted --> Clean: edit the file, then<br/>oxy commit (a resolution)
How a conflict arises
Remember that a file is a graph of lines (see Changes and Dependencies). Normally the live lines form a single sequence. When two changes that do not know each other insert different lines at the same place, the graph has two branches, and the file is conflicted.
flowchart LR
START((START)) --> x["retry = 3"]
x --> a["A: retry = 5"]
x --> b["B: retry = 10"]
a --> END((END))
b --> END
Kinds of conflict:
| Kind | What happened |
|---|---|
| Order | Concurrent inserts at the same spot, or concurrent edits of overlapping lines |
| Delete/insert | One side deleted a line the other inserted next to |
| Tree | Two files want one name, a file was moved two ways, a file was edited in a directory another side deleted |
| Replace | Two different new versions of one binary file |
| Workspace | The state is fine, but this file system cannot show it: names equal ignoring case on macOS or Windows, reserved names such as CON, paths too long |
What you see
<<<<<<< oxy conflict 1 of 2, side 1: change k7m2p9 "Add retry loop"
retry = 5
======= oxy conflict 1 of 2, side 2: change q3x8w1 "Refactor client"
retry = 10
>>>>>>> oxy conflict 1 of 2 end
Each side names the change it came from. A tree conflict shows each candidate as <name>.oxy-conflict-<n>. oxy status lists every conflict and exits with status 2 while any remain.
Resolving
sequenceDiagram
participant You
participant WC as Working copy
participant Repo as Repository
Repo->>WC: conflicted file with markers
You->>WC: edit to the right text, remove markers
You->>Repo: oxy resolve (what your edits settle)
You->>Repo: oxy commit -m "Resolve retry"
Note over Repo: a resolution change that depends on<br/>both sides of the conflict
Repo-->>Repo: anyone who fetches it<br/>gets the conflict resolved too
Because the resolution depends on both sides, anyone who fetches it necessarily has the conflict it resolves, and sees it resolved.