diff --git a/.coverage b/.coverage new file mode 100644 index 0000000..4a14745 Binary files /dev/null and b/.coverage differ diff --git a/.travis.yml b/.travis.yml index a694f7e..f820889 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,19 @@ -language: python +language: + python python: - - "3.8" # current default Python on Travis CI -# command to install dependencies -#install: -# - pip install -r requirements.txt -# command to run tests + - "3.5" +install: + - pip install -U pip + - pip install -r requirements.txt + - pip install coverage + - pip install codecov +git: + depth: 50 +jobs: + include: + - name: "project-1" + python: "3.8" script: - - python3 -m pytest + - coverage run -m pytest -q code/ +after_success: + - bash <(curl -s https://codecov.io/bash) -t 5c58df4e-d27a-405b-887b-498b8c62abc9 \ No newline at end of file diff --git a/README.md b/README.md index b48a18d..4982e0d 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,17 @@ ### GIT Simplified ![GitHub](https://img.shields.io/github/license/amolgautam25/GITS) -[![Build Status](https://travis-ci.com/amolgautam25/GITS.svg?branch=master)](https://travis-ci.com/amolgautam25/GITS) +[![Build Status](https://travis-ci.com/amolgautam25/GITS.svg?branch=master)](https://travis-ci.com/bhavesh242/GITS) ![GitHub](https://img.shields.io/badge/language-python-blue.svg) ![GitHub](https://img.shields.io/badge/language-shell-orange.svg) -![YouTube Video Views](https://img.shields.io/youtube/views/cMcftHMtIZ4?style=social) - [![DOI](https://zenodo.org/badge/295480790.svg)](https://zenodo.org/badge/latestdoi/295480790) -![GitHub issues](https://img.shields.io/github/issues/amolgautam25/GITS) -![GitHub closed issues](https://img.shields.io/github/issues-closed/amolgautam25/GITS) +![GitHub issues](https://img.shields.io/github/issues/bhavesh242/GITS) +![GitHub closed issues](https://img.shields.io/github/issues-closed/bhavesh242/GITS) -![GitHub pull requests](https://img.shields.io/github/issues-pr/amolgautam25/GITS) -![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/amolgautam25/GITS) +![GitHub pull requests](https://img.shields.io/github/issues-pr/bhavesh242/GITS) +![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/bhavesh242/GITS) -[![](https://img.youtube.com/vi/cMcftHMtIZ4/0.jpg)](https://youtu.be/cMcftHMtIZ4 "GITS demo") ### Supported functionality @@ -51,9 +48,23 @@ It is a highly simplified version of git commit command. We are actively working #### gits create_branch This automatically checks out a new branch from local master , after pulling all the changes from the remote master to local master. The idea behind this is that this new branch should have all the latest commits before a developer starts working on them. +#### gits all-branch +This command lists all the branches on both local and remote repositories. + + +#### gits remote-branch +This command lists all the branches on remote repository. + + +#### gits init +This command initializes the local repository. + #### gits logging This logs all the commands executed by the user, and also stores the output of each command +#### gits push +This pushes all the local changes of origin to the branch specified. + Note: More functionality are being added to this project. Please refer to the 'issues' tab for more information. In case you want to contribute to this project , please refer to 'Contributing.md' file. @@ -68,10 +79,10 @@ This will open up a browser and you can see all the files. You can click on a pa This repository is made for CSC 510 Software Engineering Course at NC State University. -Group 17 Team Members: +Group 15 Team Members: -Amol Gautam -Sneha Kumar -Sreeraksha Mavinhally Sreekantha -Srujana Rachakonda -Tanay Agarwal +Steve Victor Menezes +Durga Devi Mummadi +Bhavesh Shailesh Agrawal +Nikitha Thotireddy +Aadil Anwar Khan diff --git a/code/gits.py b/code/gits.py index 0ca034e..cd8b1fa 100755 --- a/code/gits.py +++ b/code/gits.py @@ -16,7 +16,8 @@ from gits_profile import gits_set_profile from gits_pr_update import gits_pr_update_func - +from gits_status import gits_status +from gits_diff import gits_diff logger_status = init_gits_logger() if not logger_status: @@ -41,6 +42,7 @@ help='all file names') gits_add_subparser.set_defaults(func=gits_add_func) + gits_commit_subparser = subparsers.add_parser('commit') gits_commit_subparser.add_argument('-m', required=True, @@ -88,6 +90,12 @@ gits_reset_subparser.set_defaults(func=gits_reset) gits_reset_subparser.add_argument('--branch', required=True, help='branch to be used') +gits_status_subparser=subparsers.add_parser('status') +gits_status_subparser.set_defaults(func=gits_status) + +gits_diff_subparser=subparsers.add_parser('diff') +gits_diff_subparser.set_defaults(func=gits_diff) + args = parser.parse_args() args.func(args) diff --git a/code/gits_diff.py b/code/gits_diff.py new file mode 100644 index 0000000..812f1bd --- /dev/null +++ b/code/gits_diff.py @@ -0,0 +1,21 @@ +import gits_logging +from subprocess import Popen, PIPE + +def gits_diff(args): + print("Welcome to git diff") + try: + subprocess_command = list() + subprocess_command.append("git") + subprocess_command.append("diff") + process=Popen(subprocess_command, stdout=PIPE, stderr=PIPE) + stdout,stderr=process.communicate() + stdout=stdout.decode("utf-8") + print(stdout) + + except Exception as e: + print("ERROR: gits diff did not run correctly") + print("ERROR: {}".format(str(e))) + + return False + + return True \ No newline at end of file diff --git a/code/gits_status.py b/code/gits_status.py new file mode 100644 index 0000000..4a69b09 --- /dev/null +++ b/code/gits_status.py @@ -0,0 +1,21 @@ +import gits_logging +from subprocess import Popen, PIPE + +def gits_status(args): + print("Welcome to gits status") + try: + subprocess_command = list() + subprocess_command.append("git") + subprocess_command.append("status") + process=Popen(subprocess_command, stdout=PIPE, stderr=PIPE) + stdout,stderr=process.communicate() + stdout=stdout.decode("utf-8") + + final=stdout.split("\n") + final = list(filter(None, final)) + for f in final: + print(f) + + except Exception as e: + print("ERROR: gits status did not run correctly") + print("ERROR: {}".format(str(e))) \ No newline at end of file diff --git a/code/test_gits_diff.py b/code/test_gits_diff.py new file mode 100644 index 0000000..d63a4e2 --- /dev/null +++ b/code/test_gits_diff.py @@ -0,0 +1,16 @@ +import argparse +import gits_diff +from mock import patch, Mock + + +@patch("argparse.ArgumentParser.parse_args", + return_value=argparse.Namespace(m="test_commit", amend=True)) +@patch("subprocess.Popen", return_value="anything") + +def test_gits_diff(mock_var, mock_args): + """ + Function to test gits_diff, success case + """ + + test_result = gits_diff.gits_diff(mock_args) + assert True == test_result, "Normal case" diff --git a/plan.md b/plan.md new file mode 100644 index 0000000..44944c3 --- /dev/null +++ b/plan.md @@ -0,0 +1,41 @@ +## Phase 1 +### Supported functionalities + - gits pr_update + - gits profile + - gits rebase + - gits reset + - gits set + - gits upstream + - gits super reset + - gits add + - gits commit + - gits create_branch + - gits logging + +The above implemented functionalities are supported only on Linux/Mac operating systems. + +## Phase 2 +### Tasks: +1. Improvise the documentation to remove ambiguity. +2. Write clear documentation for all the phase 2 functionalities. +3. Write stepwise instructions to setup the environment. +4. Write unit tests for all the GITS commands. +5. Manually test the functionalities on a dummy repository. +6. Provide code coverage solution to the project. +7. Implement functionalities listed in Functionalities section. +8. Deliver a good repository. + +### Functionalities: + - gits push + - gits sync + - gits init + - gits status + - gits diff + - gits checkout + - gits branch + - gits unstage + +### Deliverables: +1. Good testing setup with unit tests and code coverage. +2. Clear and complete documentation +3. Implementation of new functionalities.