Giter Club home page Giter Club logo

fileremoval's Introduction

fileRemoval

This is for removal of files before pushing it to GIT repository(on cloud).

CVS to GIT

We usually have CVS hosted in-house and are nowadays moving to GIT either on cloud or GIT in-premise. When we move from on-premise to cloud, we would want to remove secret file(usually containing database username, password, IP addresses, etc) from code before moving to the cloud.

I've created this script where you will have to specify CVS and GIT parameters.

Cygwin and GIT are required for this.

Cygwin

You'll need the git and git-cvs packages.

CentOS

sudo yum install git-cvs

cvs import

This example uses the project1 project from CVS, but you can substitute any other module.

To avoid hammering the remote pserver, I just copied the CVS directory straight from the server to a local directory. You can specify the remote pserver as an argument to -d but it's rather slow.

Some basic steps for cvs to git conversion.

Step 1 - Copy Entire Repo To Local Disk

# use your own project and username...
module=project1
cvsusername=MKumar
mkdir -p cvs/CVSROOT # CVS will consider cvs to be a valid repo now
scp -r $cvsusername@10.40.40.40:/usr/webdev/cvsroot/$module cvs

Where 10.40.40.40 = IP address of CVS server.

Step 2 - Run git cvsimport

# filter is a set of python regular expressions separated by '|', NOT a file glob.
filter='.*jar|databaseConfig.*|secrets.properties|keysHelper.*'
( mkdir -p git/"$module" && cd git/"$module" && git cvsimport -v -a -k -S "$filter" -d `realpath ../..`/cvs "$module" )

-v verbose -a all -k kill keywords -d the cvsroot directory; with a remote pserver, this would be something like :pserver:[email protected]:/usr/webdev/cvsroot -S skip files using (python) regular expression; in this case I intend to convert this project to maven, so I've excluded jar files as well as config files which contain passwords and filtering step is completely optional.

Troubleshooting

Check Versions

Check git and CVS versions, and verify that your PATH isn't occluded, since we want to use pure cygwin binaries here.

 $ which git
/usr/bin/git
$ which cvs
/usr/bin/cvs

$ git --version
git version 2.17.0
$ cvs --version 

How to use these scripts

Step 1 - replace cvs and git credentials in start.sh file.

Step 2 - mention your secret files for removal into conversion.sh

./start.sh  or sh start.sh

fileremoval's People

Contributors

mrajrajput avatar

Watchers

 avatar  avatar

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.