summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-03-12 17:41:30 +0000
committerLars Wirzenius <liw@liw.fi>2012-03-12 17:41:30 +0000
commit08627e99f7c4452b077bbdfabdb7094fff9e79ca (patch)
treea6f1854982b2dd95bc3abf6bfadb0aa40575b0fb
parent0e49c9b229f4ee1b67089f2b4695cdad1a839aff (diff)
downloaddupfiles-08627e99f7c4452b077bbdfabdb7094fff9e79ca.tar.gz
Make --no-act work for hardlinks too
-rwxr-xr-xdupfiles7
1 files changed, 5 insertions, 2 deletions
diff --git a/dupfiles b/dupfiles
index 4696c4a..b40acf5 100755
--- a/dupfiles
+++ b/dupfiles
@@ -249,8 +249,11 @@ class Dupfiles(cliapp.Application):
same = [x for x, y in dups if y == meta]
dups = [(x,y) for x, y in dups if y != meta]
for pathname in same:
- os.remove(pathname)
- os.link(canonical, pathname)
+ if self.settings['no-act']:
+ self.output.write('hardlink %s\n' % pathname)
+ else:
+ os.remove(pathname)
+ os.link(canonical, pathname)
def remove_all_but_one(self, duplicates, last_dir):
if not last_dir.endswith(os.sep):