cosmetics

This commit is contained in:
Axel Kittenberger 2014-02-28 10:15:48 +01:00
parent 178f315907
commit 85e95ef150
3 changed files with 37 additions and 19 deletions

View File

@ -59,7 +59,7 @@ rsync.checkgauge = {
cvs_exclude = true, cvs_exclude = true,
dry_run = true, dry_run = true,
executability = true, executability = true,
group = true, group = true,
hard_links = true, hard_links = true,
ignore_times = true, ignore_times = true,
ipv4 = true, ipv4 = true,
@ -78,10 +78,10 @@ rsync.checkgauge = {
sparse = true, sparse = true,
temp_dir = true, temp_dir = true,
timeout = true, timeout = true,
times = true, times = true,
update = true, update = true,
verbose = true, verbose = true,
whole_file = true, whole_file = true,
xattrs = true, xattrs = true,
_extra = true, _extra = true,
}, },
@ -299,9 +299,7 @@ rsync.prepare = function(
skipTarget -- used by rsyncssh, do not check for target skipTarget -- used by rsyncssh, do not check for target
) )
--
-- First let default.prepare test the checkgauge -- First let default.prepare test the checkgauge
--
default.prepare( config, level + 6 ) default.prepare( config, level + 6 )
if not skipTarget and not config.target then if not skipTarget and not config.target then
@ -364,14 +362,10 @@ rsync.prepare = function(
) )
end end
--
-- computes the rsync arguments into one list -- computes the rsync arguments into one list
--
local crsync = config.rsync; local crsync = config.rsync;
--
-- everything implied by archive = true -- everything implied by archive = true
--
local archiveFlags = { local archiveFlags = {
recursive = true, recursive = true,
links = true, links = true,
@ -386,9 +380,7 @@ rsync.prepare = function(
xattrs = false, xattrs = false,
} }
-- -- if archive is given the implications are filled in
-- if archive given the implications are filled in
--
if crsync.archive then if crsync.archive then
for k, v in pairs( archiveFlags ) do for k, v in pairs( archiveFlags ) do
if crsync[ k ] == nil then if crsync[ k ] == nil then
@ -410,7 +402,7 @@ rsync.prepare = function(
cvs_exclude = 'C', cvs_exclude = 'C',
dry_run = 'n', dry_run = 'n',
executability = 'E', executability = 'E',
group = 'g', group = 'g',
hard_links = 'H', hard_links = 'H',
ignore_times = 'I', ignore_times = 'I',
ipv4 = '4', ipv4 = '4',
@ -424,10 +416,10 @@ rsync.prepare = function(
prune_empty_dirs = 'm', prune_empty_dirs = 'm',
quiet = 'q', quiet = 'q',
sparse = 'S', sparse = 'S',
times = 't', times = 't',
update = 'u', update = 'u',
verbose = 'v', verbose = 'v',
whole_file = 'W', whole_file = 'W',
xattrs = 'X', xattrs = 'X',
} }

View File

@ -2085,12 +2085,15 @@ masterloop(lua_State *L)
// queries the runner about the soonest alarm // queries the runner about the soonest alarm
// //
load_runner_func( L, "getAlarm" ); load_runner_func( L, "getAlarm" );
if( lua_pcall( L, 0, 1, -2 ) ) if( lua_pcall( L, 0, 1, -2 ) )
{ exit( -1 ); } {
exit( -1 );
}
if( lua_type( L, -1 ) == LUA_TBOOLEAN) if( lua_type( L, -1 ) == LUA_TBOOLEAN)
{ {
have_alarm = false; have_alarm = false;
force_alarm = lua_toboolean( L, -1 ); force_alarm = lua_toboolean( L, -1 );
} }
else else
@ -2098,6 +2101,7 @@ masterloop(lua_State *L)
have_alarm = true; have_alarm = true;
alarm_time = *( ( clock_t * ) luaL_checkudata( L, -1, "Lsyncd.jiffies" ) ); alarm_time = *( ( clock_t * ) luaL_checkudata( L, -1, "Lsyncd.jiffies" ) );
} }
lua_pop( L, 2 ); lua_pop( L, 2 );
if( if(
@ -2200,6 +2204,7 @@ masterloop(lua_State *L)
{ {
// walks through the observances calling ready/writey // walks through the observances calling ready/writey
observance_action = true; observance_action = true;
for( pi = 0; pi < observances_len; pi++ ) for( pi = 0; pi < observances_len; pi++ )
{ {
struct observance *obs = observances + pi; struct observance *obs = observances + pi;
@ -2339,6 +2344,7 @@ masterloop(lua_State *L)
/* /*
| The effective main for one run. | The effective main for one run.
|
| HUP signals may cause several runs of the one main. | HUP signals may cause several runs of the one main.
*/ */
int int

View File

@ -1454,7 +1454,7 @@ local Excludes = ( function( )
end )( ) end )( )
-- --
-- Holds information about one observed directory inclusively subdirs. -- Holds information about one observed directory including subdirs.
-- --
local Sync = ( function( ) local Sync = ( function( )
@ -1486,6 +1486,7 @@ local Sync = ( function( )
-- Removes a delay. -- Removes a delay.
-- --
local function removeDelay( self, delay ) local function removeDelay( self, delay )
if self.delays[ delay.dpos ] ~= delay then if self.delays[ delay.dpos ] ~= delay then
error( 'Queue is broken, delay not a dpos' ) error( 'Queue is broken, delay not a dpos' )
end end
@ -1494,9 +1495,13 @@ local Sync = ( function( )
-- free all delays blocked by this one. -- free all delays blocked by this one.
if delay.blocks then if delay.blocks then
for i, vd in pairs( delay.blocks ) do for i, vd in pairs( delay.blocks ) do
vd.status = 'wait' vd.status = 'wait'
end end
end end
end end
@ -1507,18 +1512,25 @@ local Sync = ( function( )
-- not concerned if watch rootdir doesnt match -- not concerned if watch rootdir doesnt match
if not path:starts( self.source ) then if not path:starts( self.source ) then
return false return false
end end
-- a sub dir and not concerned about subdirs -- a sub dir and not concerned about subdirs
if self.config.subdirs == false and if self.config.subdirs == false and
path:sub( #self.source, -1 ):match( '[^/]+/?' ) path:sub( #self.source, -1 ):match( '[^/]+/?' )
then then
return false return false
end end
-- concerned if not excluded -- concerned if not excluded
return not self.excludes:test( path:sub( #self.source ) ) return not self.excludes:test( path:sub( #self.source ) )
end end
-- --
@ -1640,6 +1652,7 @@ local Sync = ( function( )
end end
table.insert( oldDelay.blocks, newDelay ) table.insert( oldDelay.blocks, newDelay )
end end
-- --
@ -1661,6 +1674,7 @@ local Sync = ( function( )
local function recurse( ) local function recurse( )
if etype == 'Create' and path:byte( -1 ) == 47 then if etype == 'Create' and path:byte( -1 ) == 47 then
local entries = lsyncd.readdir( self.source .. path ) local entries = lsyncd.readdir( self.source .. path )
if entries then if entries then
@ -2062,6 +2076,7 @@ local Sync = ( function( )
-- Creates a new Sync -- Creates a new Sync
-- --
local function new( config ) local function new( config )
local s = { local s = {
-- fields -- fields
@ -2111,6 +2126,7 @@ local Sync = ( function( )
else else
error( 'type for exclude must be table or string', 2 ) error( 'type for exclude must be table or string', 2 )
end end
end end
if if
@ -2124,7 +2140,9 @@ local Sync = ( function( )
end end
if config.excludeFrom then if config.excludeFrom then
s.excludes:loadFile( config.excludeFrom ) s.excludes:loadFile( config.excludeFrom )
end end
return s return s
@ -2133,7 +2151,9 @@ local Sync = ( function( )
-- --
-- Public interface -- Public interface
-- --
return { new = new } return {
new = new
}
end )( ) end )( )