• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

File handling  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hihi, I have some questions here and I hope that you all can help me out with them. So I was trying to create a Java program that mimics some of the functions that git has. But I need some guidance on the suitable ways to do it. Let's call the program not-git. It has the similar basic functions that git has, including the 1. status command showing the status of files in the respective folder (tracked/not tracked), 2. add command adding a file to the repository while tracking it (e.g. add "file.txt"), 3. commit command to commit the files being tracked with an increasing counter (commit id). 4. revert  command to reverse the version of current file into the previous version with a new commit ID (e.g. revert 1 will revert current version into version of commitID 1 but now the new version will have a new commitID, if before reverting the commitID is 2 now the commitID will be 3 for this version). I have attached some images below (I tried uploading ppt, docs and pdf but none of them works) if the explanation above isn't clear enough. I have some ideas in mind but not sure whether it is feasible, so I will create a LinkedList that accepts file as its parameter and store it in a node when an add command is issued, and there will be a counter with a default value of 1 that increases per commit. Whenever a revert command is issued, the list will be used to lookup the content of the node index. The functions mentioned above were just the basic requirements to achieve the passing marks, to achieve better grades we were suggested to add extra features like modifying the status command into showing not only the tracked files but also the new files, untracked files, and the modified files. The other extra features to improve the program are also included in the file uploaded. Thank you for taking your time reading this and I appreciate any help provided!
Screenshot-(146).png
[Thumbnail for Screenshot-(146).png]
Screenshot-(147).png
[Thumbnail for Screenshot-(147).png]
Screenshot-(148).png
[Thumbnail for Screenshot-(148).png]
 
Nathaniel Oyt
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rest...
Screenshot-(149).png
[Thumbnail for Screenshot-(149).png]
Screenshot-(150).png
[Thumbnail for Screenshot-(150).png]
Screenshot-(151).png
[Thumbnail for Screenshot-(151).png]
 
Nathaniel Oyt
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main concern here is how do I collect a pile of files and store them into one node of LinkedList. And also when I revert how do obtain the files from the prev commit and replace the current ones. Thank you in advance for any help incoming!
 
Nathaniel Oyt
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And also how to know when the content of the file is altered (modified)? Since the assignment requires to display the status of files not only tracked/untracked but also modified/new.
 
Marshal
Posts: 64166
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I merged your stuff with the following thread. I hope that is okay by you.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hihi, I have some questions here and I hope that you all can help me out with them. So I was trying to create a Java program that mimics some of the functions that git has. But I need some guidance on the suitable ways to do it. Let's call the program not-git. It has the similar basic functions that git has, including the 1. status command showing the status of files in the respective folder (tracked/not tracked), 2. add command adding a file to the repository while tracking it (e.g. add "file.txt"), 3. commit command to commit the files being tracked with an increasing counter (commit id). 4. revert  command to reverse the version of current file into the previous version with a new commit ID (e.g. revert 1 will revert current version into version of commitID 1 but now the new version will have a new commitID, if before reverting the commitID is 2 now the commitID will be 3 for this version). I have attached some images below (I tried uploading ppt, docs and pdf but none of them works) if the explanation above isn't clear enough.  I have some ideas in mind but not sure whether it is feasible, so I will create a LinkedList that accepts file as its parameter and store it in a node when an add command is issued, and there will be a counter with a default value of 1 that increases per commit. Whenever a revert command is issued, the list will be used to lookup the content of the node index. The functions mentioned above were just the basic requirements to achieve the passing marks, to achieve better grades we were suggested to add extra features like modifying the status command into showing not only the tracked files but also the new files, untracked files, and the modified files. The other extra features to improve the program are also included in the file uploaded. Thank you for taking your time reading this and I appreciate any help provided!
https://ibb.co/9qXyTRZ
https://ibb.co/qyF5yLp
https://ibb.co/5MZd71G
https://ibb.co/tJ3hmc7
https://ibb.co/9vdjYSN
https://ibb.co/hB7FhSW
The main concern here is how do I collect a pile of files and store them into one node of LinkedList. And also when I revert how do obtain the files from the prev commit and replace the current ones. Thank you in advance for any help incoming!
And also how to know when the content of the file is altered (modified)? Since the assignment requires to display the status of files not only tracked/untracked but also modified/new.



 
Campbell Ritchie
Marshal
Posts: 64166
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This appears to be thee same question as you asked earlier; I shall join the two discussions together.
 
Nathaniel Oyt
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure do, I've solved the issues of tracked untracked nee modified and so on, now the problems are how do I create a new repository whenever a list of files is going to be destroyed (when not-git functions is issued again)?
 
Campbell Ritchie
Marshal
Posts: 64166
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you do that exercise one stage at a time. Start with part 1. Work out what the functionality you want is and write it down. But no words used in computing are permitted.

[edit]I didn't know about your most recent post when I wrote this reply.
 
Nathaniel Oyt
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will post my modified codes here sooner or later, on a long trip now. Thanks for the reply btw.
 
Campbell Ritchie
Marshal
Posts: 64166
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I merged your stuff with the following thread. I hope that is okay by you.
 
Ong Nathaniel Yii Tak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey sorry, was busy ytd. Will upload my codes now.


 
What's brown and sticky? ... a stick. Or a tiny ad.
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!