Giter Club home page Giter Club logo

java_coursework_8th's People

Contributors

callumyang avatar keira-hq avatar skyseaee avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

keira-hq

java_coursework_8th's Issues

关于最终的展示的呈现

呈现内容包括以下个模块:

  • 主要实现的功能
  • 代码模块的划分
  • 代码文档、注释、单元测试情况
  • 合作情况
  • 细节实现两点

简单的git diff功能实现

目前只实现了比较两个文件a和b的diff
通过path[i][j]记录路径 1表示增加一行 -1表示删除一行 0表示不变
dp[i][j]表示a的前i行和b的前j行需要的修改次数则有
如果a的第i行等于b的第j行
dp[i][j] = min(dp[i-1][j-1],dp[i-1][j],dp[i][j-1])
否则
dp[i][j] = min(dp[i-1][j],dp[i][j-1])
为了使得加号和减号尽量聚集,每次先比较dp[i-1][j]和dp[i][j-1]相等时取dp[i][j-1]
然后通过滚动数组优化成一维数组
通过递归输出路径
image

关于最后成果的功能

最后成果:
实现命令行交互,分支,回滚
命令行交互实现:
使用Scanner传送命令
分支功能实现:

  • 创建一个文件夹,文件夹命名为branch,文件夹中的每个文件是各个分支的信息(初始状态下,branch文件夹中有一个名为main的空文件)
  • 每新建一个分支,在branch文件夹中增加一个以该分支名命名的文件,每次commit将commit的key写入对应的分支文件中
  • 每次commit将其对应的分支名写入head文件中
    回滚功能:
    找到需要回滚的commit的key,然后回滚,再修改head

关于单元测试的一些思路

测试文件的创建

  • 创建文件夹以及在对应的文件夹下面创建文件,文件内容可以是一段随机数+随机字母等形式,文件名称用一些组合规则进行规范(非必须)方便后续验证

自动化验证:

  • 创建一个方法来进行对应的哈希值的检验,验证文件夹对应的文件内容是否是文件夹对应的子文件或子文件夹的哈希以及blob / tree是否正确
  • 创建一个方法来进行自动的查询
  • 创建一个方法来进行commit的提交
  • 创建一个方法来进行commit的回滚等操作
    暂时我的想法就是这样 @keira-hq

关于commit

Commit的一些基础思路

创建一个commit的类来规范化每次commit,思路由 @keira-hq 写在文档中,其他就交给大佬了 @callumyang

暂存区的一些思路

https://img-blog.csdn.net/20160807164529000

  • 工作区(working directory)

  • 暂存区(staging area/index) git add .

    • 执行git add .命令
      • 将要提交的所有类型是文件的生成blob对象,放在objects中
      • 更新index.txt文件中的内容(首次commit,生成index.txt)
      • Index.txt中的每条索引记录的是blob对象的哈希值和其文件名
  • 仓库区(repository 本地仓库) git commit

    • 执行git commit
      • 生成index.txt中的所有索引的tree对象 Tree对象放入objects中
      • 根据最顶层的tree生成commit对象,并记录在head和对应的branch中
  • 一些操作命令示例:

    • git rm 时,把工作区中的这个文件以及暂存区中的这个文件索引都删除
    • git rm –cached 时,只把暂存区中的索引删去
    • git mv file2.txt file3.txt时,工作区中的文件被重命名(file2被重命名为file3),而索引区中的原file2的索引被删除掉了,然后重新添加了一条索引

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.