(self, args, branch_arg_given)
| 3949 | print(self.gitError.read()) |
| 3950 | |
| 3951 | def importRevisions(self, args, branch_arg_given): |
| 3952 | changes = [] |
| 3953 | |
| 3954 | if len(self.changesFile) > 0: |
| 3955 | with open(self.changesFile) as f: |
| 3956 | output = f.readlines() |
| 3957 | changeSet = set() |
| 3958 | for line in output: |
| 3959 | changeSet.add(int(line)) |
| 3960 | |
| 3961 | for change in changeSet: |
| 3962 | changes.append(change) |
| 3963 | |
| 3964 | changes.sort() |
| 3965 | else: |
| 3966 | # catch "git p4 sync" with no new branches, in a repo that |
| 3967 | # does not have any existing p4 branches |
| 3968 | if len(args) == 0: |
| 3969 | if not self.p4BranchesInGit: |
| 3970 | raise P4CommandException("No remote p4 branches. Perhaps you never did \"git p4 clone\" in here.") |
| 3971 | |
| 3972 | # The default branch is master, unless --branch is used to |
| 3973 | # specify something else. Make sure it exists, or complain |
| 3974 | # nicely about how to use --branch. |
| 3975 | if not self.detectBranches: |
| 3976 | if not branch_exists(self.branch): |
| 3977 | if branch_arg_given: |
| 3978 | raise P4CommandException("Error: branch %s does not exist." % self.branch) |
| 3979 | else: |
| 3980 | raise P4CommandException("Error: no branch %s; perhaps specify one with --branch." % |
| 3981 | self.branch) |
| 3982 | |
| 3983 | if self.verbose: |
| 3984 | print("Getting p4 changes for %s...%s" % (', '.join(self.depotPaths), |
| 3985 | self.changeRange)) |
| 3986 | changes = p4ChangesForPaths(self.depotPaths, self.changeRange, self.changes_block_size) |
| 3987 | |
| 3988 | if len(self.maxChanges) > 0: |
| 3989 | changes = changes[:min(int(self.maxChanges), len(changes))] |
| 3990 | |
| 3991 | if len(changes) == 0: |
| 3992 | if not self.silent: |
| 3993 | print("No changes to import!") |
| 3994 | else: |
| 3995 | if not self.silent and not self.detectBranches: |
| 3996 | print("Import destination: %s" % self.branch) |
| 3997 | |
| 3998 | self.updatedBranches = set() |
| 3999 | |
| 4000 | if not self.detectBranches: |
| 4001 | if args: |
| 4002 | # start a new branch |
| 4003 | self.initialParent = "" |
| 4004 | else: |
| 4005 | # build on a previous revision |
| 4006 | self.initialParent = parseRevision(self.branch) |
| 4007 | |
| 4008 | self.importChanges(changes) |
no test coverage detected