Added git-p4 rebase convenience
Signed-off-by: Simon Hausmann <simon@lst.de>
This commit is contained in:
parent
711544b00c
commit
01ce1fe967
@ -804,7 +804,11 @@ class P4Sync(Command):
|
|||||||
def getLabels(self):
|
def getLabels(self):
|
||||||
self.labels = {}
|
self.labels = {}
|
||||||
|
|
||||||
for output in p4CmdList("labels %s..." % self.globalPrefix):
|
l = p4CmdList("labels %s..." % self.globalPrefix)
|
||||||
|
if len(l) > 0:
|
||||||
|
print "Finding files belonging to labels in %s" % self.globalPrefix
|
||||||
|
|
||||||
|
for output in l:
|
||||||
label = output["label"]
|
label = output["label"]
|
||||||
revisions = {}
|
revisions = {}
|
||||||
newestChange = 0
|
newestChange = 0
|
||||||
@ -1039,6 +1043,19 @@ class P4Sync(Command):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
class P4Rebase(Command):
|
||||||
|
def __init__(self):
|
||||||
|
Command.__init__(self)
|
||||||
|
self.options = [ ]
|
||||||
|
self.description = "Fetches the latest revision from perforce and rebases the current work (branch) against it"
|
||||||
|
|
||||||
|
def run(self, args):
|
||||||
|
sync = P4Sync()
|
||||||
|
sync.run([])
|
||||||
|
print "Rebasing the current branch"
|
||||||
|
system("git rebase p4")
|
||||||
|
return True
|
||||||
|
|
||||||
class HelpFormatter(optparse.IndentedHelpFormatter):
|
class HelpFormatter(optparse.IndentedHelpFormatter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
optparse.IndentedHelpFormatter.__init__(self)
|
optparse.IndentedHelpFormatter.__init__(self)
|
||||||
@ -1061,7 +1078,8 @@ commands = {
|
|||||||
"debug" : P4Debug(),
|
"debug" : P4Debug(),
|
||||||
"clean-tags" : P4CleanTags(),
|
"clean-tags" : P4CleanTags(),
|
||||||
"submit" : P4Submit(),
|
"submit" : P4Submit(),
|
||||||
"sync" : P4Sync()
|
"sync" : P4Sync(),
|
||||||
|
"rebase" : P4Rebase()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(sys.argv[1:]) == 0:
|
if len(sys.argv[1:]) == 0:
|
||||||
|
@ -40,12 +40,24 @@ newer changes from the Perforce depot by just calling
|
|||||||
|
|
||||||
git-p4 sync
|
git-p4 sync
|
||||||
|
|
||||||
in your git repository.
|
in your git repository. By default the "p4" branch is updated.
|
||||||
|
|
||||||
It is recommended to run 'git repack -a -d -f' from time to time when using
|
It is recommended to run 'git repack -a -d -f' from time to time when using
|
||||||
incremental imports to optimally combine the individual git packs that each
|
incremental imports to optimally combine the individual git packs that each
|
||||||
incremental import creates through the use of git-fast-import.
|
incremental import creates through the use of git-fast-import.
|
||||||
|
|
||||||
|
Updating
|
||||||
|
========
|
||||||
|
|
||||||
|
A common working pattern is to fetch the latest changes from the Perforce depot
|
||||||
|
and merge them with local uncommitted changes. The recommended way is to use
|
||||||
|
git's rebase mechanism to preserve linear history. git-p4 provides a convenient
|
||||||
|
|
||||||
|
git-p4 rebase
|
||||||
|
|
||||||
|
command that calls git-p4 sync followed by git rebase to rebase the current
|
||||||
|
working branch.
|
||||||
|
|
||||||
Submitting
|
Submitting
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user