forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6e43fc
commit a90de4f
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import os | ||
import textwrap | ||
import shutil | ||
import string | ||
from configparser import NoOptionError | ||
from git_fleximod import utils | ||
from git_fleximod.gitinterface import GitInterface | ||
|
@@ -162,7 +163,8 @@ def _add_remote(self, git): | |
if remotes: | ||
upstream = git.git_operation("ls-remote", "--get-url").rstrip() | ||
newremote = "newremote.00" | ||
line = next((s for s in remotes if self.url or tmpurl in s), None) | ||
tmpurl = self.url.replace("[email protected]:", "https://github.com/") | ||
line = next((s for s in remotes if self.url in s or tmpurl in s), None) | ||
if line: | ||
newremote = line.split()[0] | ||
return newremote | ||
|
@@ -357,6 +359,13 @@ def update(self): | |
|
||
if self.fxtag: | ||
smgit = GitInterface(repodir, self.logger) | ||
newremote = self._add_remote(smgit) | ||
# Trying to distingush a tag from a hash | ||
allowed = set(string.digits + 'abcdef') | ||
if not set(self.fxtag) <= allowed: | ||
# This is a tag | ||
tag = f"refs/tags/{self.fxtag}:refs/tags/{self.fxtag}" | ||
smgit.git_operation("fetch", newremote, tag) | ||
smgit.git_operation("checkout", self.fxtag) | ||
|
||
if not os.path.exists(os.path.join(repodir, ".git")): | ||
|