How to do stuff in subversion, when you're used to git:
# create a new branch
svn copy -m "Branching trunk" https://www.example.com/svn/repos/project/trunk https://www.example.com/svn/repos/project/branches/new_branch_name
# check out new branch
svn checkout https://www.example.com/svn/repos/project/branches/new_branch_name
# check status/diffs of working directory
svn status
svn diff
# show a specific commit
svn diff -c63197
svn diff -c63197 | vim -R -
svn diff -r63196:63197
svn diff -c63197 db/src/securesite/
# commit files
svn commit -m'Commit message' filename.ext
# see your changes after committing
svn update
# find where a branch was cut from trunk (svn equivalent of git mergebase)
# The last commit will be the first one in this branch after it was cut from trunk:
svn log -v --stop-on-copy
# cherry pick
svn merge -cXXXX trunk branch
# revert a commit
svn merge -c -REV .
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Perl telnet script OR netcat
When you need to test using telnet, but don't have telnet installed, and you do have Perl:
use strict;
use warnings;
my $usage = "usage: $0 host port\n";
my $host = $ARGV[0] or die $usage;
my $port = $ARGV[1] or die $usage;
use Net::Telnet ();
my $t = new Net::Telnet (
Port => $port,
Timeout => 5,
);
$t->open($host);
my $print_success = $t->print("GET / HTTP/1.0\n");
print "sent command: $print_success\n";
my @lines = $t->getlines(Timeout => 2);
print @lines;
OR an even easier way with netcat:
fprint "GET / HTTP/1.0\n\n" | nc host port
use strict;
use warnings;
my $usage = "usage: $0 host port\n";
my $host = $ARGV[0] or die $usage;
my $port = $ARGV[1] or die $usage;
use Net::Telnet ();
my $t = new Net::Telnet (
Port => $port,
Timeout => 5,
);
$t->open($host);
my $print_success = $t->print("GET / HTTP/1.0\n");
print "sent command: $print_success\n";
my @lines = $t->getlines(Timeout => 2);
print @lines;
OR an even easier way with netcat:
fprint "GET / HTTP/1.0\n\n" | nc host port
sudo doesn't list files properly
Problem:
You can list a directory using sudo:
$ sudo ls /var/log/apache/
access_log error_log
Solution:
Ensure parameter expansion happens in the shell run by sudo, not in the user's shell:
$ sudo bash -c 'ls /var/log/apache/*_log'
(source)
You can list a directory using sudo:
$ sudo ls /var/log/apache/
access_log error_log
But you can't list files with a wildcard using sudo:
$ sudo ls /var/log/apache/*_log
ls: cannot access /var/log/apache/*_log: No such file or directory
ls: cannot access /var/log/apache/*_log: No such file or directory
Ensure parameter expansion happens in the shell run by sudo, not in the user's shell:
$ sudo bash -c 'ls /var/log/apache/*_log'
(source)
Subscribe to:
Posts (Atom)