Code browser views

Perforce TeamHub supports editing and committing from the UI for Mercurial, WebDAV, Git, and P4 Git repositories. This includes when the reference is a branch, not just a tag or a specific commit.

TeamHub provides a browser view of code stored in a particular repository. The browser view presents the code in a more accessible, readable form. It also lets you edit the code and commit your changes to the repository. TeamHub supports syntax highlighting for a large number of languages. For a list of supported languages, see Syntax highlighting support.

View code

  • Select a file name.

    Code browser view

  • The number of spaces used to represent a tab can be set between 1 and 8. To change the number of spaces used, set Tab-size from the Gear button above the file (not available for Microsoft Internet Explorer).

Edit code

  1. In the top right, select Edit file. The view switches to edit mode.

    Edit file button
  2. Make any required changes.
  3. Optional: Enter a comment to be submitted with the commit.
  4. Select Commit changes at the bottom of the code page to save your changes and submit them to the repository.

    Commit changes button

TeamHub may encounter difficulties displaying file content in browser view if the file:

  • Is empty
  • Is too long/big
  • Contains unreadable content

In these cases, TeamHub displays the following message:

This file is empty or its contents cannot be displayed. Select here to download the file.

On the Raw tab, you can always view file content in plain code view.

Raw code browser view

Manifest editor

The manifest editor allows you to interactively add, edit, and delete repositories in your manifest file.

  1. Open the manifest file.

  2. To open the manifest editor, select Manifest editor.

  3. Image of the Manifest editor button location

  4. You have the following options in the editor:

    If TeamHub detects a problem with your manifest file when you save it, an error message is displayed. Select the link in the error message to go back to the manifest file, fix the problem, and save the file again.

Add a repository to the manifest

  1. To add a repository to the manifest file, select Add repository and a new line is displayed:

  2. Image of Add a repository to the manifest file

  3. Select the Select repository dropdown and select a repository.

    The Path, Default branch, HTTP URL, and SSH URL values are automatically filled.

    You can manually edit the Path and Default branch values if you need to:

    • Path: enter a unique path for the repository.

    • Default branch: enter the branch to use by default for cloning and reviews.

  4. Select Add to add the repository.

  5. If you have finished editing the manifest file, select Save.

Add an external repository to the manifest

  1. To add an external repository to the manifest file, select Add external repository and a new line is displayed:

  2. Image of Add an external repository to the manifest file

  3. Enter the details for the external repository.

    • Repository: enter a unique name for the external repository.

    • Path: enter a unique path for the external repository.

    • Default branch: enter the branch to use by default for cloning and reviews.

    • One of the following URLs must be set:

      • HTTP URL: HTTP(S) protocol clone url of the repository.

      • SSH URL: SSH protocol clone url of the repository.

  4. Select Add to add the repository.

  5. If you have finished editing the manifest file, select Save.

Edit a repository in the manifest

  1. In the manifest editor, navigate to the repository line you want to edit.

  2. Edit the details for the repository.

    • Repository: the repository name cannot be edited.

    • Path: enter a unique path for the repository.

    • Default branch: enter the branch to use by default for cloning and reviews.

    • Only external repositories URLs can be edited: One of the following URLs must be set:

      • HTTP URL: HTTP(S) protocol clone url of the repository.

      • SSH URL: SSH protocol clone url of the repository.

  3. If you have finished editing the manifest file, select Save.

Delete a repository from the manifest

  1. In the manifest editor, navigate to the repository line you want to delete.

  2. To delete the repository from the manifest file, select X to the right of the repository settings.

  3. If you have finished editing the manifest file, select Save.

Tabs

  • The History tab provides the complete commit history for the file.

    History code browser view

  • The View raw tab displays the file content in plain code view.

    Raw code browser view

  • Select the Download tab to download the file.

  • The Share option lets you copy a Temporary URL that expires after 24 hours or a Permanent URL that you can share with others.

    To use the Share option, file sharing must be enabled for the company. See Feature settings.

    Share code browser view