03-Assignment 1: Pushy 作业详解一Subset 2(unsw作业-COMP(2041|9044) - 24T1)新南威尔士大学UNSW课程作业指导

本文详细解析了新南威尔士大学UNSW COMP2041|9044课程的Assignment 1中的Subset 2,包括pushy-branch、pushy-checkout和pushy-merge的命令实现。这部分作业要求使用POSIX兼容Shell编写,涉及创建、删除分支、切换分支及合并操作,难度较大,需要深入理解版本控制系统和Shell编程。
摘要由CSDN通过智能技术生成

https://cgi.cse.unsw.edu.au/~cs2041/24T1/assignments/ass1/index.html

Subset 2 原题

Subset 2 is extremely difficult. You will need to spend considerable time understanding the semantics of these operations, by running the reference implementation, and/or researching the equivalent Git operations.

Note the assessment scheme recognises this difficulty.

Subset 2 commands must be implemented in POSIX-compatible Shell.

See the Permitted Languages section for more information.

pushy-branch [-d] [branch-name]

pushy-branch either creates a branch, deletes a branch, or lists current branch names.

If branch-name is omitted, the names of all branches are listed.

If branch-name is specified, then a branch with that name is created or deleted,
depending on whether the -d option is specified.

pushy-checkout branch-name

pushy-checkout switches branches.

Note that, unlike Git, you can not specify a commit or a file: you can only specify a branch.

pushy-merge (branch-name|commit-number) -m message

pushy-merge adds the changes that have been made to the specified branch or commit to the index, and commits them.

Subset 2 examples

./pushy-init
Initialized empty pushy repository in .pushy
seq 1 7 >7.txt
./pushy-add 7.txt
./pushy-commit -m commit-1
Committed as commit 0
./pushy-branch b1
./pushy-checkout b1
Switched to branch 'b1'
sed -Ei 's/2/42/' 7.txt
cat 7.txt
1
42
3
4
5
6
7
./pushy-commit -a -m commit-2
Committed as commit 1
./pushy-checkout master
Switched to branch 'master'
cat 7.txt
1
2
3
4
5
6
7
./pushy-merge b1 -m merge-message
Fast-forward: no commit created
cat 7.txt
1
42
3
4
5
6
7

If a file has been changed in both branches pushy-merge

  • 17
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值