Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff: geojson to console doesn't work for one dataset in a multi-dataset repo #702

Closed
rcoup opened this issue Aug 23, 2022 · 2 comments
Closed
Assignees

Comments

@rcoup
Copy link
Member

rcoup commented Aug 23, 2022

Describe the bug

Trying to get a geojson diff to stdout for working-copy changes to a single dataset. There are 3 vector datasets in the repository.

$ kart status
On branch main

Changes in working copy:
  (use "kart commit" to commit)
  (use "kart restore" to discard changes)

  road-centrelines-topo:
    feature:
      1 updates
$ kart diff -o geojson
Usage: kart_cli diff [OPTIONS] [COMMIT_SPEC] [FILTERS]...
Try 'kart_cli diff --help' for help.

Error: Invalid value for --output: Need to specify a directory via --output for GeoJSON with more than one dataset
$ kart diff -o geojson road-centrelines-topo
Error: road-centrelines-topo is not a ref, commit or tree
$ kart diff -o geojson road-centrelines-topo:
Error: road-centrelines-topo: is not a ref, commit or tree
$ kart diff -o geojson -- road-centrelines-topo
Error: road-centrelines-topo: is not a ref, commit or tree
$ kart diff -o geojson -- road-centrelines-topo:
Error: road-centrelines-topo: is not a ref, commit or tree

$ kart diff -o geojson --output .
$ ls
KART_README.txt  demo.gpkg  demo.gpkg-shm  demo.gpkg-wal  road-centrelines-topo.geojson

Expected behaviour

My changes are only to a single dataset, so there should be a way to return geojson from the diff without needing to write a file.

Version Info

  • OS: macOS
  • Version: v0.11.6.dev0
@rcoup rcoup changed the title kart diff quirks diff: geojson to console doesn't work for one dataset in a multi-dataset repo Aug 23, 2022
@rcoup
Copy link
Member Author

rcoup commented Aug 24, 2022

Fix was bde1deb

Is there a way to limit the diff to a single dataset like you can with log?

@olsen232
Copy link
Collaborator

Yes, it even works nearly as you were doing above:
kart diff HEAD -o geojson road-centrelines-topo

The problem with kart diff and with kart show - and potentially other commands like commit - is that we don't understand -- properly. Click recognises it but hides it from us. Perhaps click applies some logic to it - maybe --aaa -- --bbb is parsed as option aaa and argument bbb.

@craigds fixed up kart log to understand --
It's not ideal in that it mostly bypasses click: it stops click from swallowing the --, and then we kind of get all the arguments in a big lump, instead of click sorting them out for us. It's then up to us to find the -- if present, and to separate them back into their argument types: commits and paths. But, perhaps we can't do much better: parsing the arguments in Git and now Kart is repository specific, since Git and now Kart checks to see if "road-centrelines-topo" is the name of a commit, or the name of a path. Anyway, I guess I need to pull that code out of log and figure out how to reuse it for diff, show, commit. I'll file a new bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants