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.
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.
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
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
----------------------
verbose = False
# Only labels/tags matching this will be imported/exported
-defaultLabelRegexp = r'[A-Z0-9_\-.]+$'
+defaultLabelRegexp = r'[a-zA-Z0-9_\-.]+$'
def p4_build_cmd(cmd):
"""Build a suitable p4 command line.
# Export git tags as p4 labels. Create a p4 label and then tag
# with that.
def exportGitTags(self, gitTags):
- validTagRegexp = gitConfig("git-p4.validTagRegexp")
- if len(validTagRegexp) == 0:
- validTagRegexp = defaultLabelRegexp
- m = re.compile(validTagRegexp)
- commit_re = re.compile(r'\s*\[git-p4:.*change = (\d+)\s*\]')
+ validLabelRegexp = gitConfig("git-p4.labelExportRegexp")
+ if len(validLabelRegexp) == 0:
+ validLabelRegexp = defaultLabelRegexp
+ m = re.compile(validLabelRegexp)
for name in gitTags:
continue
# Get the p4 commit this corresponds to
- changelist = None
- for l in read_pipe_lines(["git", "log", "--max-count=1", name]):
- match = commit_re.match(l)
- if match:
- changelist = match.group(1)
+ logMessage = extractLogMessageFromGitCommit(name)
+ values = extractSettingsGitLog(logMessage)
- if not changelist:
+ if not values.has_key('change'):
# a tag pointing to something not sent to p4; ignore
if verbose:
print "git tag %s does not give a p4 commit" % name
continue
+ else:
+ changelist = values['change']
# Get the tag details.
inHeader = True
print "import p4 labels: " + ' '.join(p4Labels)
ignoredP4Labels = gitConfigList("git-p4.ignoredP4Labels")
- validLabelRegexp = gitConfig("git-p4.validLabelRegexp")
+ validLabelRegexp = gitConfig("git-p4.labelImportRegexp")
if len(validLabelRegexp) == 0:
validLabelRegexp = defaultLabelRegexp
m = re.compile(validLabelRegexp)
p4 tag -l TAG_F1_ONLY main/f1 &&
p4 tag -l TAG_WITH\$_SHELL_CHAR main/... &&
- p4 tag -l this_tag_will_be_skipped main/... &&
+ p4 tag -l this_tag_will_be\ skipped main/... &&
echo f4 >main/f4 &&
p4 add main/f4 &&
git p4 clone --dest="$git" //depot@all &&
cd "$git" &&
- git config git-p4.validLabelRegexp ".*TAG.*" &&
+ git config git-p4.labelImportRegexp ".*TAG.*" &&
git p4 sync --import-labels --verbose &&
git tag &&