I'm using clearcare as command line. I want to compare a checked out file with predecessor. I use the command :
ct diff -graphical -predecessor $file
But the diff is done with xcompare. Is there a way to use bcompare instead ?
You can check first if "How do I integrate Beyond Compare with ClearCase?" that I wrote in 2010 can help.
Beyond Compare itself has an official page, but it might not work in an Unix environment.
Related
I am relatively new to bourne scripting (running on Solaris), and I am struggling with this simple problem for some reason. I am creating a script that will run in a directory, and will try to delete the files older than a certain date.
The files are of the form: log.DOY, so for example log.364, log.365, log.001, etc.
Now this would be easy if it wasn't for the pesky rollover, especially with it not always being 365 as a max (leap years).
I have debated using find -mtime, but it would be preferable to use the file extension if possible.
Do any of you scripting magicians have any suggestions?
Your choice of find with -mtime is close, but there is a potentially easier way. You say you would like to remove files older than the date of some measuring file (say all files older than log.287 -- including log.287).
find provides the -newer option that will do just that. The following is a short script that takes the measuring filename as its first argument and will print here (but you can include delete on you own) all files in that directory (non-recursively with the -maxdepth 1 option). The printf operation is provided for testing to insure there are no "OOPs" accidents. Let me know if you have questions:
#!/bin/sh
find . -maxdepth 1 -type f ! -newer "$1" |
while read filenm; do
printf "%s\n" "$filenm" ## you can add rm to remove the file
done
Note: check your version of read. The POSIX compliant use is shown above, but if you have the -r option, I would suggest its use as well.
I don't have Solaris handy to check, but I don't think this is practical purely in shell script unless you happen to have non-standard CLI tools available (such as GNU Coreutils).
Specifically, figuring out the end-of-year wrap depends on knowing what day of the year it is right now, and I don't see a way to do that in the documentation I can find. (It can be done in GNU date using +%j as the format.)
However, the docs do say that you should have perl, so I would look to use that.
I know that I can use the diffbl command to compare two baselines. But how can I also ask the command to print out the diffs of all the files that were different?
Is this even possible or do I need to write a script or something? Any pointers?
The closest you can get with cleartool alone is cleartool diffbl -ver
For each version, you can make a cleartool diff -dif -pred <aversion> in order to print the actual diff (using the -dif format, where differences are reported in the style of the UNIX and Linux diff utility)
As mentioned in the comments, the diff -pred only prints the diff introduced by a specific version.
The concatenation of all those diffs represents all the modifications introduced by the new baseline compared to the old one.
In other word, that concatenation of diffs represents "print out the diffs of all the files that were different". What was originally asked for.
I've been playing around with git and hg lately and then suddenly it occurred to me that this kind of thing will be great for documents.
I've a document which I edit in DOCX and export as PDF. I tried using both git and hg to version control it and turns out with hg you end up tracking only binary and diff-ing isn't meaningful. Although with git I can meaningfully diff DOCX (haven't tried on PDF yet) I was wondering if there is a better way to do it than I'm doing it right now. (Ideally, not having to leave Word to diff will be the best solution.)
There are two different concepts here - one is "can the version control system make some intelligent judgements about the contents of files?" - so that it can store just delta information between revisions (and do things like assign responsibility to individual parts of a file).
The other is 'do I have a file comparison tool which is useful for the types of files I have in the version control system'. Version control systems tend to come with file comparison tools which are inferior to dedicated alternatives. But they can pretty much always be linked to better diff programs - either for all file types or specific ones.
So it's common to use, for example, Beyond Compare as a general compare tool, with Word as a dedicated Word document comparer.
Different version control systems differ as to how good people perceive them to be at handling 'binaries', but that's often as much to do with handling huge files and providing exclusive locking as it is to do with file comparison.
http://tortoisehg.bitbucket.io/ includes a plugin called docdiff that integrates Word and Excel diff'ing.
You can use Beyond Compare as external diff tool for hg. Add to/change your user mercurial.ini as:
[extdiff]
cmd.vdiff = c:/path/to/BCompare.exe
Then get Beyond Compare file viewer rule for docx.
Now you should be able to compare two versions of docx in Beyond Compare.
This article outlines the solution for Docx using Pandoc
While this post outlines solution for PDF using pdf2html.
Only for docx, I compiled instructions for multiple places here: https://gist.github.com/nachocab/6429893
# download docx2txt by Sandeep Kumar
wget -O docx2txt.pl http://www.cs.indiana.edu/~kinzler/home/binp/docx2txt
# make a wrapper
echo '#!/bin/bash
docx2txt.pl $1 -' > docx2txt
chmod +x docx2txt
# make sure docx2txt.pl and docx2txt are your current PATH. Here's a guide
http://shapeshed.com/using_custom_shell_scripts_on_osx_or_linux/
mv docx2txt docx2txt.pl ~/bin/
# set .gitattributes (unfortunately I don't this can't be set by default, you have to create it for every project)
echo "*.docx diff=word" > .git/info/attributes
# add the following to ~/.gitconfig
[diff "word"]
binary = true
textconv = docx2txt
# add a new alias
[alias]
wdiff = diff --color-words
# try it
git init
# create my_file.docx, add some content
git add my_file.docx
git commit -m "Initial commit"
# change something in my_file.docx
git wdiff my_file.docx
# awesome!
It works great on OSX
If you happen to use a Mac, I wrote a git merge driver that can use Microsoft Word and tracked changes to merge and show conflicts between any file types Word can read & write.
http://github.com/jasmas/wordMerge
I say 'if you happen to use a Mac' because the driver I wrote uses AppleScript, primarily to accomplish this task.
It'd be nice to add a vbscript version to the project, but at the moment I don't have a Windows environment for testing. Anyone with some basic scripting knowledge should be able to take a look at what I'm doing and duplicate it in vbscript, powershell or whatever on Windows.
I used SVN (yes, in 2020 :-)) with TortoiseSVN on Windows. It has a built-in function to compare DOCX files (it opens Microsoft Word in a mode where your screen is divided into four parts: the file after the changes, before the changes, with changes highlighted and a list of changes). Screenshot below (sorry for the Polish version of MS Word). I also checked TortoiseGIT and it also has this functionality. I've read that TortoiseHG has it as well.
Normally, 'diff' tool finds only changes between lines. For example, if i compare 'abcdef' and 'AbcdEf', diff will show that 'abcde' is changed and 'f' is unchanged. Is it possible to find multiple changes per line, so in example above i will see that it's only 'a' changed to 'A' and 'e' changed to 'E'? Or diff outut format does not support such?
There are multiple diff tools that will do what you're asking for.
Off the top of my head I know Winmerge and TortoiseMerge does that.
I recommend KDiff3 which highlights with different colours changes on the same line.
I wrote a tool to diff web code regardless of differences from comments and whitespace. This means my tool can diff a completely minified file against a similar beautified file. It is written entirely in JavaScript so you try it directly in your browser without downloading or installing anything. This does highlight differences per line and highlights differences per characters on those lines.
http://prettydiff.com/
I need to merge a forked project.
Unfortunately, the CVS $Id lines are different so the merge tools I tried report that all the files are different (and 95% of them have only this line different)
Is there a merge tool that can be configured to ignore line comparison results based on a pattern ?
[edit]
I discovered that WinMerge has line filters - setting up them correctly actually works.
Francesco
I use meld, which can use regex filters to ignore.
It has some preset ones you can select including CVS keywords.
The regex it uses for that BTW is:
\$\w+(:[^\n$]+)?\$
You can get meld on any linux distro or
download from here: http://meld.sourceforge.net/
I'm not sure how it's supported on windos,
but I do know kdiff3 supports windows so you could
give it a try there: http://kdiff3.sourceforge.net/
well you could use
cvs update -kk
whick does not expand the $words.
of course this is still a problems the $log which is expanded on commits and not updates.
CompareIT allow to use regular expression matching. I used it for automatically generated code comparison and it was very useful.