Skip to content

Commit

Permalink
Merge pull request #41 from mxstack/fix_rev
Browse files Browse the repository at this point in the history
fix use of rev
  • Loading branch information
jensens authored Feb 29, 2024
2 parents 31880e0 + a1f30c4 commit 3f92cc9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changes

### 4.0.1 (unreleased)

- Fix specifying out a revision (#40)
[pbauer]

### 4.0.0 (2024-02-28)

- Breaking: Remove `--pre` on sources from generated `requirements-mxdev.txt`.
Expand Down
22 changes: 13 additions & 9 deletions src/mxdev/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ def __init__(self, source: typing.Dict[str, str]):
if "revision" in source:
source["rev"] = source["revision"]
del source["revision"]
if "branch" in source and "rev" in source:
logger.error(
"Cannot specify both branch (%s) and rev/revision "
"(%s) in source for %s",
source["branch"],
source["rev"],
source["name"],
)
sys.exit(1)
if "rev" in source:
# drop default value for branch if rev is specified
if source.get("branch") == "main":
del source["branch"]
elif "branch" in source:
logger.error(
"Cannot specify both branch (%s) and rev/revision "
"(%s) in source for %s",
source["branch"],
source["rev"],
source["name"],
)
sys.exit(1)
super().__init__(source)

@functools.lru_cache(maxsize=4096)
Expand Down

0 comments on commit 3f92cc9

Please sign in to comment.