{"thread":{"id":"4488","subject":"cvsps wierdness","startedAt":"2006-06-12T20:47:01Z","lastAt":"2006-06-13T06:06:20Z","messageCount":4,"participants":["Robin Rosenberg (list subscriber)","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"21680","messageId":"200606122247.02727.robin.rosenberg.lists@dewire.com","threadId":"4488","inReplyTo":null,"subject":"cvsps wierdness","fromName":"Robin Rosenberg (list subscriber)","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2006-06-12T20:47:01Z","receivedAt":"2006-06-12T20:47:01Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\nI sometimes get out-of-order imports with git-cvsimport when consecutive \ncommits have the same message. I narrowed it down to a small demo:\n\n#!/bin/bash -x\nmkdir demo\ncd demo\nexport CVSROOT=$(pwd)/cvsrepo\nmkdir $CVSROOT\ncvs init\nmkdir $CVSROOT/x\ncvs co -d sandbox x\ncd sandbox\necho X >k.txt\ncvs add k.txtsometimes \ncvs commit -m \"A commit\"\nsleep 1\necho a >v.txt\ncvs add v.txt\ncvs commit -m \"A commit\"\nsleep 1\necho b >v.txt\ncvs commit -m \"A commit\"\ncvsps -x --norc\n\n-- end --\n\nThe script creates a small CVS repo with three commits on two files. What's \nodd is that cvsps lists revision 1.2 of the file v.txt *before* version 1.1, \nlike this:\n\n---------------------\nPatchSet 1\nDate: 2006/06/13 00:34:15\nAuthor: roro\nBranch: HEAD\nTag: (none)\nLog:\nA commit\n\nMembers:\n        k.txt:INITIAL->1.1\n        v.txt:1.1->1.2\n\n---------------------\nPatchSet 2\nDate: 2006/06/13 00:34:17\nAuthor: roro\nBranch: HEAD\nTag: (none)\nLog:\nA commit\n\nMembers:\n        v.txt:INITIAL->1.1\n\nMaybe someone with cvsps insight can spot the error? If you don't get the\nsame error I wouldn't be surprised because I had a similar example that would\nnot repeat itself on both of the machines I tried it. This one however \"works\" \nevery time (on my machines).\n\n-- robin\n"},{"id":"21681","messageId":"Pine.LNX.4.64.0606121406200.5498@g5.osdl.org","threadId":"4488","inReplyTo":"200606122247.02727.robin.rosenberg.lists@dewire.com","subject":"Re: cvsps wierdness","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-06-12T21:27:15Z","receivedAt":"2006-06-12T21:27:15Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 12 Jun 2006, Robin Rosenberg (list subscriber) wrote:\n> \n> The script creates a small CVS repo with three commits on two files. What's \n> odd is that cvsps lists revision 1.2 of the file v.txt *before* version 1.1, \n> like this:\n\nWhat seems to happen is that the two changes to v.txt are broken up into \nseparate changesets (because they touch the same file), but then the \n_first_ one is merged with the changeset that contains the k.txt change \n(because they have the same log message, and roughly the same date).\n\nThen, because it has the earlier date, that combined changeset ends up \nbeing considered to be \"before\" the later one, even though it contains a \nversion of v.txt that is newer.\n\nDoes this patch fix it for you (untested - it could result in tons of \nother trouble, but it basically just says that time ordering is less \nimportant than member revision ordering).\n\nI don't think this is strictly correct, btw. I suspect you can still get \ninto strange situations where the changeset merging has resulted in one \nfile ordering one way, and another file ordering the other way. \n\nI really don't think cvsps is really very good about this.\n\n\t\tLinus\n\n---\ndiff --git a/cvsps.c b/cvsps.c\nindex 2695a0f..daa93a3 100644\n--- a/cvsps.c\n+++ b/cvsps.c\n@@ -1662,14 +1662,14 @@ static int compare_patch_sets_bytime(con\n      * know that insertions are unique at this point.\n      */\n \n-    diff = ps1->date - ps2->date;\n-    if (diff)\n-\treturn (diff < 0) ? -1 : 1;\n-\n     ret = compare_patch_sets_by_members(ps1, ps2);\n     if (ret)\n \treturn ret;\n \n+    diff = ps1->date - ps2->date;\n+    if (diff)\n+\treturn (diff < 0) ? -1 : 1;\n+\n     ret = strcmp(ps1->author, ps2->author);\n     if (ret)\n \treturn ret;\n"},{"id":"21682","messageId":"Pine.LNX.4.64.0606121429510.5498@g5.osdl.org","threadId":"4488","inReplyTo":"Pine.LNX.4.64.0606121406200.5498@g5.osdl.org","subject":"Re: cvsps wierdness","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-06-12T21:30:47Z","receivedAt":"2006-06-12T21:30:47Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 12 Jun 2006, Linus Torvalds wrote:\n> \n> I don't think this is strictly correct, btw. I suspect you can still get \n> into strange situations where the changeset merging has resulted in one \n> file ordering one way, and another file ordering the other way. \n\nBtw, I also fear that this could make cvsps noticeably slower, since the \npatchset comparison code is pretty expensive (O(n*m) in files in each \npatch-set).\n\n\t\tLinus\n"},{"id":"21709","messageId":"200606130806.21395.robin.rosenberg.lists@dewire.com","threadId":"4488","inReplyTo":"Pine.LNX.4.64.0606121406200.5498@g5.osdl.org","subject":"Re: cvsps wierdness","fromName":"Robin Rosenberg (list subscriber)","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2006-06-13T06:06:20Z","receivedAt":"2006-06-13T06:06:20Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"måndag 12 juni 2006 23:27 skrev Linus Torvalds:\n[...]\n> Does this patch fix it for you (untested - it could result in tons of\n> other trouble, but it basically just says that time ordering is less\n> important than member revision ordering).\nThanks, it worked on the simple case at least. We'll see about the original \nfull repo later. \n\n>\n> I don't think this is strictly correct, btw. I suspect you can still get\n> into strange situations where the changeset merging has resulted in one\n> file ordering one way, and another file ordering the other way.\n\nDoesn't cvsps's conflict handing simply break up those patches into several \npatches? More patches is ok. Suboptimal patches can be accepted\n\n-- robin\n"}]}