#910388 please allow to use "external viewers" for n-way diffs

Package:
dirdiff
Source:
dirdiff
Description:
Display and merge changes between two directory trees
Submitter:
Tomas Pospisek
Date:
2022-06-04 15:06:05 UTC
Severity:
wishlist
Tags:
#910388#5
Date:
2018-10-05 19:13:48 UTC
From:
To:
It'd be nice if it'd be possible to also view n-way diffs in external
viewers (here: in vimdiff). That's just what the attached patch does:
if set then the configured external viewer is also used for n-way diffs.

There's one aspect of this patch, that's a bit ugly: the patch is pretty
much an exact copy of the code of the "proc diff2" code part, that calls
the external viewer.

This results in the params given to the external viewer being a bit
"weird". Namely what the external viewer gets as parameters is:

    dir1 dir2 dir3 ... file_path

That means that the external viewer needs to check the number of
parameters and if there's more than two, then it needs to construct the
filepaths like this:

    dir1/file_path dir2/file_path dir3/file_path ...

I've implemented a wrapper for vimdiff that does that. It's using
`konsole` as a terminal, but that can be changed easily:

    $ cat ~/bin/dirdiff_vimdiff
    #!/bin/bash
    #
    if [ $# -gt 2 ]; then
            # dirdiff calls us with parameters:
            #
            #    dir1 dir2 dir3 ... file_name_to_diff

            # the file is the last parameter given
            file_to_diff="${@:$#:1}"

            # iterate over all parameters and construct
            # the full_path=dir+file_to_diff
            for i in $(seq 0 $(( $# - 1))); do
                    j=$(( $i + 1 ))
                    full_paths[$i]="${@:$j:1}/$file_to_diff"
            done

            # delete last element, since that's the file
            # itself:
            unset 'full_paths[-1]'

            konsole --workdir `pwd` -e vimdiff "${full_paths[@]}"
    else
            konsole --workdir `pwd` -e vimdiff "$1" "$2"
    fi

Alternatively the patch could be changed to do the path construction
inside dirdiff before calling the external program. I'll leave that
as a challenge ;-)

Thanks,
*t

#910388#10
Date:
2022-06-01 12:18:05 UTC
From:
To:
Hi!

I decided to adopt this package that has been very useful to me in my packaging.

Taking advantage of it, I'm already applying the patch.

Thank you Tomas Pospisek for contributing to this tool.

Nilson F. Silva

#910388#15
Date:
2022-06-04 15:03:55 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
dirdiff, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 910388@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com> (supplier of updated dirdiff package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 02 Jun 2022 21:03:17 -0300
Source: dirdiff
Architecture: source
Version: 2.1-9
Distribution: unstable
Urgency: medium
Maintainer: Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>
Changed-By: Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>
Closes: 910388 1008029
Changes:
 dirdiff (2.1-9) unstable; urgency=medium
 .
   * New Maintainer. (Closes: #1008029)
   * debian/control:
       - Updated Maintainer field with my name and email.
   * dedian/copyright:
       - Include name new maintainer Josensilson Ferreira da Silva.
   * debian/patches:
       - Created 011_dirdiff_vimdiff.patch.
         Makes it possible to see on-way diffs in external
         viewers(vimdiff). If set, the configured external
         viewer is also  used for n-way differences. Thanks
         Tomas Pospisek <tpo_deb@sourcepole.ch>. (Closes: #910388)
Checksums-Sha1:
 a1f44fbef673ffa963f3e03bccdfce4ef67d5b43 1727 dirdiff_2.1-9.dsc
 c8e70499e9ece4417e354dcce3bf9758c97d3edf 9168 dirdiff_2.1-9.debian.tar.xz
 6cb27d0c7add1a935a80f2933abc22c08332e601 7078 dirdiff_2.1-9_source.buildinfo
Checksums-Sha256:
 98883bfa321ec325444325cd4cc76c5ee361b6f257afdc2c447b08e2f948e5c3 1727 dirdiff_2.1-9.dsc
 97e3bc2289f4080651419909c30468282e28f71901b3716ff91a4086886fd9d4 9168 dirdiff_2.1-9.debian.tar.xz
 c913fd761d67f4f48308ae849e02652ceb8699b42bd80a16be2ce57c4227f282 7078 dirdiff_2.1-9_source.buildinfo
Files:
 8a7f29514fb5517113491e7939b36b6c 1727 utils optional dirdiff_2.1-9.dsc
 6298bca258d39c2346904579778d2e56 9168 utils optional dirdiff_2.1-9.debian.tar.xz
 caca614ab43249859c9ac5f787ef97df 7078 utils optional dirdiff_2.1-9_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEQGIgyLhVKAI3jM5BH1x6i0VWQxQFAmKbcncQHGJhZ2VAZGVi
aWFuLm9yZwAKCRAfXHqLRVZDFDwrC/4wYPGY9r4DIwIvmfATEYsnKBDAsJioZVF4
jFMaiJWKLOAACnB6XcId3TeGwWpI0wY929E04MtnxKqt2UWC40QdKF6qLS6fDilG
6yNFf93vb3dF3tQFQP/ueQ351ce9k3U88xpmUGgIuyyjGcobmZtlIdo42GBkiyCU
ALEB+ZCuhQXzBmi04kOsffZ6DmTA74p/00Wr7BrVyis0xC2LZDtr42RbDA2lF6Sh
cE039iVqfj0Utj6BzpjwGy7hqGHQNxTuftymroe3Zk/3l3Et5BHISpweh3ZrGutK
cmfbTZ2i49/0RqF2o+PBGPHY1OSv6HqYz/t1h0bW6nFliZYz0TwuYXLpeil1pTra
gJCEdrO1veYahOId4pqfsNijDjd/JnpAd+5p4hZej2XKPZOS6nMS0wR+He/MIiiO
bYsFzz3U6QiQBqgs4lnG8Ns5kN3ZHJlPdvFzkzzBngNd6YU+5OMsua1Qjj/75e+I
VVksuu3szQz0XAYzRsMfTyMPe0SGPco=
=+Iz4
-----END PGP SIGNATURE-----