Fossil SCM

Only print the SSH command once and also the forced newline so the Round-trips information stays on one line.

amb 2013-07-24 04:52 ssh-transport-changes
Commit 72877d8e5170627f332b84a2a1a4ae2e27820a1e
1 file changed +9 -3
--- src/http_transport.c
+++ src/http_transport.c
@@ -105,10 +105,11 @@
105105
*/
106106
int transport_ssh_open(void){
107107
/* For SSH we need to create and run SSH fossil http
108108
** to talk to the remote machine.
109109
*/
110
+ static int fPrintSshCmd = 1; /* Print SSH command only once */
110111
const char *zSsh; /* The base SSH command */
111112
Blob zCmd; /* The SSH command */
112113
char *zHost; /* The host name to contact */
113114
int n; /* Size of prefix string */
114115
@@ -119,12 +120,14 @@
119120
blob_appendf(&zCmd, " -P %d", g.urlPort);
120121
#else
121122
blob_appendf(&zCmd, " -p %d", g.urlPort);
122123
#endif
123124
}
124
- fossil_force_newline();
125
- fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
125
+ if( fPrintSshCmd ){
126
+ fossil_force_newline();
127
+ fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
128
+ }
126129
if( g.urlUser && g.urlUser[0] ){
127130
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
128131
#ifdef __MINGW32__
129132
/* Only win32 (and specifically PLINK.EXE) support the -pw option */
130133
if( g.urlPasswd && g.urlPasswd[0] ){
@@ -159,11 +162,14 @@
159162
blob_append(&zCmd, " http", 5);
160163
if( g.urlPath && g.urlPath[0] ){
161164
blob_append(&zCmd, " ", 1);
162165
shell_escape(&zCmd, mprintf("%s", g.urlPath));
163166
}
164
- fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
167
+ if( fPrintSshCmd ){
168
+ fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
169
+ fPrintSshCmd = 0;
170
+ }
165171
free(zHost);
166172
popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
167173
if( sshPid==0 ){
168174
socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
169175
}
170176
--- src/http_transport.c
+++ src/http_transport.c
@@ -105,10 +105,11 @@
105 */
106 int transport_ssh_open(void){
107 /* For SSH we need to create and run SSH fossil http
108 ** to talk to the remote machine.
109 */
 
110 const char *zSsh; /* The base SSH command */
111 Blob zCmd; /* The SSH command */
112 char *zHost; /* The host name to contact */
113 int n; /* Size of prefix string */
114
@@ -119,12 +120,14 @@
119 blob_appendf(&zCmd, " -P %d", g.urlPort);
120 #else
121 blob_appendf(&zCmd, " -p %d", g.urlPort);
122 #endif
123 }
124 fossil_force_newline();
125 fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
 
 
126 if( g.urlUser && g.urlUser[0] ){
127 zHost = mprintf("%s@%s", g.urlUser, g.urlName);
128 #ifdef __MINGW32__
129 /* Only win32 (and specifically PLINK.EXE) support the -pw option */
130 if( g.urlPasswd && g.urlPasswd[0] ){
@@ -159,11 +162,14 @@
159 blob_append(&zCmd, " http", 5);
160 if( g.urlPath && g.urlPath[0] ){
161 blob_append(&zCmd, " ", 1);
162 shell_escape(&zCmd, mprintf("%s", g.urlPath));
163 }
164 fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
 
 
 
165 free(zHost);
166 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
167 if( sshPid==0 ){
168 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
169 }
170
--- src/http_transport.c
+++ src/http_transport.c
@@ -105,10 +105,11 @@
105 */
106 int transport_ssh_open(void){
107 /* For SSH we need to create and run SSH fossil http
108 ** to talk to the remote machine.
109 */
110 static int fPrintSshCmd = 1; /* Print SSH command only once */
111 const char *zSsh; /* The base SSH command */
112 Blob zCmd; /* The SSH command */
113 char *zHost; /* The host name to contact */
114 int n; /* Size of prefix string */
115
@@ -119,12 +120,14 @@
120 blob_appendf(&zCmd, " -P %d", g.urlPort);
121 #else
122 blob_appendf(&zCmd, " -p %d", g.urlPort);
123 #endif
124 }
125 if( fPrintSshCmd ){
126 fossil_force_newline();
127 fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
128 }
129 if( g.urlUser && g.urlUser[0] ){
130 zHost = mprintf("%s@%s", g.urlUser, g.urlName);
131 #ifdef __MINGW32__
132 /* Only win32 (and specifically PLINK.EXE) support the -pw option */
133 if( g.urlPasswd && g.urlPasswd[0] ){
@@ -159,11 +162,14 @@
162 blob_append(&zCmd, " http", 5);
163 if( g.urlPath && g.urlPath[0] ){
164 blob_append(&zCmd, " ", 1);
165 shell_escape(&zCmd, mprintf("%s", g.urlPath));
166 }
167 if( fPrintSshCmd ){
168 fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */
169 fPrintSshCmd = 0;
170 }
171 free(zHost);
172 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid);
173 if( sshPid==0 ){
174 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
175 }
176

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button