Commit Graph

22 Commits

Author SHA1 Message Date
Yuya Nishihara
4290eff5ce revset: add wdir() function to specify workingctx revision by command
The main purpose of wdir() is to annotate working-directory files.

Currently many commands and revsets cannot handle workingctx and may raise
exception. For example, -r ":wdir()" results in TypeError. This problem will
be addressed by future patches.

We could add "wdir" symbol instead, but it would conflict with the existing
tag, bookmark or branch. So I decided not to.

List of commands that will potentially support workingctx revision:

  command   default  remarks
  --------  -------  -----------------------------------------------------
  annotate  p1       useful
  archive   p1       might be useful
  cat       p1       might be useful on Windows (no cat)
  diff      p1:wdir  (default)
  export    p1       might be useful if wctx can have draft commit message
  files     wdir     (default)
  grep      tip:0    might be useful
  identify  wdir     (default)
  locate    wdir     (default)
  log       tip:0    might be useful with -p or -G option
  parents   wdir     (default)
  status    wdir     (default)

This patch includes minimal test of "hg status" that should be able to handle
the workingctx revision.
2014-08-16 13:44:16 +09:00
Pierre-Yves David
8db67ed78a rename: properly report removed and added file as modified (issue4458)
The result of 'hg rm' + 'hg rename' disagreed with the one from
'hg rename --force'. We align them on 'hg move --force' because it agrees with
what 'hg status' says after the commit.

Stopping reporting a modified file as added puts an end to the hg revert confusion in this
situation (issue4458).

However, reporting the file as modified also prevents revert from restoring the copy
source. We fix this in a later changeset.

Git diff also stop reporting the add in the middle of the chain as add. Not
sure how important (and even wrong) it is.
2014-11-24 18:42:56 -08:00
Martin von Zweigbergk
7eeee3a877 status: add more complete tests for --rev
The 'status --rev' code is not very well tested, which has bitten us
as recently as in issue4321. Let's add some more tests, some of which
uncover bugs. Remove the few existing tests that are now covered in a
more thorough and consistent way.
2014-10-12 22:23:43 -07:00
Matt Mackall
8a32bb8140 formatter: add pickle format
This gives convenient Python2 output. Python 3 users will need encoding=bytes.
2014-09-12 18:36:38 -05:00
Matt Mackall
aa7d73cbbb commands: add hidden -T option for files/manifest/status/tags
These commands have generic formatting support but no way to enable it
yet. When this feature is more fully developed, this flag will be unhidden.
2014-09-15 13:15:07 -05:00
Matt Mackall
be3bc4f866 formatter: make debug style match Python syntax 2014-09-12 19:06:11 -05:00
Pierre-Yves David
6b79b1a061 status: don't drop unknown and ignored information (issue4321)
By the magic of code movement, we ended up dropping unknown and ignored
information when comparing the working directory with a non-parent revision.

Let's stop doing it and add a test.
2014-08-01 12:49:00 -07:00
Yuya Nishihara
2db6b6d9ea test-status: add test for removed-and-untracked state (BC)
In Mercurial 3.0, "hg status" can list the same file twice if it was removed
but still exists in working directory, i.e. removed by "hg forget":

  $ hg status --rev 0 removed
  R removed
  ? removed

But since 64d05ea3a10f, untracked state, "?", is no longer displayed in this
example.

I think the new behavior is correct since a file should have single state, but
if it is a bug, this patch should be dropped.
2014-07-24 23:39:25 +09:00
Mads Kiilerich
2fc7d0133f match: fix root calculation for combining regexps with simple paths
The fall-back root for walking is the repo root, not no root.

The "roots" do however also end up in m.files() which is used in various ways,
for instance to indicate whether matches are exact. The change could thus have
other impacts.
2013-04-30 01:04:35 +02:00
Patrick Mezard
302b8a957f test-status.t: test ui.slash on Windows 2012-08-18 16:35:36 +02:00
FUJIWARA Katsunori
4798ea4198 localrepository: use 'changectx.dirs()' in 'status()' for directory patterns
when pattern which does not match against any files in working context
is specified, current implementation of 'localrepository.status()'
decides whether warning message about it should be shown or not by
'f not in context'

this works correctly for 'file pattern', but not for 'directory
pattern', because 'f not in context' always returns True for
directories, even if they are related to the context.

this patch uses 'changectx.dirs()' to examine whether specified
pattern is related to the context as a directory or not.
2012-02-23 00:07:54 +09:00
Jim Hague
78a686772b tests: tighten checks for octal escapes in shell printf.
printf on AIX default shell ksh (89) says \1 is an invalid escape. It insists
on at least 2 digits. This causes failures in test-keyword.t and test-status.t.

check-code.py already looks out for \NNN and recommends using Python
for outputting octal values. Extend the check to \NN and \N and fix up
resulting failures.
2012-02-08 16:56:00 +00:00
Matt Mackall
e0479875b3 merge with stable 2012-01-13 11:29:53 -06:00
Yuya Nishihara
0bf3f9f6fd filectx: fix cmp() of file starting with '\1\n'
If file data starts with '\1\n', it will be escaped in the revlog to
create an empty metadata block, thus adding four bytes to the size in
the revlog size index. There's no way to detect that this has happened
in filelog.size() faster than decompressing each revision [1].

For filectx.cmp(), we have the size of the file in the working directory
available. If it differs by exactly four bytes, it may be this case, so
do a full comparison.

 [1]: http://markmail.org/message/5akdbmmqx7vq2fsg
2012-01-12 00:49:45 +09:00
Patrick Mezard
a50918f3cf status: support revsets with --change 2011-11-24 11:38:16 +01:00
Mads Kiilerich
637e2ecde2 tests: hide 'No such file or directory' messages
Windows will use a different and localized message.
2011-11-16 03:45:14 +01:00
Mads Kiilerich
ec46d5bf4d backout a3900c75ca8c - the "unreachable code" was apparently not unreachable
All tests repeatedly passes with a3900c75ca8c on some machines, but on other
machines it regularly causes failure in test-mv-cp-st-diff.t, such as:

@@ -203,6 +203,7 @@

   - working to root: --rev 0
   M a
+  M x/x
   A b
     a
2011-05-01 19:51:28 +02:00
Mads Kiilerich
8c1c7b8a31 status: remove unreachable code for status between revisions
The manifest value of a file will never be false when "not parentworking", and
the expensive content comparision would thus fortunately never be reached. (If
it was reached it would be wrong for example in case of renames.)

This code once handled status against working directory, but that has been done
elsewhere for a long time.
2011-02-24 14:06:08 +01:00
Matt Mackall
ac660e9f65 tests: cleanup exit code handling in unified tests 2010-09-21 16:00:02 -05:00
Matt Mackall
200e89394d tests: fix a bunch of pointless #s in unified tests 2010-09-17 17:03:08 -05:00
Martin Geisler
cc612c476f tests: remove unneeded -d flags
Many tests fixed the commit date of their changesets at '1000000 0' or
similar. However testing with "Mon Jan 12 13:46:40 1970 +0000" is not
better than testing with "Thu Jan 01 00:00:00 1970 +0000", which is
the default run-tests.py installs.

Removing the unnecessary flag removes some clutter and will hopefully
make it clearer what the tests are really trying to test. Some tests
did not even change their output when the dates were changed, in which
case the -d flag was truly irrelevant.

Dates used in sequence (such as '0 0', '1 0', etc...) were left alone
since they may make the test easier to understand.
2010-09-02 23:22:51 +02:00
Nicolas Dumazet
8ea7989b02 tests: unify test-status 2010-08-12 14:54:10 +09:00