Revision 650

Date:
2017/06/13 17:00:03
Author:
ahitrov
Revision Log:
GIT commands implementation

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/GNUmakefile

     
    65 65 core_status cst \
    66 66 core_update cup \
    67 67 core_commit cci \
    68 core_checkout cco \
    69 core_push cpush \
    70 core_pull cpull \
    71 core_branch cbranch \
    72 core_merge cmerge \
    68 73 core_install cin \
    69 74 core_info cinfo \
    70 75 core_rsync crs \
    71 76 \
    77 project_assets assets \
    78 project_assets_dev assdev \
    72 79 project_status pst \
    73 80 project_update pup \
    74 81 project_commit pci \
    82 project_checkout pco \
    83 project_push ppush push \
    84 project_pull ppull pull \
    85 project_branch pbranch branch \
    86 project_merge pmerge merge \
    75 87 project_install pin \
    76 88 project_conf conf \
    77 89 project_rsync prs \
    90 project_assets_rsync ars \
    78 91 project_start start \
    79 92 project_stop stop \
    80 93 project_create create \
     
    91 104 \
    92 105 plugin_create plc \
    93 106 plugins_commit plci \
    107 plugins_checkout plco \
    108 plugins_push plpush \
    109 plugins_pull plpull \
    110 plugins_branch plbranch \
    111 plugins_merge plmerge \
    94 112 plugins_install plin \
    95 113 plugins_status plst \
    96 114 plugins_update plup \
     
    158 176 # check core sources via repository
    159 177 cst: core_status ;
    160 178 core_status: check_user
    179 ifeq (${VCS_TYPE},git)
    180 @echo ${PROJ_SRC}/${PROJECT}
    181 @cd ${CORE_SRC} && git status
    182 else
    161 183 @svn st -u ${CORE_SRC}
    184 endif
    162 185 @echo $@ done
    163 186
    164 187 # update core sources from repository
    165 188 cup: core_update ;
    166 189 core_update: check_user
    167 ifdef REV
    168 @svn up -r ${REV} ${CORE_SRC}
    190 ifeq (${VCS_TYPE},git)
    191 @cd ${CORE_SRC} \
    192 && echo ">>>> core git pull" \
    193 && git pull;
    169 194 else
    170 @svn up ${CORE_SRC}
    195 @if [ -n "${REV}" ]; then \
    196 svn up -r ${REV} ${CORE_SRC}; \
    197 else \
    198 svn up ${CORE_SRC}; \
    199 fi;
    171 200 endif
    172 201 @echo $@ done
    173 202
    174 203 # commit core changes to repository
    175 204 cci: core_commit ;
    176 205 core_commit: check_user
    206 ifeq (${VCS_TYPE},git)
    207 @cd ${CORE_SRC} && git commit -a
    208 else
    177 209 @svn ci ${CORE_SRC}
    210 endif
    178 211 @echo $@ done
    179 #
    212
    180 213 # pretty formatted core info
    181 214 cinfo: core_info ;
    182 215 core_info:
     
    190 223 @echo $@ done
    191 224
    192 225
    226 # core git checkout and branch switcher
    227 cco: core_checkout ;
    228 core_checkout:
    229 @cd ${PROJ_SRC}/${PROJECT} \
    230 && echo ">>>> git checkout ${BRANCH}" \
    231 && git checkout ${BRANCH};
    232 @echo $@ done
    233
    234 # core git branch workaround.
    235 # Uses NAME as branch name for creation, FROM for branch source and DELETE=1 for branch delete
    236 cbranch: core_branch ;
    237 core_branch:
    238 @if [ -n "${NAME}" -a -n "${FROM}" ]; then \
    239 cd ${CORE_SRC} \
    240 && echo ">>>> git checkout -b ${NAME} ${FROM}" \
    241 && git checkout -b ${NAME} ${FROM}; \
    242 elif [ -n "${NAME}" -a -n "${DELETE}" ]; then \
    243 cd ${CORE_SRC} \
    244 && echo ">>>> git branch -d ${NAME}" \
    245 && git branch -d ${NAME}; \
    246 elif [ -n "${NAME}" ]; then \
    247 cd ${CORE_SRC} \
    248 && echo ">>>> git checkout -b ${NAME}" \
    249 && git checkout -b ${NAME}; \
    250 else \
    251 cd ${CORE_SRC} \
    252 && git branch -v; \
    253 fi;
    254 @echo $@ done
    255
    256 # core git merge
    257 cmerge: core_merge ;
    258 core_merge:
    259 @if [ -n "${BRANCH}" ]; then \
    260 cd ${CORE_SRC} \
    261 && echo ">>>> git merge --no-ff ${BRANCH}" \
    262 && git merge --no-ff ${BRANCH}; \
    263 else \
    264 echo "Don't know what branch merge to current. Usage: make merge BRANCH=branch-to-merge-with"; \
    265 fi;
    266 @echo $@ done
    267
    268 # core git push
    269 cush: core_push ;
    270 cpush: core_push ;
    271 core_push:
    272 @cd ${CORE_SRC} \
    273 && echo ">>>> git push" \
    274 && git push;
    275 @echo $@ done
    276
    277 # core git pull
    278 cull: core_pull ;
    279 cpull: core_pull ;
    280 core_pull:
    281 cd ${CORE_SRC} \
    282 && echo ">>>> git pull" \
    283 && git pull;
    284 @echo $@ done
    285
    193 286 # install core into work directory
    194 287 cin: core_install ;
    195 288 ifeq (${DB_TYPE},SINGLE)
     
    233 326 # check project sources via repository
    234 327 pst: project_status ;
    235 328 project_status:: check_project
    329 ifeq (${VCS_TYPE},git)
    330 @cd ${PROJ_SRC}/${PROJECT} && git status
    331 else
    236 332 @svn st -u ${PROJ_SRC}/${PROJECT}
    333 endif
    237 334 @echo $@ done
    238 335
    239 # pretty formatted project info
    336 # pretty formatted project info (svn only)
    240 337 pinfo: project_info ;
    241 338 project_info:: check_project
    242 339 @REPOS=`svn info ${PROJ_SRC}/${PROJECT} | grep -E '^URL' | sed -E 's/URL: //'`; \
     
    248 345 # update project sources from repository
    249 346 pup: project_update ;
    250 347 project_update:: check_project
    251 ifdef REV
    252 @svn up -r ${REV} ${PROJ_SRC}/${PROJECT}
    348 ifeq (${VCS_TYPE},git)
    349 @if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    350 cd ${PROJ_SRC}/${PROJECT} \
    351 && echo ">>>> git pull" \
    352 && git pull; \
    353 fi;
    253 354 else
    254 @svn up ${PROJ_SRC}/${PROJECT}
    355 @if [ -n "${REV}" ]; then \
    356 svn up -r ${REV} ${PROJ_SRC}/${PROJECT}; \
    357 else \
    358 svn up ${PROJ_SRC}/${PROJECT}; \
    359 fi;
    255 360 endif
    256 361 @echo $@ done
    257 362
    258 363 # commit project changes to repository
    259 364 pci: project_commit ;
    260 365 project_commit:: check_project
    366 ifeq (${VCS_TYPE},git)
    367 @cd ${PROJ_SRC}/${PROJECT} && git commit -a
    368 else
    261 369 @svn ci ${PROJ_SRC}/${PROJECT}
    370 endif
    262 371 @echo $@ done
    263 372
    373 # project git checkout and branch switcher
    374 pco: project_checkout ;
    375 project_checkout:: check_project
    376 @if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    377 cd ${PROJ_SRC}/${PROJECT} \
    378 && echo ">>>> git checkout ${BRANCH}" \
    379 && git checkout ${BRANCH}; \
    380 fi;
    381 @echo $@ done
    382
    383 # project git branch workaround.
    384 # Uses NAME as branch name for creation, FROM for branch source and DELETE=1 for branch delete
    385 branch: project_branch ;
    386 pbranch: project_branch ;
    387 project_branch:: check_project
    388 @if [ -n "${NAME}" -a -n "${FROM}" ]; then \
    389 cd ${PROJ_SRC}/${PROJECT} \
    390 && echo ">>>> git checkout -b ${NAME} ${FROM}" \
    391 && git checkout -b ${NAME} ${FROM}; \
    392 elif [ -n "${NAME}" -a -n "${DELETE}" ]; then \
    393 cd ${PROJ_SRC}/${PROJECT} \
    394 && echo ">>>> git branch -d ${NAME}" \
    395 && git branch -d ${NAME}; \
    396 elif [ -n "${NAME}" ]; then \
    397 cd ${PROJ_SRC}/${PROJECT} \
    398 && echo ">>>> git checkout -b ${NAME}" \
    399 && git checkout -b ${NAME}; \
    400 else \
    401 cd ${PROJ_SRC}/${PROJECT} \
    402 && git branch -v; \
    403 fi;
    404 @echo $@ done
    405
    406 # project git merge
    407 merge: project_merge ;
    408 pmerge: project_merge ;
    409 project_merge:: check_project
    410 @if [ -d ${PROJ_USR}/${PROJECT} -a -n "${BRANCH}" ]; then \
    411 cd ${PROJ_SRC}/${PROJECT} \
    412 && echo ">>>> git merge --no-ff ${BRANCH}" \
    413 && git merge --no-ff ${BRANCH}; \
    414 else \
    415 echo "Don't know what branch merge to current. Usage: make merge BRANCH=branch-to-merge"; \
    416 fi;
    417 @echo $@ done
    418
    419 # project git push
    420 push: project_push ;
    421 ppush: project_push ;
    422 project_push:: check_project
    423 @if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    424 cd ${PROJ_SRC}/${PROJECT} \
    425 && echo ">>>> git push" \
    426 && git push; \
    427 fi;
    428 @echo $@ done
    429
    430 # project git pull
    431 pull: project_pull ;
    432 ppull: project_pull ;
    433 project_pull:: check_project
    434 @if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    435 cd ${PROJ_SRC}/${PROJECT} \
    436 && echo ">>>> git pull" \
    437 && git pull; \
    438 fi;
    439 @echo $@ done
    440
    264 441 # install project into work directory
    265 442 pin: project_install ;
    266 443 project_install:: check_core_installed check_project
     
    276 453 @if [ -n "${RSYNC_COMMAND}" ]; then \
    277 454 ${RSYNC_COMMAND} -a --delete --delete-excluded --include='tags' --include '*.exe' --cvs-exclude --exclude '*.proto' ${PROJ_SRC}/${PROJECT}/* ${PROJ_USR}/${PROJECT}; \
    278 455 else \
    279 if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    280 rm -Rf ${PROJ_USR}/${PROJECT}; \
    281 fi; \
    282 mkdir ${PROJ_USR}/${PROJECT} \
    283 && cp ${PROJ_SRC}/${PROJECT}/config.mk ${PROJ_USR}/${PROJECT}/ \
    284 && cp -R ${PROJ_SRC}/${PROJECT}/conf ${PROJ_USR}/${PROJECT}/ \
    285 && cp -R ${PROJ_SRC}/${PROJECT}/comps ${PROJ_USR}/${PROJECT}/ \
    286 && cp -R ${PROJ_SRC}/${PROJECT}/lib ${PROJ_USR}/${PROJECT}/ \
    287 && cp -R ${PROJ_SRC}/${PROJECT}/services ${PROJ_USR}/${PROJECT}/ \
    288 && find ${PROJ_USR}/${PROJECT}/ -depth -type d -name .svn -exec rm -Rf {} \; \
    289 && find ${PROJ_USR}/${PROJECT}/ -depth -type d -name .git -exec rm -Rf {} \; \
    456 if [ -d ${PROJ_USR}/${PROJECT} ]; then \
    457 rm -Rf ${PROJ_USR}/${PROJECT}; \
    458 fi; \
    459 mkdir ${PROJ_USR}/${PROJECT} \
    460 && cp ${PROJ_SRC}/${PROJECT}/config.mk ${PROJ_USR}/${PROJECT}/ \
    461 && cp -R ${PROJ_SRC}/${PROJECT}/comps ${PROJ_USR}/${PROJECT}/ \
    462 && cp -R ${PROJ_SRC}/${PROJECT}/conf ${PROJ_USR}/${PROJECT}/ \
    463 && cp -R ${PROJ_SRC}/${PROJECT}/lib ${PROJ_USR}/${PROJECT}/ \
    464 && cp -R ${PROJ_SRC}/${PROJECT}/services ${PROJ_USR}/${PROJECT}/ \
    465 && find ${PROJ_USR}/${PROJECT}/ -depth -type d -name .svn -exec rm -Rf {} \; \
    290 466 && find ${PROJ_USR}/${PROJECT}/ -depth -type f -name '*.proto' -exec rm -f {} \; ; \
    291 467 fi
    292 468
     
    301 477 @if [ \! -e ${CORE_USR}/lib/${PROJECT} ]; then \
    302 478 chmod u+w ${CORE_USR}/lib \
    303 479 && ln -s ${PROJ_USR}/${PROJECT}/lib/${PROJECT} \
    304 ${CORE_USR}/lib/${PROJECT} \
    480 ${CORE_USR}/lib/${PROJECT} \
    305 481 && chmod u-w ${CORE_USR}/lib; \
    306 482 fi;
    307 483
     
    345 521
    346 522 # commit plugin changes
    347 523 plugin_commit_%:
    524 ifeq (${VCS_TYPE},git)
    525 @cd ${PLUG_SRC}/${*} && git commit -a
    526 else
    348 527 @svn ci ${PLUG_SRC}/${*}
    528 endif
    349 529 @echo $@ done
    350 530
    351 531 # status of plugins sources via repository
     
    362 542
    363 543 # status of plugin sources from repository
    364 544 plugin_status_%:
    545 ifeq (${VCS_TYPE},git)
    546 @cd ${PLUG_SRC}/${*} && git status
    547 else
    365 548 @svn st -u ${PLUG_SRC}/${*}
    549 endif
    366 550 @echo $@ done
    367 551
    368 552 # update plugins sources from repository
     
    379 563
    380 564 # update plugin sources from repository
    381 565 plugin_update_%:
    566 ifeq (${VCS_TYPE},git)
    567 @cd ${PLUG_SRC}/${*} && git pull
    568 else
    382 569 @svn up ${PLUG_SRC}/${*}
    570 endif
    383 571 @echo $@ done
    384 572
    573 # plugins git checkout and branch switcher
    574 plco: plugins_checkout ;
    575 plugins_checkout:
    576 ifdef PLUGIN
    577 @${MAKE} -s plugin_checkout_${PLUGIN}
    578 else
    579 @for P in ${PLUGINS}; do \
    580 ${MAKE} -s plugin_checkout_$${P}; \
    581 done;
    582 endif
    583 @echo $@ done
    584
    585 # plugin git checkout and branch switcher
    586 plugin_checkout_%:
    587 @cd ${PLUG_SRC}/${*} && git checkout ${BRANCH};
    588 @echo $@ done
    589
    590 # plugins git branch workaround
    591 plbranch: plugins_branch ;
    592 plugins_branch:
    593 ifdef PLUGIN
    594 @${MAKE} -s plugin_branch_${PLUGIN}
    595 else
    596 @for P in ${PLUGINS}; do \
    597 ${MAKE} -s plugin_branch_$${P}; \
    598 done;
    599 endif
    600 @echo $@ done
    601
    602 # plugin git checkout and branch switcher
    603 plugin_branch_%:
    604 @if [ -n "${NAME}" -a -n "${FROM}" ]; then \
    605 cd ${PLUG_SRC}/${*} \
    606 && git checkout -b ${NAME} ${FROM}; \
    607 elif [ -n "${NAME}" -a -n "${DELETE}" ]; then \
    608 cd ${PLUG_SRC}/${*} \
    609 && git branch -d ${NAME}; \
    610 elif [ -n "${NAME}" ]; then \
    611 cd ${PLUG_SRC}/${*} \
    612 && git checkout -b ${NAME}; \
    613 else \
    614 cd ${PLUG_SRC}/${*} \
    615 && git branch -v; \
    616 fi;
    617 @echo $@ done
    618
    619 # plugins git merge
    620 plmerge: plugins_merge ;
    621 plugins_merge:
    622 ifdef PLUGIN
    623 @${MAKE} -s plugin_merge_${PLUGIN}
    624 else
    625 @for P in ${PLUGINS}; do \
    626 ${MAKE} -s plugin_merge_$${P}; \
    627 done;
    628 endif
    629 @echo $@ done
    630
    631 # plugin git checkout and branch switcher
    632 plugin_merge_%:
    633 @cd ${PLUG_SRC}/${*} && git merge --no-ff ${BRANCH};
    634 @echo $@ done
    635
    636 # plugins git push
    637 plush: plugins_push ;
    638 plpush: plugins_push ;
    639 plugins_push:
    640 ifdef PLUGIN
    641 @${MAKE} -s plugin_push_${PLUGIN}
    642 else
    643 @for P in ${PLUGINS}; do \
    644 ${MAKE} -s plugin_push_$${P}; \
    645 done;
    646 endif
    647 @echo $@ done
    648
    649 # plugin git checkout and branch switcher
    650 plugin_push_%:
    651 @cd ${PLUG_SRC}/${*} && git push;
    652 @echo $@ done
    653
    654 # plugins git pull
    655 plull: plugins_pull ;
    656 plpull: plugins_pull ;
    657 plugins_pull:
    658 ifdef PLUGIN
    659 @${MAKE} -s plugin_pull_${PLUGIN}
    660 else
    661 @for P in ${PLUGINS}; do \
    662 ${MAKE} -s plugin_pull_$${P}; \
    663 done;
    664 endif
    665 @echo $@ done
    666
    667 # plugin git checkout and branch switcher
    668 plugin_pull_%:
    669 @cd ${PLUG_SRC}/${*} && git pull;
    670 @echo $@ done
    671
    672
    385 673 # install plugins into work directory
    386 674 plin: plugins_install ;
    387 675 plugins_install: check_project_installed
     
    449 737 exit 1; \
    450 738 fi;
    451 739
    452 @mkdir -p ${PLUG_SRC} \
    740 @mkdir -p ${PLUG_SRC} \
    453 741 && cp -Rp ${CORE_SRC}/skel/plugin ${PLUG_SRC}/${NAME} \
    454 742 && find ${PLUG_SRC}/${NAME}/ -depth -type d -name .svn -exec rm -Rf {} \; \
    455 743 && find ${PLUG_SRC}/${NAME}/ -depth -type f -name '*.proto' -and \
     
    552 840
    553 841
    554 842 ifeq (${DISABLE},YES)
    555 @crontab -l | sed 's/^#*/#/' | crontab -; \
    843 @crontab -l | sed 's/^#*/#/' | crontab -; \
    556 844 echo "Disabled crontab"
    557 845 else
    558 846 @if [ -f ${PROJ_USR}/${PROJECT}/conf/etc/crontab ]; then \
     
    1329 1617 STATIC_SOURCE_ENABLE \
    1330 1618 STATIC_SOURCE_TOUCH_FILE \
    1331 1619 STORE_METHOD \
    1620 VCS_TYPE \
    1332 1621
    1333 1622 #TODO: ElTexto compatibility only
    1334 1623 REWRITE += \
  • utf8/core/project-default.mk

     
    35 35 # additional ports if any
    36 36 PROJECT_REQUIRED ?=
    37 37 SERIALIZE_WITH ?=
    38 VCS_TYPE ?= svn
    38 39
    39 40 # defaults
    40 41 PRELOADS ?=