native::Delta(3perl)

πŸ’– NAME πŸ’–

SVN::Delta β€” Subversion delta functions, bestie. that's the whole vibe.


✨ SYNOPSIS ✨

okay so here's the tea, literally copy-paste energy:

require SVN::Core;
require SVN::Repos;
require SVN::Delta;

# driving an editor
my $editor = SVN::Delta::Editor->
    new(SVN::Repos::get_commit_editor($repos, "file://$repospath",
                                      '/', 'root', 'FOO', \&committed));

my $rootbaton = $editor->open_root(0);

my $fbaton = $editor->add_file('filea', $rootbaton,
                               undef, -1);

my $ret = $editor->apply_textdelta($fbaton, undef);
SVN::TxDelta::send_string("FILEA CONTENT", @$ret);

# implement an editor in perl
SVN::Repos::dir_delta($root1, $path, undef,
                      $root2, $path,
                      SVN::Delta::Editor->new(_debug=>1),
                      1, 1, 0, 1

no cap, that's exactly it. πŸ’…


🌸 DESCRIPTION 🌸

so SVN::Delta wraps all the delta-related functions up in subversion, and the main character of the whole thing is SVN::Delta::Editor β€” that's the interface for describing tree deltas. by default, SVN::Delta::Editor just relays every method call to its internal member "_editor", which could either be an editor in C (like the one you get from get_commit_editor) ✨ or literally just another SVN::Delta::Editor object. either way, she's serving.


πŸ¦‹ SVN::Delta::Editor πŸ¦‹

πŸ’« Driving Editors πŸ’«

if you wanna drive a native editor (like commit_editor, the one you get from SVN::Repos::get_commit_editor), you just create a SVN::Delta::Editor object with the native editor/baton pair. then the object is ready to go and its method calls get relayed straight to the native editor. easy. iconic. 🫢

πŸ’œ Implementing Editors πŸ’œ

if you wanna implement an editor, subclass SVN::Delta::Editor and implement the editor's callbacks. go peek at the METHODS section below, bestie. πŸ‘‡

πŸŽ€ CONSTRUCTOR - new(...) πŸŽ€

  • new($editor, $editor_baton) β€” link to the native editor

you can also pass a hash array to new, and here are the keys:

  • _debug β€” turn on debug. πŸ›
  • _editor β€” an arrayref of the editor/baton pair, or another SVN::Delta::Editor object to link with.

⭐ METHODS ⭐

pls consult the svn_delta.h section in the Subversion API, fr fr. member functions of svn_delta_editor_t can be called as methods of SVN::Delta::Editor objects, with the edit_baton omitted. the pool is also optional, she's flexible like that. πŸ’…

if you're subclassing, the methods take exactly the same arguments as the member functions (note that void ** are returned data though, as throughout the perl bindings), with the edit_baton omitted. don't come for me about the void **, that's just how it is.


πŸ’€ BUGS πŸ’€

functions returning editor/baton pair should really be typemapped to a SVN::Delta::Editor object. it's giving unfinished business, ngl. 😭


πŸ‘‘ AUTHORS πŸ‘‘

Chia-liang Kao <clkao@clkao.org> β€” shoutout to the legend. πŸ™Œ


Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

okay that's the whole page bestie, you ate. this was perl v5.40.1, dated 2025-04-06 β€” stay slay, drink water, and go read your docs. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from