Skip to content

Instantly share code, notes, and snippets.

@pchiusano
Last active December 14, 2022 17:10
Show Gist options
  • Save pchiusano/a9632f9b8c6faa4a01ae3e7a81e5b26c to your computer and use it in GitHub Desktop.
Save pchiusano/a9632f9b8c6faa4a01ae3e7a81e5b26c to your computer and use it in GitHub Desktop.
Updating a dependency in Unison

Here's a transcript of me updating a dependency in Unison. We're going to make this more streamlined, but this is the process for now. First, I made a copy of the branch I was updating (in this case main of distributed):

.distributed> fork main topics.baseupdate

  Done.

Next I pulled the new version of base into lib.base_new:

.distributed> cd topics.baseupdate
.distributed.topics.baseupdate> pull unison.public.base.latest lib.base_new

  Downloaded 710 entities.

  ✅ Successfully pulled into newly created namespace lib.base_new.

At this point, I've got lib.base and lib.base_new in my project. This is a perfectly fine state of things. You can have a project that simultaneously depends on two different versions of the same library if you need to (though you'd probably switch to calling the namespace by its version rather than using _old, so like v6.base and v7.base)

I apply any updates in lib.base_new.patch:

.distributed.topics.baseupdate> patch lib.base_new.patch 

  😶
  
  This had no effect. Perhaps the patch has already been applied 
  or it doesn't intersect with the definitions in the current namespace.

This is a good sign. It means I wasn't even using any of the definitions that were updated by the newer version of base. Okay, now I can delete the old version of base:

.distributed.topics.baseupdate> move.namespace lib.base .trash.base_old

  Done.

.distributed.topics.baseupdate> move.namespace lib.base_new lib.base

  Done.

Check to make sure no stray references to old definitions:

.distributed.topics.baseupdate> todo lib.base.patch                

  ✅
  
  No conflicts or edits in progress.

.distributed.topics.baseupdate> namespace.dependencies

  This namespace has no external dependencies.

All good, going to merge back into main.

.distributed> merge topics.baseupdate main

   ... a big diff

.distributed.main> push

  Uploaded 14 entities.

  View it on Unison Share: https://share.unison-lang.org/@unison/code/latest/namespaces/public/distributed/main

FIN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment