Skip to content

Commit

Permalink
git p4: import/export of labels to/from p4
Browse files Browse the repository at this point in the history
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 <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Luke Diamand authored and Junio C Hamano committed Apr 11, 2012
1 parent 7bbaf11 commit 06804c7
Show file tree
Hide file tree
Showing 3 changed files with 468 additions and 39 deletions.
43 changes: 38 additions & 5 deletions Documentation/git-p4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down Expand Up @@ -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
-----------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
----------------------
Expand Down
Loading

0 comments on commit 06804c7

Please sign in to comment.