Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 7th, 2004, 02:13 PM
blockcipher blockcipher is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2003
Posts: 701 blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 7 h 40 m 21 sec
Reputation Power: 55
Diff tools

Does anyone know of a good resource for learning how a diff tool works?
__________________
blockcipher
---------------
Gratuitously stolen...
mysql> SELECT * FROM user WHERE clue > 0;
0 Results Returned.

PHP5/MySQL/UTF-8
My Tech Blog

Reply With Quote
  #2  
Old July 7th, 2004, 03:26 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,254 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 8 h 10 m 34 sec
Reputation Power: 265
The Python language (http://www.python.org) has a diff module as part of its standard library. The module is implemented in Python so you can read the source and experiment with it. The module provides functions for standard text diffing, but also low-level control to allow you to create more specialised diffs.

Python is an open source dynamically typed language with a very clear, regular syntax. An experienced programmer could learn enough to start programming in a few hours.

Dave - The Developers' Coach

Reply With Quote
  #3  
Old July 8th, 2004, 06:13 PM
dog135's Avatar
dog135 dog135 is offline
Doggie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: Seattle, WA
Posts: 751 dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 10 h 38 m 25 sec
Reputation Power: 7
I wrote one in VB a few years ago. It was pretty easy to figure out.

You start with pointers to each file. The pointers indicate the location of the last match. (they may not be the same, so you need one for each file)

When the pointers stop matching, you advance one only, until it starts matching again. Then do the same for the other pointer. If Neither find a match, advance the pointer by one and repeat. (the line has changed)

Your results will be:

match
Addition/removal (one side has data that doesn't match the other)
Moved (pointers match somewhere, but not each other)
Change (nothing matches on either side for a while)

If you want to get a little more complex, you can store blocks of matching line numbers into a list and find the largest sets of matches, in case you're comparing text that repeats a lot.

I hope that helps.
__________________
"Science is constructed of facts as a house is of stones. But a collection of facts is no more a science than a heap of stones is a house." - Henri Poincare

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Diff tools


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT