pijul_org / pijul

#109 Add a 'status' command

Opened by laumann, on May 31, 2017
Closed
laumann commented on May 31, 2017

This is a first shot at a pijul status command. There are a few unanswered questions, but I think the fundamentals are there.

The output closely mirrors git status.

For changed files, the display is pretty straight-forward, except I'm not sure how to display moved files, it only seems that the new file name is recorded

For untracked files, I've used the ignore crate and use the default .ignore files. It's missing something like .git/info/exclude, mainly because I'm not sure where to put it - suggestions are welcome.

I've added a --short flag that doesn't do anything yet. The intention is like git status to have a short-format

All output is relative to the directory.

Output from pijul status during development of the command:

$ pwd
/home/t/pijul/pijul/pijul/src
$ cat ../../.ignore    # In root, /home/t/pijul/pijul
*~
*.rlib
pijul/target
$ pijul status
On branch add-status

Changes not yet recorded:
  (Use "pijul record ..." to record a new patch)

        modified: main.rs
        modified: commands/mod.rs
        modified: ../Cargo.toml
        modified: ../Cargo.lock

Untracked files:
  (Use "pijul add <file>..." to track them)

        commands/status.rs

Adding the new file:

$ pijul add commands/status.rs
$ pijul status
On branch add-status

Changes not yet recorded:
  (Use "pijul record ..." to record a new patch)

        modified: main.rs
        modified: commands/mod.rs
        modified: ../Cargo.toml
        modified: ../Cargo.lock
        new file: commands/status.rs

Then recording:

$ pijul record -a -m "Add a 'status' command"
$ pijul status
On branch add-status
lthms commented on May 31, 2017

Thanks a lot for that!

lthms commented on May 31, 2017

Can you please update the CHANGELOG accordingly?

FlorentBecker commented on June 1, 2017

That's great. I'm merging this, the next steps would be:

  • figure out what to do with moved files (maybe by taking a look at libpijul::output)
  • polish (--short, ignoring files)
laumann commented on June 1, 2017

Thanks!

Some polishing things

  • Make --short work
  • Move the relativize() function into its own utility module?
  • Display moved files
  • Add .pijul/local/ignore

Anything else?

FlorentBecker commented on June 1, 2017

Nothing urgent that I think of. Maybe ask on discourse what people want to see.