Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Support Perforce as a VCS #200

Closed
71 of 77 tasks
aatwi opened this issue Dec 14, 2022 · 0 comments · Fixed by #232
Closed
71 of 77 tasks

[Feature]: Support Perforce as a VCS #200

aatwi opened this issue Dec 14, 2022 · 0 comments · Fixed by #232
Assignees
Labels
enhancement New feature or request M Medium murex Items related to using TCR at Murex perforce Perforce related issues

Comments

@aatwi
Copy link
Member

aatwi commented Dec 14, 2022

Contact Details

aatwi@murex.com

Feature Request

Some teams use Perforce instead of Git as their official VCS.
We need to support using Perforce for them to be able to use TCR on their production code.

Feature Description

TCR can do all the VCS operations with Perforce instead of Git.

Alternatives

  • Use a temporary Git folder
  • Use Helix4Git
  • Explore Git-p4

Additional Context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Mikado

  • Run TCR on a p4 depot
    • Have p4 environment ready on our machines
    • Update TCR so that it can use p4 as a VCS
      • Be able to trigger p4 commands from TCR
      • Refactor the vcs package so that it provides a VCS implementation agnostic interface
        • Rename GitInterface to an implementation agnostic name (API for other packages)
        • Move git-specific implementation into vcs.git sub-package
          • Create a git subdir
          • Move git_impl and git_impl_test to git subdir
            • Move git_fake_test.go to git subdir
              • Make newGitImpl public
              • Make GitLog.add public
            • Make command.go functions public
          • Rename git_file_diff.go to git_diff.go
          • Rename git_log_item.go to vcs_log_item.go
      • Rename GitError to VCSError in status package
      • Replace "git" with "vcs" in all parts of the codebase that are not git-specific
      • Create p4 implementation
        • Create vcs.p4 sub-package
        • Add p4 implementation
          • Define p4 equivalent for the following git operations (defined in vcs.Interface)
            • GetRootDir() string
            • GetRemoteName() string
            • GetWorkingBranch() string
            • IsOnRootBranch() bool
            • Add(paths ...string) error
            • Commit(amend bool, messages ...string) error
            • Restore(dir string) error stubbed
            • Revert() error stubbed
            • Push() error
            • Pull() error
              • run p4 sync on Pull call
              • update p4 sync so that it syncs only the workdir contents (instead of p4 workspace root dir)
                • add a function to retrieve p4 clientName
                • add a function to convert TCR basedir to p4 path (using p4 clientName and rootDir)
            • Stash(message string) error stubbed
            • UnStash(keep bool) error stubbed
            • Diff() (diffs FileDiffs, err error)
            • Log(msgFilter func(msg string) bool) (logs GitLogItems, err error) stubbed
            • EnablePush(flag bool)
            • IsPushEnabled() bool
            • IsRemoteEnabled() bool
            • CheckRemoteAccess() bool
          • Create a test environment for p4-specific operations (shell command stub)
          • Add "-c clientName" option in all p4 command calls (using by default clientName from p4 info)
      • Have TCR know if it should use p4 on the provided work directory
        • Provide a configuration option to tell TCR which VCS to use
          • Use a default vcs (git seems the best candidate)
          • Have a command line flag to specify the vcs to use
          • Have a configuration setting allowing to specify the vcs to use
      • Make sure p4-specific tests can run within GitHub actions
        • Look for a GitHub action that installs at least p4 client command -> there is one, but requires to have a p4 server running somewhere -> discarded
        • See if there is a way to have a p4 workspace to that we can test against it (in-memory would be ideal) -> discarded
        • Chosen option is to stub out all p4 command calls when running in GitHub actions
      • Document how p4 VCS is used (README, etc.)
      • Update tcr check so that it's able to check either git or p4 environment (or both?) depending on workspace stubbed
      • Update tcr trace depending on which VCS is used to show only meaningful information
      • Customize menu shortcuts depending on the VCS being used
        • Remove "push" shortcut when running with p4 as Push does nothing when in p4
        • Remove "P -> Turn on/off VCS auto-push" shortcut when running with p4 as it's meaningless with p4
        • Replace "L -> Pull from remote" with "Y -> Sync"

Parking lot

  • Move command.go to their own standalone package
  • Add a tcr command line option to specify the p4 clientName
  • See if there is an easy way for TCR to automatically detect the underlying VCS
    • see if we could use the command env P4CLIENT=xxx p4 status (rc = 0 when cwd is in xxx workspace, rc=1 otherwise)
  • Move "polling-period" configuration value key from "git" to "vcs" #228
    • Update config/param_polling_period.go
    • Prepare a script to automatically update tcr/config.yml once tcr version introduces this change
@aatwi aatwi added enhancement New feature or request M Medium labels Dec 14, 2022
philou added a commit that referenced this issue Dec 21, 2022
philou added a commit that referenced this issue Dec 21, 2022
To be able to isolate git related code in their own subpackage
- rename
- adapt call sites
aatwi pushed a commit that referenced this issue Dec 21, 2022
aatwi pushed a commit that referenced this issue Dec 21, 2022
… "git"

- Make variables under FileDiff public
- Make GitLogItem.Len public
mengdaming pushed a commit that referenced this issue Jan 2, 2023
mengdaming pushed a commit that referenced this issue Jan 2, 2023
To be able to isolate git related code in their own subpackage
- rename
- adapt call sites
mengdaming pushed a commit that referenced this issue Jan 2, 2023
… "git"

- Make variables under FileDiff public
- Make GitLogItem.Len public
mengdaming added a commit that referenced this issue Jan 2, 2023
- Also move remaining git-specifics into git sub-package
mengdaming pushed a commit that referenced this issue Jan 3, 2023
mengdaming pushed a commit that referenced this issue Jan 3, 2023
To be able to isolate git related code in their own subpackage
- rename
- adapt call sites
mengdaming pushed a commit that referenced this issue Jan 3, 2023
… "git"

- Make variables under FileDiff public
- Make GitLogItem.Len public
mengdaming added a commit that referenced this issue Jan 3, 2023
- Also move remaining git-specifics into git sub-package
mengdaming pushed a commit that referenced this issue Jan 3, 2023
mengdaming added a commit that referenced this issue Feb 1, 2023
mengdaming added a commit that referenced this issue Feb 1, 2023
- In order to be able to run p4 tests withous having p4 installed and configured
mengdaming pushed a commit that referenced this issue Feb 1, 2023
mengdaming added a commit that referenced this issue Feb 1, 2023
- now using stubbed git command calls instead of real calls
mengdaming added a commit that referenced this issue Feb 1, 2023
mengdaming added a commit that referenced this issue Feb 1, 2023
- evolving towards a more generic VCS interface
mengdaming added a commit that referenced this issue Feb 1, 2023
mengdaming added a commit that referenced this issue Feb 1, 2023
- "P - Auto push toggle" is available only with git
- "L - Pull" is available only with git
- "S - Push" is available only with git
- "Y - Sync"  is available only with p4
mengdaming pushed a commit that referenced this issue Feb 1, 2023
To support Perforce
- update Readme.md with a section on Perforce
- update Readme.md to remove git-specific wording
- update build.md to explain how to test TCR with Perforce locally
@mengdaming mengdaming added perforce Perforce related issues murex Items related to using TCR at Murex labels Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request M Medium murex Items related to using TCR at Murex perforce Perforce related issues
Development

Successfully merging a pull request may close this issue.

3 participants