(self, revision)
| 3895 | system(["git", "fetch", "origin"]) |
| 3896 | |
| 3897 | def importHeadRevision(self, revision): |
| 3898 | print("Doing initial import of %s from revision %s into %s" % (' '.join(self.depotPaths), revision, self.branch)) |
| 3899 | |
| 3900 | details = {} |
| 3901 | details["user"] = "git perforce import user" |
| 3902 | details["desc"] = ("Initial import of %s from the state at revision %s\n" |
| 3903 | % (' '.join(self.depotPaths), revision)) |
| 3904 | details["change"] = revision |
| 3905 | newestRevision = 0 |
| 3906 | |
| 3907 | fileCnt = 0 |
| 3908 | fileArgs = ["%s...%s" % (p, revision) for p in self.depotPaths] |
| 3909 | |
| 3910 | for info in p4CmdList(["files"] + fileArgs): |
| 3911 | |
| 3912 | if 'code' in info and info['code'] == 'error': |
| 3913 | sys.stderr.write("p4 returned an error: %s\n" |
| 3914 | % info['data']) |
| 3915 | if info['data'].find("must refer to client") >= 0: |
| 3916 | sys.stderr.write("This particular p4 error is misleading.\n") |
| 3917 | sys.stderr.write("Perhaps the depot path was misspelled.\n") |
| 3918 | sys.stderr.write("Depot path: %s\n" % " ".join(self.depotPaths)) |
| 3919 | sys.exit(1) |
| 3920 | if 'p4ExitCode' in info: |
| 3921 | sys.stderr.write("p4 exitcode: %s\n" % info['p4ExitCode']) |
| 3922 | sys.exit(1) |
| 3923 | |
| 3924 | change = int(info["change"]) |
| 3925 | if change > newestRevision: |
| 3926 | newestRevision = change |
| 3927 | |
| 3928 | if info["action"] in self.delete_actions: |
| 3929 | continue |
| 3930 | |
| 3931 | for prop in ["depotFile", "rev", "action", "type"]: |
| 3932 | details["%s%s" % (prop, fileCnt)] = info[prop] |
| 3933 | |
| 3934 | fileCnt = fileCnt + 1 |
| 3935 | |
| 3936 | details["change"] = newestRevision |
| 3937 | |
| 3938 | # Use time from top-most change so that all git p4 clones of |
| 3939 | # the same p4 repo have the same commit SHA1s. |
| 3940 | res = p4_describe(newestRevision) |
| 3941 | details["time"] = res["time"] |
| 3942 | |
| 3943 | self.updateOptionDict(details) |
| 3944 | try: |
| 3945 | self.commit(details, self.extractFilesFromCommit(details), self.branch) |
| 3946 | except IOError as err: |
| 3947 | print("IO error with git fast-import. Is your git version recent enough?") |
| 3948 | print("IO error details: {}".format(err)) |
| 3949 | print(self.gitError.read()) |
| 3950 | |
| 3951 | def importRevisions(self, args, branch_arg_given): |
| 3952 | changes = [] |
no test coverage detected