[PATCH] export: make -o foo overwrite, not append
Jordi Gutiérrez Hermoso
jordigh at octave.org
Thu Oct 4 17:41:09 UTC 2012
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1349372425 14400
# Node ID 80eea80279e6804128b828da97ff57c1da89a07c
# Parent fa714f3ed2989aff64c267c9935251d9fc4f31ee
export: make -o foo overwrite, not append
Currently, "hg export -r foo -o bar" appends the results to bar, which
is mentioned nowhere in the documentation. This confuses users who
expect to get only one change in there, not several. This cset just
makes the -o option overwrite, not append.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -552,7 +552,7 @@
desc_lines = ctx.description().rstrip().split('\n')
desc = desc_lines[0] #Commit always has a first line.
fp = makefileobj(repo, template, node, desc=desc, total=total,
- seqno=seqno, revwidth=revwidth, mode='ab')
+ seqno=seqno, revwidth=revwidth, mode='wb')
if fp != template:
shouldclose = True
if fp and fp != sys.stdout and util.safehasattr(fp, 'name'):
@@ -564,7 +564,6 @@
def write(s, **kw):
fp.write(s)
-
write("# HG changeset patch\n")
write("# User %s\n" % ctx.user())
write("# Date %d %d\n" % ctx.date())
More information about the Mercurial-devel
mailing list