from path import path
import filecmp
from tempfile import NamedTemporaryFile
import os
from filecmp import _sig, cmp as same_file

# the mark that is used to identify stored originals that have been modified
MARK = '!'

def make_path(p, sep='_'):
    '''Find a similar, yet unused path'''
    p = path(p)
    name, ext = p.splitext()
    n = 1
    while p.exists():
        p = path(name + '%s%s%s' % (sep, n, ext))
        n += 1
    return p

def mktemp():
    f = NamedTemporaryFile(delete=False)
    f.close()
    loc = path(f.name).abspath()
    loc.remove()
    return loc

def filesig(pth):
    '''
    a signature of the file, if this remains the same we can be pretty sure that the file hasn't been changed
    '''
    return filecmp._sig(os.stat(pth))

def dump(store):
    '''for debugging purposes'''
    from pprint import pprint
    for p in (store.originals, store.storedat, store.ignored):
        pprint(p)

@@ -380,16 +380,11 @@
 ath(
-name + '
+'%25s
 %25s%25s
@@ -390,16 +390,22 @@
 s%25s' %25 (
+name, 
 sep, n, 

refactor make_path