{"thread":{"id":"19979","subject":"Does CVS has a easy way to compare file with its previous version?","startedAt":"2009-06-30T07:41:08Z","lastAt":"2009-07-07T19:57:46Z","messageCount":10,"participants":["dtletmn","Andreas Ericsson","Jakub Narebski","Paolo Bonzini","Linus Torvalds","Eric Raible"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117226","messageId":"1e56aa11-735a-47f7-a273-5b6bf611f528@n11g2000yqb.googlegroups.com","threadId":"19979","inReplyTo":null,"subject":"Does CVS has a easy way to compare file with its previous version?","fromName":"dtletmn","fromEmail":"dtletmedn@gmail.com","sentAt":"2009-06-30T07:41:08Z","receivedAt":"2009-06-30T07:41:08Z","isPatch":false,"sender":{"key":"dtletmedn@gmail.com","avatar":null},"body":"Hi,All,\n\n     I am wondering if cvs has an easy way to compare a file with its\nprevious version.\n\n     In clearcase,I can use  :\n       cleartool diff -pred file.cc\n\n     how can I acheive it in CVS?\n     any help would be highly appreciated!\n\n     Thanks,\n     dt\n"},{"id":"117227","messageId":"4A49F7BF.9070209@op5.se","threadId":"19979","inReplyTo":"1e56aa11-735a-47f7-a273-5b6bf611f528@n11g2000yqb.googlegroups.com","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2009-06-30T11:32:15Z","receivedAt":"2009-06-30T11:32:15Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"dtletmn wrote:\n> Hi,All,\n> \n>      I am wondering if cvs has an easy way to compare a file with its\n> previous version.\n> \n>      In clearcase,I can use  :\n>        cleartool diff -pred file.cc\n> \n>      how can I acheive it in CVS?\n>      any help would be highly appreciated!\n> \n\nWhy you're posting this to the git mailing list I have no idea, but\nassuming you mean \"how do I compare a file in git with the content\nit had in the previous snapshot?\", the answer would be:\n\n  git diff HEAD^ -- path/to/file\n\nThis command works equally well on directories or multiple paths.\nNote that if there are no differences, the program will just exit\nsilently.\n\nIf you want to see the differences compared to the *latest* commit,\nyou'd do\n\n  git diff HEAD -- path/to/file\n\nIf you want to see the differences compared to what you've staged\nfor committing next, you'd do\n\n  git diff -- path/to/file\n\nIf you want to see the differences between what you've already\nstaged and the latest snapshot, you'd do\n\n  git diff --staged -- path/to/file\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"117231","messageId":"m3hbxxx5jk.fsf@localhost.localdomain","threadId":"19979","inReplyTo":"1e56aa11-735a-47f7-a273-5b6bf611f528@n11g2000yqb.googlegroups.com","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-06-30T12:36:04Z","receivedAt":"2009-06-30T12:36:04Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"dtletmn <dtletmedn@gmail.com> writes:\n\n> Hi,All,\n> \n>      I am wondering if cvs has an easy way to compare a file with its\n> previous version.\n> \n>      In clearcase,I can use  :\n>        cleartool diff -pred file.cc\n> \n>      how can I acheive it in CVS?\n>      any help would be highly appreciated!\n\nIn CVS or in Git?\n\nIn CVS: \"cvs diff -r <previous revision> <file>\".\nIn Git: \"git diff HEAD^ -- <file>\".\n\nBoth assume that you want to compare with version from previous\ncommit.\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"117273","messageId":"4A4A9FA5.7000009@gnu.org","threadId":"19979","inReplyTo":"m3hbxxx5jk.fsf@localhost.localdomain","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-06-30T23:28:37Z","receivedAt":"2009-06-30T23:28:37Z","isPatch":false,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 06/30/2009 02:36 PM, Jakub Narebski wrote:\n> dtletmn<dtletmedn@gmail.com>  writes:\n>\n>> Hi,All,\n>>\n>>       I am wondering if cvs has an easy way to compare a file with its\n>> previous version.\n>>\n>>       In clearcase,I can use  :\n>>         cleartool diff -pred file.cc\n>>\n>>       how can I acheive it in CVS?\n>>       any help would be highly appreciated!\n>\n> In CVS or in Git?\n>\n> In CVS: \"cvs diff -r<previous revision>  <file>\".\n> In Git: \"git diff HEAD^ --<file>\".\n\nI think he wants something more like\n\ngit diff `git log -2 --pretty=format:%h` <file> -- <file>\n\nIn CVS it should not be hard, but I definitely have no idea.\n\nPaolo\n"},{"id":"117277","messageId":"e4802579-a779-4f4a-99e2-1761e3e5312f@h2g2000yqg.googlegroups.com","threadId":"19979","inReplyTo":"1e56aa11-735a-47f7-a273-5b6bf611f528@n11g2000yqb.googlegroups.com","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"dtletmn","fromEmail":"dtletmedn@gmail.com","sentAt":"2009-07-01T00:29:09Z","receivedAt":"2009-07-01T00:29:09Z","isPatch":false,"sender":{"key":"dtletmedn@gmail.com","avatar":null},"body":"\nThanks all very much for the help!!\n"},{"id":"117279","messageId":"alpine.LFD.2.01.0906301813480.3605@localhost.localdomain","threadId":"19979","inReplyTo":"4A4A9FA5.7000009@gnu.org","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-07-01T01:18:29Z","receivedAt":"2009-07-01T01:18:29Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 1 Jul 2009, Paolo Bonzini wrote:\n> \n> I think he wants something more like\n> \n> git diff `git log -2 --pretty=format:%h` <file> -- <file>\n\nThat's a rather difficult way of saying\n\n\tgit log --no-merges -p -1 <filename>\n\nwhich seems much simpler. Sure, you'll get the commit message too, but \nthat just sounds like gravy to me (you can use \"--pretty=oneline\" or \nsomething to make it denser).\n\n\t\t\tLinus\n"},{"id":"117381","messageId":"loom.20090702T174843-784@post.gmane.org","threadId":"19979","inReplyTo":"alpine.LFD.2.01.0906301813480.3605@localhost.localdomain","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2009-07-02T18:04:45Z","receivedAt":"2009-07-02T18:04:45Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"Linus Torvalds <torvalds <at> linux-foundation.org> writes:\n\n> On Wed, 1 Jul 2009, Paolo Bonzini wrote:\n> > \n> > I think he wants something more like\n> > \n> > git diff `git log -2 --pretty=format:%h` <file> -- <file>\n> \n> That's a rather difficult way of saying\n> \n> \tgit log --no-merges -p -1 <filename>\n> \n> which seems much simpler. Sure, you'll get the commit message too, but \n> that just sounds like gravy to me (you can use \"--pretty=oneline\" or \n> something to make it denser).\n> \n> \t\t\tLinus\n\nIsn't the first one incorrect because  <file> needs to be inside the backticks?\ngit diff `git log -2 --pretty=format:%h <file>` -- <file>\n\nAnd isn't the replacement incorrect also (the diffs are backwards)?\ngit log --no-merges -p -R -1 <file>\n\n- Eric\n"},{"id":"117404","messageId":"4A4DA7A5.7020303@gnu.org","threadId":"19979","inReplyTo":"loom.20090702T174843-784@post.gmane.org","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-07-03T06:39:33Z","receivedAt":"2009-07-03T06:39:33Z","isPatch":false,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 07/02/2009 08:04 PM, Eric Raible wrote:\n> Isn't the first one incorrect because<file>  needs to be inside the backticks?\n> git diff `git log -2 --pretty=format:%h<file>` --<file>\n>\n> And isn't the replacement incorrect also (the diffs are backwards)?\n> git log --no-merges -p -R -1<file>\n\nYes and no.\n\nPaolo\n"},{"id":"117526","messageId":"279b37b20907061639o6d6c72e7qf7bbc2459c7fc77e@mail.gmail.com","threadId":"19979","inReplyTo":"4A4DA7A5.7020303@gnu.org","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2009-07-06T23:39:43Z","receivedAt":"2009-07-06T23:39:43Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"On Thu, Jul 2, 2009 at 11:39 PM, Paolo Bonzini<bonzini@gnu.org> wrote:\n> On 07/02/2009 08:04 PM, Eric Raible wrote:\n>>\n>> Isn't the first one incorrect because<file>  needs to be inside the\n>> backticks?\n>> git diff `git log -2 --pretty=format:%h<file>` --<file>\n>>\n>> And isn't the replacement incorrect also (the diffs are backwards)?\n>> git log --no-merges -p -R -1<file>\n>\n> Yes and no.\n>\n> Paolo\n>\n\nAre you sure that you didn't mean yes and yes?\n\nAs the transcript shows the git-diff form produces a\nbackwards diff.  Thus to get the same output git-log\nneeds the -R:\n\n$ git init\n$ perl -e 'for (0..10) { print \"$_\\n\" }' > file\n$ git add file\n$ git commit -minitial\n[master (root-commit) 2d451ec] initial\n 1 files changed, 11 insertions(+), 0 deletions(-)\n create mode 100644 file\n$ sed -e 's/4/four/' < file > file1\n$ mv file1 file\n$ git commit -a -m'updated'\n[master d49613a] updated\n 1 files changed, 1 insertions(+), 1 deletions(-)\n$ git diff `git log -2 --pretty=format:%h file` -- file\ndiff --git a/file b/file\nindex b29b605..b033488 100644\n--- a/file\n+++ b/file\n@@ -2,7 +2,7 @@\n 1\n 2\n 3\n-four\n+4\n 5\n 6\n 7\n\n$ git log --no-merges -p -1 file\ncommit d49613a1d16c9ece551f9a52f56f16a3dae8bebc\nAuthor: Eric Raible <raible@nextest.com>\nDate:   Mon Jul 6 16:25:29 2009 -0700\n\n    updated\n\ndiff --git a/file b/file\nindex b033488..b29b605 100644\n--- a/file\n+++ b/file\n@@ -2,7 +2,7 @@\n 1\n 2\n 3\n-4\n+four\n 5\n 6\n 7\n\n$ git log --no-merges -p -R -1 file\ncommit d49613a1d16c9ece551f9a52f56f16a3dae8bebc\nAuthor: Eric Raible <raible@nextest.com>\nDate:   Mon Jul 6 16:25:29 2009 -0700\n\n    updated\n\ndiff --git b/file a/file\nindex b29b605..b033488 100644\n--- b/file\n+++ a/file\n@@ -2,7 +2,7 @@\n 1\n 2\n 3\n-four\n+4\n 5\n 6\n 7\n"},{"id":"117581","messageId":"4A53A8BA.6060505@gmail.com","threadId":"19979","inReplyTo":"279b37b20907061639o6d6c72e7qf7bbc2459c7fc77e@mail.gmail.com","subject":"Re: Does CVS has a easy way to compare file with its previous version?","fromName":"Paolo Bonzini","fromEmail":"paolo.bonzini@gmail.com","sentAt":"2009-07-07T19:57:46Z","receivedAt":"2009-07-07T19:57:46Z","isPatch":false,"sender":{"key":"paolo.bonzini@gmail.com","avatar":"https://gravatar.com/avatar/7817ef2e168b4ef0570c5bb5bdc1d4b44f34d3075fe32b871710dd942d0a89f5?d=mp&s=160"},"body":"On 07/07/2009 01:39 AM, Eric Raible wrote:\n> On Thu, Jul 2, 2009 at 11:39 PM, Paolo Bonzini<bonzini@gnu.org>  wrote:\n>> On 07/02/2009 08:04 PM, Eric Raible wrote:\n>>> Isn't the first one incorrect because<file>    needs to be inside the\n>>> backticks?\n>>> git diff `git log -2 --pretty=format:%h<file>` --<file>\n>>>\n>>> And isn't the replacement incorrect also (the diffs are backwards)?\n>>> git log --no-merges -p -R -1<file>\n>> Yes and no.\n>>\n>> Paolo\n>>\n>\n> Are you sure that you didn't mean yes and yes?\n\nI'm sure; I'm not sure I was right (though I did retest at the time, and \nI was convinced that Linus's alternative worked).\n\nPaolo\n"}]}