nqminhuit / gis Goto Github PK
View Code? Open in Web Editor NEWJava Command Line Application which extends Git for supporting git-modules
Java Command Line Application which extends Git for supporting git-modules
git branch --merged=develop | grep -v "^\* develop" | xargs -n 1 -r git branch -d
When user include the flag -v
some commands should print out debug information.
https://picocli.info/autocomplete.html
According to the picocli author, we need to write additional bash function on top of generated code from picocli. Or integrate with https://github.com/jline/jline3
when run gis fe
, should add output e.g.,:
module-1
module-2
module-3
(fetched at: 10:32:58 16/10/2023)
(fetched at: HH:mm:ss dd/MM/YYYY)
with this command:
git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes
When execute gis init
under a directory, should create a .gis-modules
files with content of all sub directories which are under git control
this feature is for emacs integration, another approach is to list the folders .git/refs/heads
from all sub modules which can be done via Elisp side.
RUN native-image -cp target/gis-*.jar "org.nqm.Gis" --no-fallback --no-server
is enough, gis
is still working as normal. However there is an error:
Dec 29, 2022 3:29:51 AM io.netty.handler.ssl.BouncyCastleAlpnSslUtils <clinit>
SEVERE: Unable to initialize BouncyCastleAlpnSslUtils.
java.lang.ClassNotFoundException: org.bouncycastle.jsse.BCSSLEngine
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at io.netty.handler.ssl.BouncyCastleAlpnSslUtils.<clinit>(BouncyCastleAlpnSslUtils.java:63)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.ensureClassInitialized(ConfigurableClassInitialization.java:182)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:625)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:135)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.shouldInitializeAtRuntime(ConfigurableClassInitialization.java:163)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.SVMHost.isInitialized(SVMHost.java:289)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisType.isInitialized(AnalysisType.java:840)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.maybeEagerlyInitialize(BytecodeParser.java:4264)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1646)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1639)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5224)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3359)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3319)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3164)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:79)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:261)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:135)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:685)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:168)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:343)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:93)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:83)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraph(MethodTypeFlow.java:65)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:109)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.lambda$addObserver$0(TypeFlow.java:451)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
I often type 'gis st' a lot, could be life saver if just type 'gis' instead. 'gis --help' will display help since this is rarely used.
Can we use gis under interactive shell, which doesn't close gis
after every commands. Can caches result, perform background tasks,...
Not many projects use git submodules, however there are many microservices (or distributed system) projects use multiple git repositories. Extend gis
to support this use case.
some project will have custom default branch name like "abc_develop", config in ~/.config/gis.config
so that these branch can have default-branch-color (default to "red")
default_branches=abc_develop,def_main
Also support feature branch prefix as well
feature_branch_prefixes=feat,feature_abc
Add new flag for gis status
: --show-dirty-only
which show a quick glance at what repo has changed. Mockup:
original gis status
:
small-git-root-module
## master...origin/master
small-git-api
## master...origin/master
R. text-3 -> text-03
MM text-1
.M text-2
? newFile
small-git-schema
## master...origin/master [ahead 1, behind 2]
.M text-14
small-git-shared
## master...origin/master [ahead 1]
small-git-craft
## master...origin/master
small-git-domain
## master...origin/master
small-git-app
## master...origin/master
studious-eureka
## master...origin/master [behind 1]
M. text-44
fantastic-octo-chainsaw
## master...origin/master
literate-octo-invention
## master...origin/master
silver-tribble
## master...origin/master
? projectilessssss
$ gis push eee -v
Are you sure you want to push to remote 'eee' [Y/n] y
[DEBUG] directory 'projects/small-git-root-module' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-api' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-schema' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-shared' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-craft' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-domain' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/small-git-app' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/studious-eureka' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/fantastic-octo-chainsaw' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/literate-octo-invention' does not satisfy the predicate
[DEBUG] directory 'projects/small-git-root-module/silver-tribble' does not satisfy the predicate
so that we can use the list to integrate with Emacs
$ gis files
module1/path/to/filechanged1
module1/path/to/filechanged2
module2/path/to/changed1
or with current impl, we can get this output:
$ gis files
module1
path/to/filechanged1
path/to/filechanged2
module2
path/to/changed1
When pushing multiple modules to repos, it might be dangerous if user mis-pushes on some repos
--no-interactive
flag. OR:Edit:
We have implemented the push command:
Are you sure you want to push to remote '<branch_name>' [Y/n]
gis push <branch_name>
will go through all submodules having <branch_name> and push to existing remotegis push -f <branch_name>
will go through all submodules having <branch_name> and force push to existing remotegis push -r <branch_name>
will go through all submodules having <branch_name> and push to new remoteWhat left is the --no-interactive
flag.
current behavior: gis
asks for n
times for n
sub-modules
If there is no git sub-modules or specified modules, fall back to git
. E.g, gis status
= git status
There will be a lot of unused branches on local repositories, provide a simple command to clean up them. Ask for user's confirmation.
git command:
git branch --merged=master | grep -v "^\* master" | xargs -n 1 -r git branch -d
new wildcard characters:
*
: means create new branch for all submodules and root module-
: means create new branch for all submodules onlyIn Containerfile I have to disable tests because I don't know how to run testcontainers inside podman/docker yet.
the ##
from git status has a meaning:
for example:
git output from vanilla git:
## master...origin/master
M text-1
M text-2
from gis:
## master...origin/master
M text-1
M text-2
SHOULD:
## master...origin/master
M text-1
M text-2
Target commands:
gis
gis fetch
gis status
gis branches
gis branches -nn
gis files
: before run this, need to scramble the files to have them at modified and staged status firstgis checkout
???For comparison and maintain good performance, we need a big repo to stress test. Plan:
use this tool to record performance: https://github.com/sharkdp/hyperfine
should use container with limited resource for persistent results, can use github actions for that? https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
hyperfine examples:
execute 'gis co master' before each test run and after all
hyperfine --prepare 'gis co master' --cleanup 'gis co master' --warmup 3 'gis co br_tst_1'
add option --show-output
to see if it actually do the prepare and cleanup
Mar 19, 2022 10:46:01 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 2992 ms, time limit is 2000 ms
WARNING: Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 5990 ms, time limit is 2000 ms
io.vertx.core.VertxException: Thread blocked
at java.io.FileInputStream.readBytes(FileInputStream.java)
at java.io.FileInputStream.read(FileInputStream.java:276)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:282)
at java.io.BufferedInputStream.read(BufferedInputStream.java:343)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
at java.io.InputStreamReader.read(InputStreamReader.java:177)
at java.io.BufferedReader.fill(BufferedReader.java:162)
at java.io.BufferedReader.readLine(BufferedReader.java:329)
at java.io.BufferedReader.readLine(BufferedReader.java:396)
at org.nqm.vertx.CommandVerticle.safelyPrint(CommandVerticle.java:69)
at java.util.Optional.ifPresent(Optional.java:178)
at org.nqm.vertx.CommandVerticle.lambda$start$1(CommandVerticle.java:59)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:833)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)
With this option, gis
wont be execute any git
command, instead print them out for reviewing or debugging or troubleshooting.
Sometimes we don't need to wait for git fetch
result, we just need it to perform in background. When user type gis fe -q
, is it possible to create another process and delegate logic to it and close gis
instantly?
New command: gis push -f
which acts like git push -f
for each module. Require user confirmation!
running git rebase origin/develop
after git fetch equals to git pull
while at branch develop
We can rely on this function to avoid running gis pull
after gis fetch
$ gis fo develop
system
WARNING: Could not perform on module: 'system'
log
WARNING: Could not perform on module: 'log'
product
WARNING: Could not perform on module: 'product'
api
domain
scheduler
WARNING: Could not perform on module: 'scheduler'
grpc
WARNING: Could not perform on module: 'grpc'
...
<hanging....>
...
^C
Should have a visual indicator for modules which have code changes when run gis status
if branch = ["develop", "master", "main] => red
if branch starts with "feature/" => yellow
else => green
gis cb <new branch> <modules_list>
For simplicity, I will replace the old gis cb
command.
https://picocli.info/#_subcommands
Picocli's subcommand is more flexible
For example, we have 4 moduleA,B,C,D. When checkout new branch, not all of them will need to checkout, provide an interactive way for user to quick pick modules.
like combination of gis fetch
and gis status
in 1 command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.