Code Freeze Monitor

Orion SSH2 is a library which implements the SSH-2 protocol in pure Java. It allows one to connect to SSH servers from within Java programs for remote shell and command execution.  In this case we use ssh for execution of the Subversion (open source version control system) commands.

Command svnlook returns all revisions, so I use gawk to pick only first and last for the requested branch, and then send that boundaries as a parameters to the svn log command.

<%@page contentType=”text/html” pageEncoding=”UTF-8″ import=”*,com.trilead.ssh2.*”%>
<!DOCTYPE html>
<%String ver=request.getParameter(“ver”);
      String hostname = “…”;
      String username = “…”;
      String password = “…”;
      try { Connection conn = new Connection(hostname);
            if(conn.authenticateWithPassword(username, password) == false)
               throw new IOException(“Authentication failed.”);
           Session sess = conn.openSession();
           String cmd=”svnlook history /svnroot/zis /REL/it_v2.28 | gawk ‘$2==\”/REL/it_v2.28\” {x+=1; a[x]=$1;} END {print a[1]; print a[x];}‘”;
         cmd+=” | (read line; hi=$line; read line; lo=$line; svn log
http://svnhost/it_v2.28 -r$lo:$hi -v)”;
         if(ver!=null) { cmd=cmd.replaceAll(“2.28”,ver);}
         InputStream stdout = new StreamGobbler(sess.getStdout());
         BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
           { String line = br.readLine();
             if(line == null) break;

     }catch (IOException e) {e.printStackTrace(System.err);System.exit(2);}


Ovaj unos je objavljen u Nekategorizirano. Bookmarkirajte stalnu vezu.


Popunite niže tražene podatke ili kliknite na neku od ikona za prijavu: Logo

Ovaj komentar pišete koristeći vaš račun. Odjava /  Izmijeni )

Google+ photo

Ovaj komentar pišete koristeći vaš Google+ račun. Odjava /  Izmijeni )

Twitter picture

Ovaj komentar pišete koristeći vaš Twitter račun. Odjava /  Izmijeni )

Facebook slika

Ovaj komentar pišete koristeći vaš Facebook račun. Odjava /  Izmijeni )


Spajanje na %s