From 06804c76e8f7a61c7c9473decdf9b210d3238e9d Mon Sep 17 00:00:00 2001 From: Luke Diamand Date: Wed, 11 Apr 2012 17:21:24 +0200 Subject: git p4: import/export of labels to/from p4 The existing label import code looks at each commit being imported, and then checks for labels at that commit. This doesn't work in the real world though because it will drop labels applied on changelists that have already been imported, a common pattern. This change adds a new --import-labels option. With this option, at the end of the sync, git p4 gets sets of labels in p4 and git, and then creates a git tag for each missing p4 label. This means that tags created on older changelists are still imported. Tags that could not be imported are added to an ignore list. The same sets of git and p4 tags and labels can also be used to derive a list of git tags to export to p4. This is enabled with --export-labels in 'git p4 submit'. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- Documentation/git-p4.txt | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt index 3fac4137e2..612d51d4e7 100644 --- a/Documentation/git-p4.txt +++ b/Documentation/git-p4.txt @@ -198,7 +198,11 @@ git repository: --detect-labels:: Query p4 for labels associated with the depot paths, and add - them as tags in git. + them as tags in git. Limited usefulness as only imports labels + associated with new changelists. Deprecated. + +--import-labels:: + Import labels from p4 into git. --import-local:: By default, p4 branches are stored in 'refs/remotes/p4/', @@ -263,6 +267,16 @@ These options can be used to modify 'git p4 submit' behavior. Re-author p4 changes before submitting to p4. This option requires p4 admin privileges. +--export-labels: + Export tags from git as p4 labels. Tags found in git are applied + to the perforce working directory. + +Rebase options +~~~~~~~~~~~~~~ +These options can be used to modify 'git p4 rebase' behavior. + +--import-labels:: + Import p4 labels. DEPOT PATH SYNTAX ----------------- @@ -427,6 +441,18 @@ git-p4.branchList:: enabled. Each entry should be a pair of branch names separated by a colon (:). This example declares that both branchA and branchB were created from main: + +git-p4.ignoredP4Labels:: + List of p4 labels to ignore. This is built automatically as + unimportable labels are discovered. + +git-p4.importLabels:: + Import p4 labels into git, as per --import-labels. + +git-p4.validLabelRegexp:: + Only p4 labels matching this regular expression will be imported. The + default value is '[A-Z0-9_\-.]+$'. + ------------- git config git-p4.branchList main:branchA git config --add git-p4.branchList main:branchB @@ -481,10 +507,17 @@ git-p4.skipUserNameCheck:: 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. + 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. + +git-p4.exportLabels:: + Export git tags to p4 labels, as per --export-labels. + +git-p4.validLabelRegexp:: + Only p4 labels matching this regular expression will be exported. The + default value is '[A-Z0-9_\-.]+$'. IMPLEMENTATION DETAILS ---------------------- -- cgit v1.2.3 From c8942a223d41adab336946913f28cf8691ee479a Mon Sep 17 00:00:00 2001 From: Luke Diamand Date: Wed, 11 Apr 2012 17:21:24 +0200 Subject: git p4: fix-up "import/export of labels to/from p4" The previous one is already in 'next' but was somewhat lacking. The configuration "git-p4.validLabelRegexp" is now called "labelExportRegexp", and its default covers lowercase alphabets as well. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- Documentation/git-p4.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt index 612d51d4e7..01cc97bb11 100644 --- a/Documentation/git-p4.txt +++ b/Documentation/git-p4.txt @@ -267,7 +267,7 @@ These options can be used to modify 'git p4 submit' behavior. Re-author p4 changes before submitting to p4. This option requires p4 admin privileges. ---export-labels: +--export-labels:: Export tags from git as p4 labels. Tags found in git are applied to the perforce working directory. @@ -442,6 +442,11 @@ git-p4.branchList:: by a colon (:). This example declares that both branchA and branchB were created from main: +------------- +git config git-p4.branchList main:branchA +git config --add git-p4.branchList main:branchB +------------- + git-p4.ignoredP4Labels:: List of p4 labels to ignore. This is built automatically as unimportable labels are discovered. @@ -449,14 +454,9 @@ git-p4.ignoredP4Labels:: git-p4.importLabels:: Import p4 labels into git, as per --import-labels. -git-p4.validLabelRegexp:: +git-p4.labelImportRegexp:: Only p4 labels matching this regular expression will be imported. The - default value is '[A-Z0-9_\-.]+$'. - -------------- -git config git-p4.branchList main:branchA -git config --add git-p4.branchList main:branchB -------------- + default value is '[a-zA-Z0-9_\-.]+$'. git-p4.useClientSpec:: Specify that the p4 client spec should be used to identify p4 @@ -515,9 +515,9 @@ git-p4.attemptRCSCleanup: git-p4.exportLabels:: Export git tags to p4 labels, as per --export-labels. -git-p4.validLabelRegexp:: +git-p4.labelExportRegexp:: Only p4 labels matching this regular expression will be exported. The - default value is '[A-Z0-9_\-.]+$'. + default value is '[a-zA-Z0-9_\-.]+$'. IMPLEMENTATION DETAILS ---------------------- -- cgit v1.2.3 From 6a10b6aa1e7b9bb114e525edb67b7650b46f333e Mon Sep 17 00:00:00 2001 From: Luke Diamand Date: Tue, 24 Apr 2012 09:33:23 +0100 Subject: git p4: move verbose to base class The verbose flag is common to all classes, or at least should be. Make it a member of the base Command class, rather than reimplementing for each class. Make option parsing mirror this. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- Documentation/git-p4.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt index 01cc97bb11..51955a5f7c 100644 --- a/Documentation/git-p4.txt +++ b/Documentation/git-p4.txt @@ -158,11 +158,14 @@ OPTIONS General options ~~~~~~~~~~~~~~~ -All commands except clone accept this option. +All commands except clone accept these options. --git-dir :: Set the 'GIT_DIR' environment variable. See linkgit:git[1]. +--verbose:: + Provide more progress information. + Sync options ~~~~~~~~~~~~ These options can be used in the initial 'clone' as well as in @@ -193,9 +196,6 @@ git repository: --silent:: Do not print any progress information. ---verbose:: - Provide more progress information. - --detect-labels:: Query p4 for labels associated with the depot paths, and add them as tags in git. Limited usefulness as only imports labels @@ -249,9 +249,6 @@ Submit options ~~~~~~~~~~~~~~ These options can be used to modify 'git p4 submit' behavior. ---verbose:: - Provide more progress information. - --origin :: Upstream location from which commits are identified to submit to p4. By default, this is the most recent p4 commit reachable -- cgit v1.2.3