[RFC/PATCHv1] git-p4: label import: first draft

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luke Diamand <luked@xxxxxxxxxxx>

The existing label import code (--detect-labels) looks at each
commit being imported, and then checks for labels at that commit.

This doesn't work in the real world though because labels applied
in changelists that have already been imported are ignored. e.g.:

% p4 submit -d 'a change'
% git-p4 rebase
% p4 tag -l TAG ...
% git-p4 sync --detect-labels

TAG will never be detected.

Additionally the existing label detection has some annoying shortcomings

* It gets the list of files at each label every time git-p4 is run,
  which on a large repo with many labels is a problem. The new
  scheme only pays this price the first time a label is seen.

* It only imports a label if the number of files in the label matches
  the number of files in the repo at the highest revision found. This
  is to cope with the way that git tags and p4 labels cannot be
  directly mapped to each other. In practice this is not a useful rule,
  for example if the p4 tag was applied across a wider area of the tree
  than just the part being imported by git-p4, then the tag is ignored.
  The new code just checks that there are no diffs between the label
  and the p4 changelist to be used.

The new code gets the lists of git tags and p4 labels, and then creates
git tags for all the missing p4 labels. Any labels that could not be
imported are added to an ignore-list so that they are not repeatedly
queried. A regular expression can be specified to limit the p4 label
patterns that will be imported.

Limitations:

* The code currently doesn't know anything about branch-based setups, and
  has 'p4/master' hardcoded as the branch to search for git revisions. I
  haven't yet thought about the best way to handle this, which is why this
  is only an RFC at this stage. I would welcome suggestions on the best way
  to deal with this.

* The code uses "git log --grep" to get from a p4 changelist to a git
  commit. This means it doesn't work on older versions of git, e.g.
  git 1.7.0. Arguably it should use gitCommitByP4Change().

* The unit tests could be expanded.

Thanks,
Luke

Luke Diamand (1):
  git-p4: improved import of labels from p4

 Documentation/git-p4.txt       |   15 +++-
 contrib/fast-import/git-p4     |  152 +++++++++++++++++++++++++++++++---------
 t/t9811-git-p4-label-import.sh |  116 ++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+), 35 deletions(-)
 create mode 100755 t/t9811-git-p4-label-import.sh

-- 
1.7.10.rc0.158.gd9e55

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]