Perforce allows you commit files and directories with the same name, so you could have files //depot/foo and //depot/foo/bar both checked in. A p4 sync of a repository in this state fails. Deleting one of the files recovers the repository. Git will not
(self, files, change)
| 3407 | return hasPrefix |
| 3408 | |
| 3409 | def findShadowedFiles(self, files, change): |
| 3410 | """Perforce allows you commit files and directories with the same name, |
| 3411 | so you could have files //depot/foo and //depot/foo/bar both checked |
| 3412 | in. A p4 sync of a repository in this state fails. Deleting one of |
| 3413 | the files recovers the repository. |
| 3414 | |
| 3415 | Git will not allow the broken state to exist and only the most |
| 3416 | recent of the conflicting names is left in the repository. When one |
| 3417 | of the conflicting files is deleted we need to re-add the other one |
| 3418 | to make sure the git repository recovers in the same way as |
| 3419 | perforce. |
| 3420 | """ |
| 3421 | |
| 3422 | deleted = [f for f in files if f['action'] in self.delete_actions] |
| 3423 | to_check = set() |
| 3424 | for f in deleted: |
| 3425 | path = decode_path(f['path']) |
| 3426 | to_check.add(path + '/...') |
| 3427 | while True: |
| 3428 | path = path.rsplit("/", 1)[0] |
| 3429 | if path == "/" or path in to_check: |
| 3430 | break |
| 3431 | to_check.add(path) |
| 3432 | to_check = ['%s@%s' % (wildcard_encode(p), change) for p in to_check |
| 3433 | if self.hasBranchPrefix(p)] |
| 3434 | if to_check: |
| 3435 | stat_result = p4CmdList(["-x", "-", "fstat", "-T", |
| 3436 | "depotFile,headAction,headRev,headType"], stdin=to_check) |
| 3437 | for record in stat_result: |
| 3438 | if record['code'] != 'stat': |
| 3439 | continue |
| 3440 | if record['headAction'] in self.delete_actions: |
| 3441 | continue |
| 3442 | files.append({ |
| 3443 | 'action': 'add', |
| 3444 | 'path': record['depotFile'], |
| 3445 | 'rev': record['headRev'], |
| 3446 | 'type': record['headType']}) |
| 3447 | |
| 3448 | def commit(self, details, files, branch, parent="", allow_empty=False): |
| 3449 | epoch = details["time"] |
no test coverage detected