Commit Graph

335 Commits

Author SHA1 Message Date
Adrian Buehlmann
307196b733 move path_auditor from util to scmutil 2011-04-20 22:43:31 +02:00
Adrian Buehlmann
f3e8eae526 move canonpath from util to scmutil 2011-04-20 21:41:41 +02:00
Adrian Buehlmann
fc7e20743c add: introduce a warning message for non-portable filenames (issue2756) (BC)
On POSIX platforms, the 'add', 'addremove', 'copy' and 'rename' commands now
warn if a file has a name that can't be checked out on Windows.

Example:

  $ hg add con.xml
  warning: filename contains 'con', which is reserved on Windows: 'con.xml'
  $ hg status
  A con.xml

The file is added despite the warning.

The warning is ON by default. It can be suppressed by setting the config option
'portablefilenames' in section 'ui' to 'ignore' or 'false':

  $ hg --config ui.portablefilenames=ignore add con.xml
  $ hg sta
  A con.xml

If ui.portablefilenames is set to 'abort', then the command is aborted:

  $ hg --config ui.portablefilenames=abort add con.xml
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'

On Windows, the ui.portablefilenames config setting is irrelevant and the
command is always aborted if a problematic filename is found.
2011-04-19 12:42:53 +02:00
Adrian Buehlmann
53cf962dbf copy: do not copy file if name is disallowed anyway 2011-04-15 16:15:32 +02:00
Matt Mackall
a8dd64dcb0 misc: replace .parents()[0] with p1() 2011-04-04 16:21:59 -05:00
Adrian Buehlmann
87756a5751 cmdutil: fix mode handling in make_file 2011-02-23 23:30:48 +01:00
Matt Mackall
a4d6678bab match: ignore "" patterns
The following command would visit every changeset in repo/ rather than
the last 10:

hg log -l 10 repo/
2011-03-04 19:21:12 -06:00
Waqas Hussain
9981e2f9a8 export: only close files which export itself has opened 2011-02-23 13:21:55 +05:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
David Soria Parra
60c47bdb07 templater: add bookmarks to templates and default output
as bookmarks are not dispalyed as tags anymore, we add a bookmark label
to the changeset printer.
2011-02-11 19:47:39 +01:00
Dan Villiom Podlaski Christiansen
c168860461 make_file: always return a fresh file handle that can be closed
Currently, cmdutil.make_file() will return a freshly made file handle,
except when given a pattern of '-'. If callers would want to close the
handle, they would have to make sure that it's neither sys.stdin or
sys.stdout. Instead, returning a duplicate of either of the two
ensures that make_file() lives up to its name and creates a new
file handle regardless of the input.
2010-12-07 16:08:16 +01:00
Dan Villiom Podlaski Christiansen
811053b2a4 export: flush the file pointer between patches 2010-12-01 21:46:08 +01:00
Matt Mackall
8b31da4540 branch: operate on branch names in local string space where possible
Previously, branch names were ideally manipulated as UTF-8 strings,
because they were stored as UTF-8 in the dirstate and the changelog
and could not be safely converted to the local encoding and back.

However, only about 80% of branch name code was actually using the
right encoding conventions. This patch uses the localstr addition to
allow working on branch names as local strings, which simplifies
handling so that the previously incorrect code becomes correct.
2010-11-24 15:56:32 -06:00
Nicolas Dumazet
1126494b0f merge with stable 2010-11-13 11:58:51 +09:00
Nicolas Dumazet
c2c4887231 log: fix log -rREV FILE when REV isnt the last filerev (issue2492)
Regression from 9f0026001bfd. That previous commit is not supposed
to affect log calls without --follow, so we step out of this
codepath if follow is not True, and it's enough to fix the
regression.

When --follow is given, we fix the issue by taking into account
changesets that have a rev > maxrev to build the filegraph: even if
those files are not included in the final result, it's still needed
to walk correctly the graph from the end of the filelog to minrev, to
track accurately renames.
2010-11-11 02:10:37 +09:00
Nicolas Dumazet
cc0f0d500b cmdutil: move range check outside of filerevgen
Simple refactor, no logic change.
2010-11-11 02:05:02 +09:00
Matt Mackall
72b5ba88f5 commands: add revset support to most commands 2010-11-04 16:21:28 -05:00
Matt Mackall
bc13e3d384 commit: handle missing newline on last commit comment 2010-10-30 12:13:52 -05:00
Patrick Mezard
a3c9b27eda patch: fix copies when patching over uncommitted changed (issue2459) 2010-10-28 21:25:53 +02:00
Wagner Bruna
7ca1d483b2 cmdutil: mark string for i18n 2010-10-20 12:29:41 -02:00
Augie Fackler
42c8b2cf07 termwidth: move to ui.ui from util 2010-10-10 10:06:36 -05:00
Brodie Rao
ff59218cc1 cat: fix cat without -r, broken by 5089d555cee9
The default revision for revsingle() is now '.' instead of None. This
preserves the behavior of cat prior to it using revsingle().
2010-10-08 14:02:23 -05:00
Matt Mackall
9ccbd76ee4 revsets: introduce revsingle helper
revsingle returns a context for the last revision of the supplied revspec
2010-10-07 18:24:29 -05:00
Matt Mackall
223b7c03b1 revsets: make revpair revsets-aware
revpair returns the first and last members of the computed revset(s)
2010-10-07 18:05:04 -05:00
Patrick Mezard
9679c03c21 Restore lexists() changes lost in d8a989380f8b merge 2010-09-20 22:41:10 +02:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Patrick Mezard
e043450e1d rename: do not overwrite existing broken symlinks 2010-09-20 21:46:39 +02:00
Martin Geisler
cb93a10b9b add: recurse into subrepositories with --subrepos/-S flag 2010-09-13 13:09:20 +02:00
Martin Geisler
186cdcc54b add: move main part to cmdutil to make it easier to reuse 2010-09-13 13:09:11 +02:00
Martin Geisler
112ea7d5ed patch: break import cycle with cmdutil
The patch module imported cmdutil but used it only in updatedir.
2010-09-13 13:08:09 +02:00
Patrick Mezard
30bd1afde3 subrepos: handle diff nodeids in subrepos, not before
Subversion nodeids are integer revisions.
2010-09-10 22:52:00 +02:00
Martin Geisler
c85f2356e3 subrepos: add function for iterating over ctx subrepos 2010-09-07 16:34:07 +02:00
Martin Geisler
5cb4b1f5eb subrepos: handle modified but uncommitted .hgsub 2010-09-07 16:23:55 +02:00
Martin Geisler
e9c2a20771 diff: recurse into subrepositories with --subrepos/-S flag 2010-09-03 12:58:51 +02:00
Martin Geisler
839c3422d1 cmdutil: use repo.auditor when constructing match object
This gives the repository control over which nested repository paths
that should be allowed via the custom path auditor.

Since paths into subrepositories are now allowed, dirstate.walk must
now filter away more paths than before.
2010-09-03 12:58:51 +02:00
Martin Geisler
80db87965d Consistently import foo as foomod when foo to avoid shadowing
This is in the style of 1aaceccaf1dc.
2010-08-30 14:38:24 +02:00
Martin Geisler
bfea979db3 util: remove lexists, Python 2.4 introduced os.path.lexists 2010-08-25 16:23:32 +02:00
Matt Mackall
76a1c7b90d merge with stable 2010-08-17 17:44:19 -05:00
Alecs King
057134ed97 log: fix the bug 'hg log --stat -p == hg log --stat'
Before:
    hg log --stat -p -r tip # only show stat

After:
    hg log --stat -p -r tip # show stat _and_ diff
2010-08-13 14:29:30 +08:00
Nicolas Dumazet
32ca03310d cmdutil: code simplification 2010-08-15 23:38:00 +09:00
Nicolas Dumazet
252ff032c2 log: do not --follow file that is deleted and recreated later (issue732)
== What ==

issue732 is only one example of a buggy behaviour, but there are in fact many
intricated cases. For example:

( "o" contains an alive version of the tracked file, "x" does not)

tip - o - o - x - o - o - x ...
   \
    o - o - o - o - x ...
     \     /
      o - o

This repository contains at least two instances of the tracked file, but
when calling "hg log -f file" only the latest one (the one alive in tip)
matters to us.

== How ==

We must extract from the filelog the history of the file instance we're
interested in and discard changes related to other instances of that file.

We see that we're only interested in ancestors(node), and that all
other nodes in the filelog should not be considered.
2010-08-15 23:17:53 +09:00
Martin Geisler
4c4fee151a cmdutil: remove unnecessary parenthesis 2010-08-12 18:00:41 +02:00
Nicolas Dumazet
347d6d7320 log: do not redefine cachefunc in walkchangerevs
The same variable is defined a few blocks earlier. The first phases in
walkchangerevs should in fact fill that cache, and allow faster lookups
in the last phase. Redefining and overriding this cached function, (knowing
that it will be called with the same arguments) defeats the caching purpose.
2010-07-20 14:42:05 +09:00
Martin Geisler
608c008186 cmdutils: fix code style 2010-07-21 09:43:45 +02:00
Nicolas Dumazet
48c3dffac9 log: document the different phases in walkchangerevs 2010-07-20 14:32:33 +09:00
Nicolas Dumazet
13f83afe55 log: slowpath: only walk specified revision range during preparation
Even with --removed, it does not make sense to examine changesets outside
of the revision range that was specified by the user: the last phase only
yields a subset of (revs), preparation phase hence only has to examine
(revs) to fill correctly fncache.
2010-07-20 14:13:33 +09:00
Martin Geisler
f3e224e1d7 cmdutil: fix accidental name clash with revrange function
The revrange function was used further up, and when a local variable
is defined with the same name, the earlier call to revrange becomes a
'local variable used before assignment' error.

The clash was introduced in 3544b3baebb0.
2010-07-19 00:41:41 +02:00
Nicolas Dumazet
8b45506535 log: slowpath: do not read the full changelog
When in the slowpath, we are examining _all_ changesets in revs.
We need to order reads so they happen increasingly for I/O performance.

Increasing windows were used to read changelog backwards in a windowed manner,
reading the changelog forward inside each window. But since no revision range
was specified, it was equivalent to reading the full changelog, even if a
single revision was passed to the commandline.

When --removed is used, we _need_ to scan all changesets, but if we're only
looking for file patterns, this is not necessary and we can stick to
the revspec that was given to us.
2010-07-04 18:07:30 +09:00
Nicolas Dumazet
93f72c67e1 log: remove increasing windows usage in fastpath
The purpose of increasing windows is to allow backwards iteration on the
filelog  at a reasonable cost.
But is it needed?
 - if follow is False, we have no reason to iterate backwards.
   We basically just want to walk the complete filelog and yield all revisions
   within the revision range. We can do this forward or
   backwards, as it only reads the index.
 - when follow is True, we need to examine the contents of the filelog, and to
   do this efficiently we need to read the filelog forward.
   And on the other hand, to track ancestors and copies, we need to process
   revisions backwards. But is it necessary to use increasing windows
   for this?
   We can iterate over the complete filelog forward, stack the revisions, and
   read the reversed(pile), it does the same thing with a more readable code.
2010-07-03 18:11:15 +09:00
Nicolas Dumazet
3ac31c1176 log: refactor: test for ranges inside filerevgen 2010-07-03 18:01:54 +09:00