unison/unison-src/transcripts/undo.output.md
Arya Irani 0cd3cd1cff Merge branch 'trunk' into cp/project-root
# Conflicts:
#	unison-cli-integration/integration-tests/IntegrationTests/transcript.output.md
#	unison-src/transcripts-round-trip/main.output.md
#	unison-src/transcripts/add-run.output.md
#	unison-src/transcripts/bug-strange-closure.output.md
#	unison-src/transcripts/cycle-update-5.output.md
#	unison-src/transcripts/delete.output.md
#	unison-src/transcripts/diff-namespace.output.md
#	unison-src/transcripts/move-namespace.output.md
#	unison-src/transcripts/name-selection.output.md
#	unison-src/transcripts/names.output.md
#	unison-src/transcripts/namespace-dependencies.output.md
#	unison-src/transcripts/propagate.output.md
#	unison-src/transcripts/reflog.output.md
#	unison-src/transcripts/reset.output.md
#	unison-src/transcripts/tab-completion.output.md
#	unison-src/transcripts/transcript-parser-commands.output.md
2024-07-10 23:49:04 -04:00

2.7 KiB

Undo

Undo should pop a node off of the history of the current branch.

x = 1
scratch/main> builtins.merge lib.builtins

  Done.

scratch/main> add

  ⍟ I've added these definitions:
  
    x : Nat

scratch/main> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)

scratch/main> alias.term x y

  Done.

scratch/main> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)
  3. y    (Nat)

scratch/main> history

  Note: The most recent namespace hash is immediately below this
        message.
  
  ⊙ 1. #nmem6r6no1
  
    + Adds / updates:
    
      y
    
    = Copies:
    
      Original name New name(s)
      x             y
  
  ⊙ 2. #3rqf1hbev7
  
    + Adds / updates:
    
      x
  
  □ 3. #ms9lggs2rg (start of history)

scratch/main> undo

  Here are the changes I undid
  
  Name changes:
  
    Original  Changes
    1. x      2. y (added)

scratch/main> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)

scratch/main> history

  Note: The most recent namespace hash is immediately below this
        message.
  
  ⊙ 1. #3rqf1hbev7
  
    + Adds / updates:
    
      x
  
  □ 2. #ms9lggs2rg (start of history)


It should not be affected by changes on other branches.

x = 1
scratch/branch1> builtins.merge lib.builtins

  Done.

scratch/branch1> add

  ⍟ I've added these definitions:
  
    x : Nat

scratch/branch1> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)

scratch/branch1> alias.term x y

  Done.

scratch/branch1> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)
  3. y    (Nat)

scratch/branch1> history

  Note: The most recent namespace hash is immediately below this
        message.
  
  ⊙ 1. #nmem6r6no1
  
    + Adds / updates:
    
      y
    
    = Copies:
    
      Original name New name(s)
      x             y
  
  ⊙ 2. #3rqf1hbev7
  
    + Adds / updates:
    
      x
  
  □ 3. #ms9lggs2rg (start of history)

-- Make some changes on an unrelated branch
scratch/branch2> builtins.merge lib.builtins

  Done.

scratch/branch2> delete.namespace lib

  Done.

scratch/branch1> undo

  Here are the changes I undid
  
  Name changes:
  
    Original  Changes
    1. x      2. y (added)

scratch/branch1> ls

  1. lib/ (469 terms, 74 types)
  2. x    (Nat)

scratch/branch1> history

  Note: The most recent namespace hash is immediately below this
        message.
  
  ⊙ 1. #3rqf1hbev7
  
    + Adds / updates:
    
      x
  
  □ 2. #ms9lggs2rg (start of history)


Undo should be a no-op on a newly created branch

scratch/main> branch.create-empty new

  Done. I've created an empty branch scratch/new.
  
  Tip: Use `merge /somebranch` to initialize this branch.

scratch/new> undo

  ⚠️
  
  Nothing more to undo.