Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Commander
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INS Courses
AutPy
Commander
Commits
48a77b3b
Commit
48a77b3b
authored
2 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Use autpy lib to get student branches
parent
0d9f6e0a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
commander/gui/git.py
+0
-23
0 additions, 23 deletions
commander/gui/git.py
commander/gui/selectors.py
+2
-1
2 additions, 1 deletion
commander/gui/selectors.py
commander/gui/zapper.py
+7
-6
7 additions, 6 deletions
commander/gui/zapper.py
with
9 additions
and
30 deletions
commander/gui/git.py
+
0
−
23
View file @
48a77b3b
...
...
@@ -23,29 +23,6 @@ def run(*args: str, **kwargs: Any) -> subprocess.CompletedProcess:
)
def
get_student_branches
()
->
list
[
str
]:
proc
=
run
(
"
for-each-ref
"
,
"
--format=%(refname:short)
"
,
"
--sort=-authordate
"
,
"
refs/remotes/origin
"
,
)
return
[
utils
.
removeprefix
(
branch
,
"
origin/
"
)
for
branch
in
proc
.
stdout
.
splitlines
()
if
"
.
"
in
branch
]
def
get_student_heads
()
->
list
[
tuple
[
str
,
str
]]:
proc
=
run
(
"
for-each-ref
"
,
"
--format=%(refname:short) %(objectname)
"
,
"
refs/remotes/origin
"
)
return
[
line
.
split
()
for
line
in
proc
.
stdout
.
splitlines
()
if
"
.
"
in
line
]
class
GitFetcher
(
QObject
):
INTERVAL
=
10
*
1000
# 10s
...
...
This diff is collapsed.
Click to expand it.
commander/gui/selectors.py
+
2
−
1
View file @
48a77b3b
...
...
@@ -18,6 +18,7 @@ from PyQt6.QtGui import QKeySequence, QAction
from
PyQt6.QtCore
import
Qt
,
pyqtSlot
,
pyqtSignal
,
QStringListModel
from
commander.gui
import
utils
,
git
from
autpy
import
submissions
class
Selector
(
QLineEdit
):
...
...
@@ -113,7 +114,7 @@ class BranchSelector(Selector):
self
.
accept_text
(
branch
)
def
_get_data
(
self
)
->
list
[
str
]:
return
git
.
get_student_branches
()
return
[
info
.
short_name
for
info
in
submissions
.
get_student_branches
()
]
def
accept_text
(
self
,
text
:
str
)
->
None
:
proc
=
git
.
run
(
"
checkout
"
,
f
"
origin/
{
text
}
"
)
...
...
This diff is collapsed.
Click to expand it.
commander/gui/zapper.py
+
7
−
6
View file @
48a77b3b
...
...
@@ -16,6 +16,7 @@ from PyQt6.QtGui import QKeySequence, QAction
from
PyQt6.QtWidgets
import
QLabel
,
QWidget
,
QApplication
from
commander.gui
import
git
,
utils
from
autpy
import
submissions
SHORT_SHA_LEN
=
7
...
...
@@ -170,19 +171,19 @@ class GlobalZapper(QObject):
stats
.
tags
+=
len
(
tags
)
def
_collect_submissions
(
self
,
stats
:
CollectionStats
)
->
None
:
for
branch
,
commit
in
git
.
get_student_he
ad
s
():
for
branch
_info
in
submissions
.
get_student_
branc
hes
():
stats
.
branches
+=
1
info
=
self
.
_submitted
[
branch
]
info
=
self
.
_submitted
[
branch
_info
.
name
]
if
info
.
commit
==
commit
:
if
info
.
commit
==
branch_info
.
commit
:
continue
info
.
branch
=
branch
info
.
commit
=
commit
info
.
branch
=
branch
_info
.
name
info
.
commit
=
branch_info
.
commit
stats
.
changed_branches
+=
1
for
file_info
in
self
.
_collect_files
(
branch
):
for
file_info
in
self
.
_collect_files
(
branch
_info
.
name
):
# FIXME use a queue of QProcesses instead?
QApplication
.
processEvents
()
info
.
files
.
append
(
file_info
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment