Arch::Changeset(3pm)

πŸ“¦ version 0.5.2, in ubuntu jammy

✨ Arch::Changeset ✨

okay bestie, so this is the manual page for Arch::Changeset β€” the Perl class that's literally the whole changeset concept from Arch, all wrapped up in one cute little object with some genuinely useful methods. it lives in the User Contributed Perl Documentation section, and we're gonna go through every single bit of it together. no skipping. πŸ’–


🌸 NAME 🌸

Arch::Changeset β€” a class representing an Arch changeset. that's it, that's the vibe. she's a changeset, she's an object, she's iconic. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

so like, you can make Arch::Changeset objects directly if you already have a changeset directory sitting there. like this:

use Arch::Changeset;
my $changeset = Arch::Changeset->new(
    'migo@homemail.com--Perl-GPL/arch-perl--devel--0--patch-6',
    '/tmp/,,changeset-6',
);

but tbh usually they just get created indirectly by other objects, which is way more the norm:

use Arch::Session;
$changeset = Arch::Session->new->get_revision_changeset(
    'migo@homemail.com--Perl-GPL/arch-perl--devel--0--patch-6'
);

use Arch::Library;
$changeset = Arch::Library->new->get_revision_changeset(
    'migo@homemail.com--Perl-GPL/arch-perl--devel--0--patch-6'
);

print scalar $changeset->get_patch("perllib/Arch/Changeset.pm");

my $diff_file = ($changeset->get_patch("README", 1))[2];
print Arch::Util::load_file($diff_file);

see how easy that is? the indirect route is giving effortless. ✨


πŸŽ€ DESCRIPTION πŸŽ€

so this class represents the changeset concept in Arch, and it hands you a bunch of genuinely useful methods to play with. that's the whole deal. lowkey elegant, ngl. πŸ’…


πŸ‘‘ METHODS πŸ‘‘

the following methods are available:

  • new
  • get_patch
  • get_index
  • get_changes
  • get_all_diffs
  • join_all_diffs
  • ancestor

πŸ’– new revision-spec dir-name

constructs the Arch::Changeset object that goes with the given fully-qualified revision-spec and the existing directory dir-name. so you bring the revision spec, you bring the dir, she does the rest. 🫢


πŸ’– get_patch file-path

πŸ’– get_patch file-path type

πŸ’– get_patch file-path type full-file-asis

returns the patch (or, y'know, whatever other content) of the given file-path inside the changeset.

type is an integer, and here's the tea:

  • 0 β€” unknown, try to autodetect. this one is the default.
  • 1 β€” modified file, or a metadata change.
  • 2 β€” new file.
  • 3 β€” removed file.

the default behaviour is to create a fake diff against /dev/null for non-binary new and removed files. but the full-file-asis flag, if you set it to true, changes that whole situation and causes it to return the content of such a file as-is. binary new and removed files are always returned as-is regardless of that flag, no cap. also, this flag is just plain ignored if type is 1. sorry bestie, that's the rules. πŸ™ˆ

in the scalar content it returns the patch in diff(1) format (or the whole file content, as described above). in the list content it returns 4 scalars:

  1. the patch
  2. the file name on the disk containing this patch (or the whole file)
  3. the change type β€” that is "patch", "new" or "removed"
  4. the as-is flag

the returned values that come after the first one (the patch/file content) share the order of the corresponding parameters. the parameters are more like hints, while the returned values accurately describe the content. so like, trust the return values, they're the main character here. πŸ’…


πŸ’– get_index name

returns the content of the index file name as an ID => path hash. so basically a little lookup table, slay.

valid names are:

  • 'orig-dirs-index'
  • 'orig-files-index'
  • 'mod-dirs-index'
  • 'mod-files-index'

πŸ’– get_changes

returns a list of changes in the changeset. that's it. she's giving you the list. ✨


πŸ’– get_all_diffs

returns all diffs in the changeset (as an array or an arrayref). this includes changes of types MODIFY, ADD and DELETE. so every kind of change, all up in there. πŸ”₯


πŸ’– join_all_diffs

returns the concatenated output of all diffs in the changeset. like, all of them, glued together into one big string. it's giving compilation. 🌈


πŸ’– ancestor

returns the ancestor of the changeset. if a =ancestor file is found β€” which is the case for library changesets, iykyk β€” its content is returned. otherwise it tries to guess the ancestor of the revision using Arch::Util::adjacent_revision. detective work, but make it Perl. πŸ•΅οΈβ€β™€οΈ


πŸ’€ BUGS πŸ’€

Awaiting for your reports.

(yes bestie, that's literally all it says. they're just sitting there, waiting, manifesting your bug reports. go off.) πŸ“


🧚 AUTHORS 🧚

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).


⭐ SEE ALSO ⭐

for more information, see tla, Arch::Session, Arch::Library, Arch::Util.


and that's the whole page, bestie! πŸŽ€ this one's perl v5.20.2, dated 2006-04-15 β€” so yeah, she's a vintage icon and she's still serving. periodt. πŸ’œ

πŸ“¦ where this page comes from