Melihat Perbedaan

One of the commonest requirements in project development is to see what has changed. You might want to look at the differences between two revisions of the same file, or the differences between two separate files. TortoiseSVN provides a built-in tool named TortoiseMerge for viewing differences of text files. For viewing differences of image files, TortoiseSVN also has a tool named TortoiseIDiff. Of course, you can use your own favourite diff program if you like.

Perbedaan File

Perubahan lokal

Jika Anda ingin melihat apa yang telah Anda ubah dalam copy pekerjaan Anda, cukup gunakan menu konteks explorer dan pilih TortoiseSVNDiff.

Perbedaan ke cabang/tag lain

Jika Anda ingin melihat apa yang berubah pada trunk (jika Anda bekerja pada cabang) atau pada cabang tertentu (jika Anda bekerja pada trunk), Anda bisa menggunakan menu konteks explorer. Tekan tombol Shift sementara Anda mengklik pada file. Lalu pilih TortoiseSVNDiff dengan URL. Dalam dialog berikut, tetapkan URL dalam repositori dengan file lokal yang Anda ingin bandingkan.

Anda juga bisa menggunakan browser repositori dan memilih dua susunan untuk diff, mungkin dua tag, atau cabang/tag dan trunk. Menu konteks disana membolehkan Anda untuk membandingkannya menggunakan Bandingkan revisi. Baca selengkapnya dalam bagian bernama “Membandingkan Folder”.

Perbedaan dari revisi sebelumnya

Jika Anda ingin melihat perbedaan antara revisi tertentu dan copy pekerjaan Anda, gunakan dialog Log Revisi, pilih revisi yang menarik, lalu pilih Bandingkan dengan copy pekerjaan dari menu konteks.

If you want to see the difference between the last committed revision and your working copy, assuming that the working copy hasn't been modified, just right click on the file. Then select TortoiseSVNDiff with previous version. This will perform a diff between the revision before the last-commit-date (as recorded in your working copy) and the working BASE. This shows you the last change made to that file to bring it to the state you now see in your working copy. It will not show changes newer than your working copy.

Perbedaan antara dua revisi sebelumnya

Jika Anda ingin melihat perbedaan antara dua revisi yang sudah dikomit, gunakan dialog Log Revisi dan pilih dua revisi yang Anda inginkan untuk dibandingkan (menggunakan Ctrl-modifier biasa). Lalu pilih Bandingkan revisi dari menu konteks.

Jika Anda melakukan ini dari log revisi untuk folder, dialog Bandingkan Revisi muncul, menampilkan daftar file yang diubah dalam folder itu. Baca selengkapnya dalam bagian bernama “Membandingkan Folder”.

Semua perubahan yang dibuat dalam komit

Jika Anda ingin melihat perubahan yang dibuat terhadap semua file dalam revisi tertentu dalam satu tampilan, Anda bisa menggunakan output Unified-Diff (GNU patch format). Ini hanya menampilkan perbedaan dengan beberapa baris dari konteks. Ini agak sulit untuk dibaca daripada pembandingan file visual, tapi akan menampilkan semua perubahan bersamaan. Dari dialog Log Revisi pilih revisi yang menarik, lalu pilih Tampilkan Perbedaan sebagai Unified-Diff dari menu konteks.

Perbedaan di antara beberapa file

Jika Anda ingin melihat perbedaan diantara dua file berbeda, Anda bisa melakukan itu secara langsung dalam explorer dengan memilih kedua file (menggunakan Ctrl-modifier biasa). Lalu dari menu konteks explorer pilih TortoiseSVNDiff.

If the files to compare are not located in the same folder, use the command TortoiseSVNDiff later to mark the first file for diffing, then browse to the second file and use TortoiseSVNDiff with "path/of/marked/file". To remove the marked file, use the command TortoiseSVNDiff later again, but hold down the Ctrl-modifier while clicking on it.

Perbedaan antara WC file/folder dan URL

If you want to see the differences between a file in your working copy, and a file in any Subversion repository, you can do that directly in explorer by selecting the file then holding down the Shift key whilst right clicking to obtain the context menu. Select TortoiseSVNDiff with URL. You can do the same thing for a working copy folder. TortoiseMerge shows these differences in the same way as it shows a patch file - a list of changed files which you can view one at a time.

Perbedaan dengan informasi blame

Jika Anda ingin melihat tidak hanya perbedaan tapi juga pembuat, revisi dan tanggal perubahan dibuat, Anda bisa menggabungkan diff dan laporan blame dari dalam dialog log revisi. Baca selengkapnya bagian bernama “Blame Perbedaan”.

Perbedaan antara beberapa folder

The built-in tools supplied with TortoiseSVN do not support viewing differences between directory hierarchies. But if you have an external tool which does support that feature, you can use that instead. In bagian bernama “Eksternal Diff/Merge Tools” we tell you about some tools which we have used.

If you have configured a third party diff tool, you can use Shift when selecting the Diff command to use the alternate tool. Read bagian bernama “Seting Program Eksternal” to find out about configuring other diff tools.

Line-end and Whitespace Options

Sometimes in the life of a project you might change the line endings from CRLF to LF, or you may change the indentation of a section. Unfortunately this will mark a large number of lines as changed, even though there is no change to the meaning of the code. The options here will help to manage these changes when it comes to comparing and applying differences. You will see these settings in the Merge and Blame dialogs, as well as in the settings for TortoiseMerge.

Ignore line endings excludes changes which are due solely to difference in line-end style.

Compare whitespaces includes all changes in indentation and inline whitespace as added/removed lines.

Ignore whitespace changes excludes changes which are due solely to a change in the amount or type of whitespace, e.g. changing the indentation or changing tabs to spaces. Adding whitespace where there was none before, or removing a whitespace completely is still shown as a change.

Ignore all whitespaces excludes all whitespace-only changes.

Naturally, any line with changed content is always included in the diff.

Membandingkan Folder

Gambar 4.29. Dialog Pembandingan Revisi-Revisi

Dialog Pembandingan Revisi-Revisi


Ketika Anda memilih dua susunan dalam browser repositori, atau ketika Anda memilih dua revisi dari sebuah folder dalam dialog, Anda bisa Menu konteksBandingkan revisi.

Dialog ini memperlihatkan daftar dari semua file yang sudah diubah dan membolehkan Anda untuk membandingkan atau blame secara individu menggunakan menu konteks.

You can export a change tree, which is useful if you need to send someone else your project tree structure, but containing only the files which have changed. This operation works on the selected files only, so you need to select the files of interest - usually that means all of them - and then Context menuExport selection to.... You will be prompted for a location to save the change tree.

You can also export the list of changed files to a text file using Context menuSave list of selected files to....

If you want to export the list of files and the actions (modified, added, deleted) as well, you can do that using Context menuCopy selection to clipboard.

Tombol di atas membolehkan Anda untuk mengubah arah dari perbandingan. Anda bisa menampilkan perubahan yang diperlukan dari A ke B, atau jika diinginkan, dari B ke A.

Tombol-tombol yang berisi nomor revisi dapat digunakan untuk mengubah suatu rentang revisi yang berbeda. Jika Anda memilih rentang tersebut, daftar hal-hal yang berbeda diantara kedua revisi akan dimutahirkan secara otomatis.

If the list of filenames is very long, you can use the search box to reduce the list to filenames containing specific text. Note that a simple text search is used, so if you want to restrict the list to C source files you should enter .c rather than *.c.

Melakukan Diff Gambar Menggunakan TortoiseIDiff

Ada banyak piranti tersedia untuk melakukan diff file teks, termasuk TortoiseMerge itu sendiri, tapi kami sering menemukan keinginan untuk melihat bagaimana file gambar diubah juga. Itulah mengapa kami membuat TortoiseIDiff.

Gambar 4.30. Peninjau perbedaan gambar

Peninjau perbedaan gambar


TortoiseSVNDiff for any of the common image file formats will start TortoiseIDiff to show image differences. By default the images are displayed side-by-side but you can use the View menu or toolbar to switch to a top-bottom view instead, or if you prefer, you can overlay the images and pretend you are using a lightbox.

Naturally you can also zoom in and out and pan around the image. You can also pan the image simply by left-dragging it. If you select the Link images together option, then the pan controls (scrollbars, mousewheel) on both images are linked.

An image info box shows details about the image file, such as the size in pixels, resolution and colour depth. If this box gets in the way, use ViewImage Info to hide it. You can get the same information in a tooltip if you hover the mouse over the image title bar.

When the images are overlaid, the relative intensity of the images (alpha blend) is controlled by a slider control at the left side. You can click anywhere in the slider to set the blend directly, or you can drag the slider to change the blend interactively. Ctrl+Shift-Wheel to change the blend.

The button above the slider toggles between 0% and 100% blends, and if you double click the button, the blend toggles automatically every second until you click the button again. This can be useful when looking for multiple small changes.

Sometimes you want to see a difference rather than a blend. You might have the image files for two revisions of a printed circuit board and want to see which tracks have changed. If you disable alpha blend mode, the difference will be shown as an XOR of the pixel colour values. Unchanged areas will be plain white and changes will be coloured.

Diffing Office Documents

When you want to diff non-text documents you normally have to use the software used to create the document as it understands the file format. For the commonly used Microsoft Office and Open Office suites there is indeed some support for viewing differences and TortoiseSVN includes scripts to invoke these with the right settings when you diff files with the well-known file extensions. You can check which file extensions are supported and add your own by going to TortoiseSVNSettings and clicking Advanced in the External Programs section.

Problems with Office 2010

If you installed the Click-to-Run version of Office 2010 and you try to diff documents you may get an error message from Windows Script Host something like this: ActiveX component can't create object: word.Application. It seems you have to use the MSI-based version of Office to get the diff functionality.

Eksternal Diff/Merge Tools

Jika piranti yang kami sediakan tidak mencukupi Anda, coba salah satu dari banyak sumber-terbuka atau program komersil yang tersedia. Setiap orang mempunyai favorit sendiri, dan daftar ini tidak berarti lengkap, tapi ini adalah beberapa yang bisa Anda pertimbangkan:

WinMerge

WinMerge is a great open-source diff tool which can also handle directories.

Perforce Merge

Perforce is a commercial RCS, but you can download the diff/merge tool for free. Get more information from Perforce.

KDiff3

KDiff3 adalah piranti diff gratis yang juga bisa menangani direktori. Anda bisa mendownloadnya dari disini.

SourceGear DiffMerge

SourceGear Vault is a commercial RCS, but you can download the diff/merge tool for free. Get more information from SourceGear.

ExamDiff

ExamDiff Standard adalah gratis. Ia bisa menangani file tapi tidak pada direktori. ExamDiff Pro adalah shareware dan menambah jumlah perangkatnya termasuk diff direktori dan kemampuan pengeditan. Dalam kedua selera, versi 3.2 dan diatasnya bisa menangani unicode. Anda bisa mendownloadnya dari PrestoSoft.

Beyond Compare

Similar to ExamDiff Pro, this is an excellent shareware diff tool which can handle directory diffs and unicode. Download it from Scooter Software.

Araxis Merge

Araxis Merge is a useful commercial tool for diff and merging both files and folders. It does three-way comparison in merges and has synchronization links to use if you've changed the order of functions. Download it from Araxis.

Baca bagian bernama “Seting Program Eksternal” untuk informasi bagaimana menyiapkan TortoiseSVN menggunakan piranti ini.