mirror of
https://github.com/unisonweb/unison.git
synced 2024-08-15 13:30:27 +03:00
Update reflog command WIP
This commit is contained in:
parent
31874bd199
commit
8a405e02d2
@ -3498,8 +3498,8 @@ getProjectReflog numEntries projectId =
|
||||
[sql|
|
||||
SELECT project_id, project_branch_id, time, from_root_causal_id, to_root_causal_id, reason
|
||||
FROM project_branch_reflog
|
||||
ORDER BY time DESC
|
||||
WHERE project_id = :projectId
|
||||
ORDER BY time DESC
|
||||
LIMIT :numEntries
|
||||
|]
|
||||
|
||||
@ -3510,8 +3510,8 @@ getProjectBranchReflog numEntries projectBranchId =
|
||||
[sql|
|
||||
SELECT project_id, project_branch_id, time, from_root_causal_id, to_root_causal_id, reason
|
||||
FROM project_branch_reflog
|
||||
ORDER BY time DESC
|
||||
WHERE project_branch_id = :projectBranchId
|
||||
ORDER BY time DESC
|
||||
LIMIT :numEntries
|
||||
|]
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- A reflog which is tied to the project/branch
|
||||
CREATE TABLE project_branch_reflog (
|
||||
project_id INTEGER NOT NULL,
|
||||
project_branch_id INTEGER NOT NULL,
|
||||
@ -24,3 +25,8 @@ CREATE INDEX project_reflog_by_time ON project_branch_reflog (
|
||||
project_id, time DESC
|
||||
);
|
||||
|
||||
CREATE INDEX global_reflog_by_time ON project_branch_reflog (
|
||||
time DESC
|
||||
);
|
||||
|
||||
|
||||
|
@ -48,3 +48,6 @@ fromText _ = Nothing
|
||||
|
||||
instance Show ShortCausalHash where
|
||||
show (ShortCausalHash h) = '#' : Text.unpack h
|
||||
|
||||
instance From ShortCausalHash Text where
|
||||
from = toText
|
||||
|
@ -1071,11 +1071,11 @@ inputDescription input =
|
||||
VersionI -> wat
|
||||
where
|
||||
hp' :: Either SCH.ShortCausalHash Path' -> Cli Text
|
||||
hp' = either (pure . Text.pack . show) p'
|
||||
hp' = either (pure . into @Text) p'
|
||||
p :: Path -> Cli Text
|
||||
p = fmap tShow . Cli.resolvePath
|
||||
p = fmap (into @Text) . Cli.resolvePath
|
||||
p' :: Path' -> Cli Text
|
||||
p' = fmap tShow . Cli.resolvePath'
|
||||
p' = fmap (into @Text) . Cli.resolvePath'
|
||||
brp :: BranchRelativePath -> Cli Text
|
||||
brp = fmap (into @Text) . ProjectUtils.resolveBranchRelativePath
|
||||
ops :: Maybe Path.Split -> Cli Text
|
||||
|
@ -3481,7 +3481,8 @@ validInputs =
|
||||
viewGlobal,
|
||||
deprecatedViewRootReflog,
|
||||
branchReflog,
|
||||
projectReflog
|
||||
projectReflog,
|
||||
globalReflog
|
||||
]
|
||||
|
||||
-- | A map of all command patterns by pattern name or alias.
|
||||
|
@ -2,8 +2,7 @@
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
```
|
||||
|
||||
First we make two changes to the codebase, so that there's more than one line
|
||||
for the `reflog` command to display:
|
||||
First we make some changes to the codebase so there's data in the reflog.
|
||||
|
||||
```unison
|
||||
x = 1
|
||||
@ -16,16 +15,27 @@ y = 2
|
||||
```
|
||||
```ucm
|
||||
scratch/main> add
|
||||
scratch/main> view y
|
||||
scratch/main> branch /other
|
||||
scratch/other> alias.term y z
|
||||
newproject/main> builtins.merge lib.builtins
|
||||
newproject/main> alias.type lib.builtins.Nat MyNat
|
||||
```
|
||||
|
||||
Should see reflog entries from the current branch
|
||||
|
||||
```ucm
|
||||
scratch/main> reflog
|
||||
```
|
||||
|
||||
If we `reset-root` to its previous value, `y` disappears.
|
||||
Should see reflog entries from the current project
|
||||
|
||||
```ucm
|
||||
scratch/main> reset-root 2
|
||||
scratch/main> project.reflog
|
||||
```
|
||||
```ucm:error
|
||||
scratch/main> view y
|
||||
|
||||
|
||||
Should see reflog entries from all projects
|
||||
|
||||
```ucm
|
||||
scratch/main> reflog.global
|
||||
```
|
||||
|
@ -1,5 +1,4 @@
|
||||
First we make two changes to the codebase, so that there's more than one line
|
||||
for the `reflog` command to display:
|
||||
First we make some changes to the codebase so there's data in the reflog.
|
||||
|
||||
```unison
|
||||
x = 1
|
||||
@ -50,37 +49,87 @@ scratch/main> add
|
||||
|
||||
y : Nat
|
||||
|
||||
scratch/main> view y
|
||||
scratch/main> branch /other
|
||||
|
||||
y : Nat
|
||||
y = 2
|
||||
Done. I've created the other branch based off of main.
|
||||
|
||||
Tip: To merge your work back into the main branch, first
|
||||
`switch /main` then `merge /other`.
|
||||
|
||||
scratch/other> alias.term y z
|
||||
|
||||
Done.
|
||||
|
||||
newproject/main> builtins.merge lib.builtins
|
||||
|
||||
Done.
|
||||
|
||||
newproject/main> alias.type lib.builtins.Nat MyNat
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
Should see reflog entries from the current branch
|
||||
|
||||
```ucm
|
||||
scratch/main> reflog
|
||||
|
||||
⚠️
|
||||
Below is a record of recent changes, you can use
|
||||
`reset #abcdef` to reset the current branch to a previous
|
||||
state.
|
||||
|
||||
The reflog is empty
|
||||
Tip: Use `diff.namespace 1 7` to compare between points in
|
||||
history.
|
||||
|
||||
Branch When Hash Description
|
||||
1. scratch/main now #6mdl5gruh5 add
|
||||
2. scratch/main now #3rqf1hbev7 add
|
||||
3. scratch/main now #ms9lggs2rg builtins.merge scratch/main:.lib.builtins
|
||||
4. scratch/main now #sg60bvjo91 Project Created
|
||||
|
||||
```
|
||||
If we `reset-root` to its previous value, `y` disappears.
|
||||
Should see reflog entries from the current project
|
||||
|
||||
```ucm
|
||||
scratch/main> reset-root 2
|
||||
scratch/main> project.reflog
|
||||
|
||||
Below is a record of recent changes, you can use
|
||||
`reset #abcdef` to reset the current branch to a previous
|
||||
state.
|
||||
|
||||
Tip: Use `diff.namespace 1 7` to compare between points in
|
||||
history.
|
||||
|
||||
Branch When Hash Description
|
||||
1. scratch/other now #148flqs4b1 alias.term scratch/other:..y scratch/other:.z
|
||||
2. scratch/other now #6mdl5gruh5 Branch created from scratch/main
|
||||
3. scratch/main now #6mdl5gruh5 add
|
||||
4. scratch/main now #3rqf1hbev7 add
|
||||
5. scratch/main now #ms9lggs2rg builtins.merge scratch/main:.lib.builtins
|
||||
6. scratch/main now #sg60bvjo91 Project Created
|
||||
|
||||
```
|
||||
Should see reflog entries from all projects
|
||||
|
||||
```ucm
|
||||
scratch/main> view y
|
||||
scratch/main> reflog.global
|
||||
|
||||
y : Nat
|
||||
y = 2
|
||||
Below is a record of recent changes, you can use
|
||||
`reset #abcdef` to reset the current branch to a previous
|
||||
state.
|
||||
|
||||
Tip: Use `diff.namespace 1 7` to compare between points in
|
||||
history.
|
||||
|
||||
Branch When Hash Description
|
||||
1. newproject/main now #2rjhs2vq43 alias.term newproject/main:.lib.builtins.Nat newproject/main...
|
||||
2. newproject/main now #ms9lggs2rg builtins.merge newproject/main:.lib.builtins
|
||||
3. newproject/main now #sg60bvjo91 Branch Created
|
||||
4. scratch/other now #148flqs4b1 alias.term scratch/other:..y scratch/other:.z
|
||||
5. scratch/other now #6mdl5gruh5 Branch created from scratch/main
|
||||
6. scratch/main now #6mdl5gruh5 add
|
||||
7. scratch/main now #3rqf1hbev7 add
|
||||
8. scratch/main now #ms9lggs2rg builtins.merge scratch/main:.lib.builtins
|
||||
9. scratch/main now #sg60bvjo91 Project Created
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
🛑
|
||||
|
||||
The transcript was expecting an error in the stanza above, but did not encounter one.
|
||||
|
Loading…
Reference in New Issue
Block a user