Giter Site home page Giter Site logo

nqminhuit / gis Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 496 KB

Java Command Line Application which extends Git for supporting git-modules

Java 98.94% Dockerfile 0.61% Emacs Lisp 0.45%
java graalvm-native-image mandrel cli git-submodules git virtual-threads-java-21

gis's People

Contributors

nqminhuit avatar

Stargazers

 avatar

Watchers

 avatar  avatar

gis's Issues

Display last fetched time

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)

gis init

When execute gis init under a directory, should create a .gis-modules files with content of all sub directories which are under git control

Do we need all the options of allow-incomplete-classpath & initialize-at-run-time

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)

Explore "interactive mode"

Can we use gis under interactive shell, which doesn't close gis after every commands. Can caches result, perform background tasks,...

[feature] Extend to support external repo

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.

Support custom default branch coloring

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

[feature] `gis status` in one line

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

expected (experiment):
image

[bug] Gis does not exit when pushing to invalid branch

$ 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

gis push `--no-interactive`

When pushing multiple modules to repos, it might be dangerous if user mis-pushes on some repos

  • Provide a question to ask for user's confirmation, should be enable by default, can be disabled with --no-interactive flag. OR:
  • Provide an interactive way for user to push.
  • Or both?

Edit:
We have implemented the push command:

  • prompt for confirmation: 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 remote
  • gis push -f <branch_name> will go through all submodules having <branch_name> and force push to existing remote
  • gis push -r <branch_name> will go through all submodules having <branch_name> and push to new remote

What left is the --no-interactive flag.

[feature] Clean up local merged branch

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

[bug] Could not distinguish staged or modified file when call `gis status`

the ## from git status has a meaning:

  • the first one is staged
  • the second one is modified, not staged.

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

Stress test gis

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 first
  • gis checkout ???

For comparison and maintain good performance, we need a big repo to stress test. Plan:

  • a git repo with ~100 submodules
  • each module (including root)
    • with ~1000 files text/code, each files cost ~ 64KB
    • ~100 commits
    • ~100 local branches
    • ~50 remote branches

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

Find out why vertx was blocked during gis fe

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)

Support `--dry-run` option

With this option, gis wont be execute any git command, instead print them out for reviewing or debugging or troubleshooting.

git fetch -q

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?

[feature] gis rebase origin/<branch_name>

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 <branch> hanged when submodules is at that <branch>

$ 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

Bump dependencies

  1. picocli to 4.7.1
  2. vertx-core to 4.4.1
  3. mandrel to quarkus/ubi-quarkus-mandrel:22.3-java17

Bundle git inside gis

To use gis user must install git under /usr/bin/git some people may install in different directory which make it harder to config. Explore if we can bundle git into the native image.

Final decision: we will bundle jgit as dependency

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.