Skip to content

Commit

Permalink
Merge pull request #11 from jonesbusy/feature/support-bitbucket
Browse files Browse the repository at this point in the history
Add support for Bitbucket Server
  • Loading branch information
tombreit authored Mar 7, 2024
2 parents f467fec + a1137b2 commit 68b04f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MkDocs plugin that allows you to display a list of recently modified pages from
- `repo_vendor`

Set the "vendor" of your remote repository (currently supported: `github`, `gitlab` and `gitea`) via `repo_vendor` to get linkified commit hashes and filepaths.
Set the "vendor" of your remote repository (currently supported: `bitbucket`, `github`, `gitlab` and `gitea`) via `repo_vendor` to get linkified commit hashes and filepaths.

- `limit_to_docs_dir`

Expand Down
11 changes: 10 additions & 1 deletion src/mkdocs_git_latest_changes_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"hash_url_tpl": "[{linktext}]({repo_url}/commit/{commit_hash})",
"filepath_url_tpl": "[{linktext}]({repo_url}/src/branch/{branch}/{filepath})",
},
"bitbucket": {
"hash_url_tpl": "[{linktext}]({repo_url}/commits/{commit_hash})",
"filepath_url_tpl": "[{linktext}]({repo_url}/browse/{filepath}?at={branch})",
},
}


Expand Down Expand Up @@ -90,6 +94,11 @@ def get_remote_repo_urls(
repo_url: https://<repo_url>/<ns>/<project>
commit_url: https://<repo_url>/<ns>/<project>/commit/<hash>
file_url: https://<repo_url>/<ns>/<project>/src/branch/<branch>/<filepath>
Bitbucket:
repo_url: https://<repo_url>/projects/<ns>/repos/<project>
commit_url: https://<repo_url>/projects/<ns>/repos/<project>/commits/<hash>
file_url: https://<repo_url>/projects/<ns>/repos/<project>/browse/<filepath>?at=<branch>
"""

# Initialize result dataclass with plain commit_hash and filepath,
Expand Down Expand Up @@ -168,7 +177,7 @@ def sanitize_string(string: str) -> str:

def get_repo_vendor(url: str, repo_vendor_configured: str, repo_name: str) -> str:
"""
Figure out the repo_vendor (github, gitlab, gitea)
Figure out the repo_vendor (bitbucket, github, gitlab, gitea)
"""
repo_vendor = ""

Expand Down

0 comments on commit 68b04f8

Please sign in to comment.