git-p4: RCS keyword handling
PATCH v4 1/1 git-p4: RCS keyword handling
Updated patch incorporating comments from Pete and Junio to handle RCS keyword expansion in git-p4.
Note: The current patch fails to to handle the case where a user adds an expanded RCS keyword in *git* (e.g. via cut-n-paste). I'll try to address that separately. There's a failing test case for this.
This version:
- uses "p4 fstat" to get the filetype
- uses Junio's suggested regexp to match $Keyword:$
- uses the sets of added/deleted files rather than parsing diff output
- various other small fixes spotted by Pete
- adds additional test cases
Luke Diamand (1):
git-p4: add initial support for RCS keywords
Documentation/git-p4.txt | 5 + contrib/fast-import/git-p4 | 118 ++++++++++++-- t/t9810-git-p4-rcs.sh | 388 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 501 insertions(+), 10 deletions(-) create mode 100755 t/t9810-git-p4-rcs.sh
Signature · 1 line
1.7.9.259.ga92e
PATCH v4 1/1 git-p4: add initial support for RCS keywords
RCS keywords cause problems for git-p4 as perforce always expands them (if +k is set) and so when applying the patch, git reports that the files have been modified by both sides, when in fact they haven't.
This change means that when git-p4 detects a problem applying a patch, it will check to see if keyword expansion could be the culprit. If it is, it strips the keywords in the p4 repository so that they match what git is expecting. It then has another go at applying the patch.
This behaviour is enabled with a new git-p4 configuration option and is off by default.
--- Documentation/git-p4.txt | 5 + contrib/fast-import/git-p4 | 118 ++++++++++++-- t/t9810-git-p4-rcs.sh | 388 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 501 insertions(+), 10 deletions(-) create mode 100755 t/t9810-git-p4-rcs.sh
Documentation/git-p4.txt +5 -0
@@ -483,6 +483,11 @@ git-p4.skipUserNameCheck:: user map, 'git p4' exits. This option can be used to force submission regardless. +git-p4.attemptRCSCleanup: + If enabled, 'git p4 submit' will attempt to cleanup RCS keywords + ($Header$, etc). These would otherwise cause merge conflicts and prevent + the submit going ahead. This option should be considered experimental at + present. IMPLEMENTATION DETAILS ----------------------
contrib/fast-import/git-p4 +108 -10
157 lines not on this page · raw message
t/t9810-git-p4-rcs.sh new file +388 -0
388 lines not on this page · raw message
Signature · 1 line
1.7.9.259.ga92e
Re: [PATCHv4] git-p4: add initial support for RCS keywords
[email protected] wrote on Wed, 22 Feb 2012 10:15 +0000:
Quoted 11 lines
RCS keywords cause problems for git-p4 as perforce always expands them (if +k is set) and so when applying the patch, git reports that the files have been modified by both sides, when in fact they haven't.
This change means that when git-p4 detects a problem applying a patch, it will check to see if keyword expansion could be the culprit. If it is, it strips the keywords in the p4 repository so that they match what git is expecting. It then has another go at applying the patch.
Quoted 5 lines
This behaviour is enabled with a new git-p4 configuration option and is off by default.
Improved-by Pete Wyckoff <[email protected]>Signed-off-by Luke Diamand <[email protected]>
Looks brilliant. Ack. Thanks for suffering through N rounds of review. :)
-- Pete
Re: [PATCHv4] git-p4: add initial support for RCS keywords
Quoted 5 lines · Pete Wyckoff
Quoted 2 lines
Improved-by Pete Wyckoff <[email protected]>Signed-off-by Luke Diamand <[email protected]>Looks brilliant. Ack. Thanks for suffering through N rounds of review. :)
Well, I hate to say that I need to ask another round, to redo this patch on top of ld/git-p4-expanded-keywords topic that has already been in 'next'; a patch that replaces what is in 'next' will lose fix-ups for issues I pointed out in the first round that you forgot to follow and were fixed up locally by me when I queued the existing one.
When working on an improvement to what you have sent out, please make it a habit of comparing your result with what are already queued, even when the earlier patches are still in 'pu'. They often are polished with trivial improvements (both to the patch and the log message) based on review comments from people when they are queued, which you do not want to lose.
Thanks.
Re: [PATCHv4] git-p4: add initial support for RCS keywords
Quoted 14 lines · Junio C Hamano
Quoted 5 lines · Pete Wyckoff
Quoted 2 lines
Improved-by Pete Wyckoff<[email protected]>Signed-off-by Luke Diamand<[email protected]>Looks brilliant. Ack. Thanks for suffering through N rounds of review. :)
Well, I hate to say that I need to ask another round, to redo this patch on top of ld/git-p4-expanded-keywords topic that has already been in 'next'; a patch that replaces what is in 'next' will lose fix-ups for issues I pointed out in the first round that you forgot to follow and were fixed up locally by me when I queued the existing one.
Quoted 5 lines
When working on an improvement to what you have sent out, please make it a habit of comparing your result with what are already queued, even when the earlier patches are still in 'pu'. They often are polished with trivial improvements (both to the patch and the log message) based on review comments from people when they are queued, which you do not want to lose.
Sorry - I had completely forgotten about that.
No need to apologize for asking me to rework this. I'm using this amazing version control system that makes it really easy.
Now, if I was using Perforce, then by now I would pretty unhappy.... P
Quoted 2 lines
Thanks.