HTML5¼¼Êõ

SVNÌá½»ºó×Ô¶¯ÍÆËÍÏûÏ¢µ½¶¤¶¤Èº - ¼òÐþ±ù

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-05-11 10:05 ÎÒÒªÆÀÂÛ( )

SVNÌá½»ºó×Ô¶¯ÍÆËÍÏûÏ¢µ½¶¤¶¤Èº ¶¤¶¤ÉèÖûúÆ÷ÈËÅäÖÃ1¡¢½øÈëÅäÖûúÆ÷ÈËÈë¿Ú 2¡¢Ìí¼Ó»úÆ÷ÈË 3¡¢²âÊÔWebHookÇëÇó ±¾ÈËʹÓÃPostman½øÐвâÊÔ 4¡¢ÅäÖÃSVN 4.1 ÅäÖà Pre-commit hook ÉèÖÃÌá½»ÄÚÈݱØÐë°üº¬×¢ÊÍ ÅäÖòÎÊý @echo offsetlocalset REPOS=%1set TXN=%2rem

SVNÌá½»ºó×Ô¶¯ÍÆËÍÏûÏ¢µ½¶¤¶¤Èº

¶¤¶¤ÉèÖûúÆ÷ÈËÅäÖà 1¡¢½øÈëÅäÖûúÆ÷ÈËÈë¿Ú

2¡¢Ìí¼Ó»úÆ÷ÈË





3¡¢²âÊÔWebHookÇëÇó

±¾ÈËʹÓÃPostman½øÐвâÊÔ


4¡¢ÅäÖÃSVN


4.1 ÅäÖÃ Pre-commit hook
  • ÉèÖÃÌá½»ÄÚÈݱØÐë°üº¬×¢ÊÍ

  • ÅäÖòÎÊý

    @echo off setlocal set REPOS=%1 set TXN=%2 rem check that logmessage contains at least 10 characters svnlook log %REPOS% -t %TXN% | findstr "....." > nul if %errorlevel% gtr 0 goto err exit 0 :err echo ÉÏ´«Ê§°Ü£¡ÇëÌí¼Ó×¢ÊÍ. ×¢Êͳ¤¶ÈÖÁÉÙΪ5¸ö×Ö·û. Commit aborted! 1>&2 exit 1
  • 4.2 ÅäÖÃ Post-commit hook

    set REPOS=%1 set REV=%2 set tttt=%date:~0,10% %time:~0,8% for /f "tokens=1,2 delims=:" %%a in ('svnlook author -r %REV% %REPOS%') do ( if not defined AUTHOR set AUTHOR=%%a ) for /f "tokens=1,2 delims=:" %%a in ('svnlook dirs-changed %REPOS%') do ( if not defined CHANGEDDIRS set CHANGEDDIRS=%%a ) for /f "tokens=1,2 delims=:" %%a in ('svnlook log -r %REV% %REPOS%') do ( if not defined MESSAGE set MESSAGE=%%a ) set CONTENT="Ìύʱ¼ä£º%tttt% \nÌá½»°æ±¾£º%REV% \n×÷Õߣº%AUTHOR%\nÌá½»±¸×¢£º%MESSAGE%\nÐÞ¸ÄĿ¼£º%CHANGEDDIRS% " java -cp D:\svnHook.jar com.wolf.util.Request ¶¤¶¤ÁîÅÆ %CONTENT% 5 ÅäÖÃJavaÇëÇóÎļþ

    ÓÉÓÚ¶¤¶¤ÌṩµÄ½Ó¿ÚÊÇhttpsЭÒ飬curlÐèÒªÖ§³Öhttps£¬Òò´Ëͨ¹ýjava´úÂë·¢ÆðPostÇëÇ󣬴ò°ü³É¿ÉÔËÐеÄjar£¬È»ºóÓÃpost-commit hookµ÷Ó㬴«ÈëÐÅÏ¢¼´¿É¡£

    package com.wolf.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.URL; import javax.net.ssl.HttpsURLConnection; public class Request { public static void main(String[] args) throws Exception { String token = args[0]; String content = args[1]; content = "{\"msgtype\": \"text\",\"text\": {\"content\": \""+content+"\"}}"; httpsRequest("https://oapi.dingtalk.com/robot/send?access_token="+token, "POST", content); System.out.println("OK"); System.exit(0); } /** * ·¢ËÍhttpsÇëÇó */ public static String httpsRequest(String requestUrl, String requestMethod, String outputStr) throws Exception { HttpsURLConnection conn = null; BufferedReader bufferedReader = null; try { URL url = new URL(requestUrl); conn = (HttpsURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setUseCaches(false); conn.setRequestMethod(requestMethod); conn.setRequestProperty("content-type", "application/json"); if (null != outputStr) { OutputStream outputStream = conn.getOutputStream(); outputStream.write(outputStr.getBytes("utf-8")); outputStream.close(); } bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); String str = null; StringBuffer buffer = new StringBuffer(); while ((str = bufferedReader.readLine()) != null) { buffer.append(str); } return buffer.toString(); } catch (Exception e) { throw e; } finally { if (conn != null) { conn.disconnect(); } if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } } }

    ½á¹ûÈçÏ£º

    posted @

    ¡¡

    1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

    Ïà¹ØÎÄÕÂ
    • ¹ØÓÚºǫ́ϵͳ×Ô¶¯Éú³ÉµÄÒ»µã˼¿¼ - Î÷°²ÍõÀÚ

      ¹ØÓÚºǫ́ϵͳ×Ô¶¯Éú³ÉµÄÒ»µã˼¿¼ - Î÷°²ÍõÀÚ

      2017-03-13 08:02

    • ¹¹½¨×Ô¶¯»¯Ç°¶ËÑùʽ»Ø¹é²âÊÔ¡ª¡ªBackstopJSƪ - laden666666

      ¹¹½¨×Ô¶¯»¯Ç°¶ËÑùʽ»Ø¹é²âÊÔ¡ª¡ªBackstopJSƪ - laden666666

      2017-02-13 16:03

    • ÈçºÎÒ»²½Ò»²½ÓÃDDDÉè¼ÆÒ»¸öµçÉÌÍøÕ¾£¨Ê®¶þ£©¡ª¡ª Ìá½»²¢Éú³É¶©µ¥ - Zachary_Fan

      ÈçºÎÒ»²½Ò»²½ÓÃDDDÉè¼ÆÒ»¸öµçÉÌÍøÕ¾£¨Ê®¶þ£©¡ª¡ª Ìá½»²¢Éú³É¶©µ¥ - Z

      2017-02-01 16:01

    • Ç°¶Ë¹¤³Ì×Ô¶¯»¯¹¹½¨×ܽá - bjtqti

      Ç°¶Ë¹¤³Ì×Ô¶¯»¯¹¹½¨×ܽá - bjtqti

      2017-01-10 15:00

    ÍøÓѵãÆÀ
    â