The sound distributed version control system

#21 `pijul status` subcommand

Closed on November 21, 2020
cole-h on November 9, 2020

It would be a great addition to be able to see the status of the working tree akin to git status. I don’t know if all of the same concepts will transfer (e.g. untracked files), but I’d like to see the files that have been changed without needing to actually see the changes.

pmeunier on November 9, 2020

pijul diff does a bit of that.

fabian added a change on November 9, 2020
This change could not be retrieved at the moment
S2OKPMVWVXXJ4J2VX4Y5TL7WN2JQO3FHRC7OWGP32YJ4X45B4BXAC
fabian on November 10, 2020

A short addition of diff --short that is sort of like git status and for a darcs like approach of aliasing pijul status to pijul diff --short. Has some issues like:

  • move not showing from where it is being moved
  • ineficient implementation
  • A [file] might be an untracked or tracked file.
pmeunier on November 15, 2020

@fabian: I’m really interested in this change, but unfortunately, I couldn’t convert it to the new change format. Would you mind recording and pushing it again with Pijul >= 1.0.0-alpha.1?

Thanks a million, and sorry again for the confusion.

fabian on November 15, 2020

Yeah, will try to replicate it on this new version as soon as possible.

In the meantime this was the patch on the old format:

message = 'Add `diff --short` that lists changes without showing them'
timestamp = '2020-11-09T22:09:28.370335728Z'

[[authors]]
name = 'fabian'
full_name = 'Fabián Heredia Montiel'

# Dependencies
[2] Y67GBRYQ6WCAKFJKZJYNCSON7AMN2KRH5T745MQ3OMZCUA2SM5UAC

# Changes

1. Edit in pijul/src/commands/diff.rs:16 2.910327
  up 2.910730, new 0:49, down 2.910730
+     #[clap(long = "short")]
+     pub short: bool,

2. Edit in pijul/src/commands/diff.rs:85 2.910327
  up 2.913311, new 50:1633, down 2.913311
+         } else if self.short {
+             let mut changes = Vec::new();
+             for ch in change.changes.iter() {
+                 changes.push(match ch {
+                     Record::FileMove { path, .. } =>
+                         format!("MV {}\n", path),
+                     Record::FileDel { path, .. } =>
+                         format!("D  {}\n", path),
+                     Record::FileUndel { path, .. } =>
+                         format!("UD {}\n", path),
+                     Record::FileAdd { path, .. } =>
+                         format!("A  {}", path),
+                     Record::SolveNameConflict { path, .. } =>
+                         format!("SC {}", path),
+                     Record::UnsolveNameConflict { path, .. } =>
+                         format!("UC {}", path),
+                     Record::Edit { local: Local { path, .. }, .. } =>
+                         format!("M  {}", path),
+                     Record::Replacement { local: Local { path, .. }, .. } =>
+                         format!("R  {}", path),
+                     Record::SolveOrderConflict { local: Local { path, .. }, .. } =>
+                         format!("SC {}", path),
+                     Record::UnsolveOrderConflict { local: Local { path, .. }, .. } =>
+                         format!("UC {}", path),
+                     Record::ResurrectZombies { local: Local { path, .. }, .. } =>
+                         format!("RZ {}", path),
+                 });
+             }
+             changes.sort_unstable();
+             changes.dedup();
+             for ch in changes { println!("{}", ch); }

3. Edit in libpijul/src/working_copy/filesystem.rs:114 2.10770
  :D, 2.14558 -> 2.14558:14622/2
-                                 eprintln!("Adding {:?}", path);

4. Edit in libpijul/src/working_copy/filesystem.rs:126 2.10770
  :D, 2.15242 -> 2.15242:15298/2
-                         eprintln!("Adding {:?}", path);
cole-h added a change on November 17, 2020
This change could not be retrieved at the moment
XVEWUDNJGUCCWOYQ7VTU2XNCFIORHQFWUH5WLJ2SV2LDZQJCDD4AC
cole-h on November 17, 2020

Just to make it a little easier on you, @fabian, I ported your patch to the new format above. I didn’t remove the Adding {:?} eprintlns, however.

EDIT: In the future, I think it’d be nice to have the moved files show as MV old -> new, but this would require a change in the Record::FileMove enum (e.g. to store that old path)… Related to #40.

pmeunier added a change on November 21, 2020
YDKNUL6B4EFM5U2GG36SSEKXHS6XK4OLIWUVE4BUAJ5VYJFHAOIQC
main
pmeunier on November 21, 2020

Finally, I got to look at this change, and converted it to the new new format. Thanks @fabian!

pmeunier closed this discussion on November 21, 2020