View Full Version : comparing two source code branches
ravikumar_bs
05-Feb-2009, 12:33 AM
Hi All,
I'm using beyond compare tool in Linux platform to compare source code differences between two branches. My objective is to find out how many lines of code is added, deleted and modified between two branches.
Currently am running a script to find out these details. The issue is my source code directories includes few *.lib, *.exe, *.dll files. I want to exclude these unwanted files while doing comparison. Is there any way to specify only the required file types in script?
Below is my script to compare source code in two branches.
##########################
load "/builds/branch1" "/builds/branch2"
Expand All
select all
file-report layout:statistics options:ignore-unimportant output-to:"/builds/results.txt"
##########################
I'm not interested in deleting these *.lib, *.exe, *.dll files from my work area before running the script. Kindly help me.
Thanks,
Ravi
Chris
05-Feb-2009, 01:34 PM
Use the filter command to limit the comparison to specified file types, this example will only compare files with .c or .h extensions:
filter "*.c;*.h"
load "/builds/branch1" "/builds/branch2"
Expand All
select all.files
file-report layout:statistics options:ignore-unimportant output-to:"/builds/results.txt"
You can also exclude file types using a filter. This example will compare all files except those with .exe, .dll, or .lib extensions:
filter "-*.exe;-*.dll;-*.lib"
load "/builds/branch1" "/builds/branch2"
Expand All
select all.files
file-report layout:statistics options:ignore-unimportant output-to:"/builds/results.txt"
ravikumar_bs
06-Feb-2009, 01:10 AM
Thanks a lot for the quick solution.
ravikumar_bs
18-Feb-2009, 06:28 AM
Use the filter command to limit the comparison to specified file types, this example will only compare files with .c or .h extensions:
filter "*.c;*.h"
load "/builds/branch1" "/builds/branch2"
Expand All
select all.files
file-report layout:statistics options:ignore-unimportant output-to:"/builds/results.txt"
You can also exclude file types using a filter. This example will compare all files except those with .exe, .dll, or .lib extensions:
filter "-*.exe;-*.dll;-*.lib"
load "/builds/branch1" "/builds/branch2"
Expand All
select all.files
file-report layout:statistics options:ignore-unimportant output-to:"/builds/results.txt"
Hi Chris,
Thanks a lot for the response..
Now i could able to filter out the file types which is not needed for me. But am unable to filter out .svn directory.
I tried same thing in windows its working properly. But on linux machine i couldn't able to skip .svn files during comparion.
Below is the script which am using it on linux as well as windows machine.
load "/mnt/dirtech-cm/var/ccm_wa/idc_n4u/Source_SP4_FCS/SAL" "/mnt/dirtech-cm/var/ccm_wa/idc_n4u/Source_SP5_FCS/SAL*"
Expand All
select all
filter "-*.lib;-*.dll;-*.dlm;-*.exe;-*.nlm;-*.txt;-.svn\"
file-report layout:statistics options:ignore-unimportant output-to:"/builds/SVN_WORK_AREA/eDirectory/SAL_edir_loc.txt"
Kindly help in solving this issue on Linux machine.
Thanks,
Ravi
Chris
18-Feb-2009, 12:22 PM
In the current Linux version, 3.0.15, folder filters need to use a forward slash (/) instead of a back slash (\).
filter "-*.lib;-*.dll;-*.dlm;-*.exe;-*.nlm;-*.txt;-.svn/"
load "/mnt/dirtech-cm/var/ccm_wa/idc_n4u/Source_SP4_FCS/SAL" "/mnt/dirtech-cm/var/ccm_wa/idc_n4u/Source_SP5_FCS/SAL*"
Expand All
select all
file-report layout:statistics options:ignore-unimportant output-to:"/builds/SVN_WORK_AREA/eDirectory/SAL_edir_loc.txt"
I'll add supporting / and \ when specifying folder filters on Linux to our list for a future release.
Chris
18-Feb-2009, 12:30 PM
Update. After talking to Craig about this, Linux supports \ as part of a filename, so we won't support it for specifying a folder filter. Linux folder filters will always need to use / to identify the filter.
ravikumar_bs
18-Feb-2009, 09:31 PM
Its working fine. Thanks once again!
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.