Commit Graph

583 Commits

Author SHA1 Message Date
Pierre-Yves David
2602f6923f extract: parse 'date' using the generic mechanism
Parsing 'date' is very simple and a good first test.
2015-10-07 01:13:36 -07:00
Pierre-Yves David
4ae623122e extract: add some facility for extensible header parsing
We need a way for extension to extend the header we can parse. We start with a
very simple mechanism that will be used in the next changeset.
2015-10-07 01:20:49 -07:00
Pierre-Yves David
b85c4695a2 extract: remove the 'user' variable
It is not heavily used enough to justify being something other than a
dictionary entry.
2015-10-06 02:16:24 -07:00
Pierre-Yves David
1f322a05ad extract: use a single return
The differences between both returns are now very thin, we factor out
that part.
2015-10-06 02:11:09 -07:00
Pierre-Yves David
159f2b3f21 extract: move 'nodeid' assignment where it is parsed
The is one setter and no consumer, we can move it there directly.
2015-10-07 00:50:53 -07:00
Pierre-Yves David
b6f2794f84 extract: move 'date' assignment where it is parsed
There is one setter and no consumer, we can move it there directly.
2015-10-06 02:08:32 -07:00
Pierre-Yves David
6386f9c739 extract: assign user to 'data' earlier
This is used in both case, we can assign it once.
2015-10-06 02:07:33 -07:00
Pierre-Yves David
cf6731af5a extract: move 'branch' assignment where it is parsed
There is one setter and no consumer, we can move it there directly.
2015-10-06 02:06:36 -07:00
Pierre-Yves David
43416c9684 extract: directly assign parent to data dictionary
The temporary variables are not adding anything.
2015-10-06 02:05:56 -07:00
Pierre-Yves David
3351bc88a4 extract: assign message only once
This return is shared between the two cases. We can move it earlier.
2015-10-06 02:04:46 -07:00
Pierre-Yves David
ab23538b10 extract: simplify parents assignement
We move to the more standard style of:

  value = default
  if special:
      value = other

This is more consistent and compact.
2015-10-06 02:04:06 -07:00
Pierre-Yves David
ec1d4cc8b3 patch: move 'extract' return to a dictionnary
The final goal here is to be able to parse, return and process arbitrary data
from patch. This mirror the recently added ability to add arbitrary data to
patch headers.

The first step is to return something more flexible, so we return a dict without
changing any other logic.
2015-10-06 02:01:53 -07:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Gregory Szorc
3aa1c73868 global: mass rewrite to use modern octal syntax
Python 2.6 introduced a new octal syntax: "0oXXX", replacing "0XXX". The
old syntax is not recognized in Python 3 and will result in a parse
error.

Mass rewrite all instances of the old octal syntax to the new syntax.

This patch was generated by `2to3 -f numliterals -w -n .` and the diff
was selectively recorded to exclude changes to "<N>l" syntax conversion,
which will be handled separately.
2015-06-23 22:30:33 -07:00
Gregory Szorc
be5724ac71 patch: remove email import workaround for Python 2.4
Python 2.6 provides access to the sub-modules just fine. This workaround
is no longer needed since we no longer support Python 2.4.
2015-06-22 10:09:08 -07:00
Matt Mackall
7c6674833f patch: add fuzz config flag (issue4697) 2015-06-18 15:42:40 -05:00
Laurent Charignon
1ca77932d5 record: exiting editor with non-zero status should not stop recording session
Before this patch, exiting a hunk edit in record with a non-zero status lead
to the end of the recording session, losing previously-selected hunks to record.
This patch introduces the more desirable behavior of warning the user and
continuing the recording session.
2015-06-05 13:31:18 -07:00
Laurent Charignon
f9d447f8e4 revert: add an experimental config to use inverted selection
We had a discussion on the list about the interactive ui for revert. This patch
adds a flag to allow people to test the second alternative (referred to as
proposition 2 on the mailing list). It effectively inverts the signs in the
2015-05-29 13:11:52 -07:00
Laurent Charignon
9b866fafac record: add default value for operation argument
This patch is part of a series of patches to change the recording ui to reflect
the operation currently running (commit, shelve, revert ...).
This patch adds the default value of the operation argument for record's
standard and curses interface to match what is displayed in the interface
as of today.
2015-05-27 15:56:10 -07:00
Laurent Charignon
92c99cc1a7 record: add an operation arguments to customize recording ui
This patch is part of a series of patches to change the recording ui to reflect
the operation currently running (commit, shelve, revert ...).
This patch adds a new argument to the recording function to reflect in the UI
what operation we are running.
2015-05-27 15:49:24 -07:00
Augie Fackler
a5b17bd9d1 cleanup: use __builtins__.any instead of util.any
any() is available in all Python versions we support now.
2015-05-16 14:30:07 -04:00
Pierre-Yves David
27d9d4e153 patch: remove duplicated import of cStringIO
It is already imported a couple of line above.
2015-05-17 17:27:10 -07:00
Martin von Zweigbergk
4127f67694 util: drop alias for collections.deque
Now that util.deque is just an alias for collections.deque, let's just
remove it.
2015-05-16 11:28:04 -07:00
Laurent Charignon
6fc9e8be66 record: edit patch of newly added files (issue4304)
I tried to fix this issue in the past and had to revert the fix. This is a
second attempt without the regression we found with the first one.

record defines special headers (of file) as headers whose hunk are not shown
to the user for editing, they are used to represent deleted, moved and new
files. Since we want to authorize editing the patch of newly added file we
make the newly added file with some content not special anymore. This entails
that we have to save their content before applying the backup to be able to
revert it if the patch does not apply properly.
We reintroduce the test showing that newly added files can be edited and that
their content is shown to the user.
2015-04-23 14:27:26 -07:00
Laurent Charignon
4fc3c4c465 record: fix record with change on moved file crashes (issue4619)
reverting fe807064739c, add a test to prevent the issue from coming back.
2015-04-22 13:56:30 -07:00
Durham Goode
cd579fe2e0 diff: pass the diff matcher to the copy logic
This passes the existing diff matcher instance down to the copy logic so copy
tracing can be more efficient when possible and only trace copies for matching
files.

This only actually affects forwardcopies (i.e. Given A<-B<-C<-D, it works for
'hg diff -r B -r D foo.txt', but not for 'hg diff -r D -r B foo.txt') since
backward copies require walking all histories, and not just the individual
file's.

This reduces 'hg diff -r A -r B foo.txt' time from 15s to 1s when A and B have
80,000 files different.
2015-04-16 11:31:48 -07:00
Siddharth Agarwal
53fe8ecbd4 patch.diff: restrict matcher to relative root in certain cases
Previously we'd request all results, then filter by relative root. This is
clearly inefficient, so we now restrict the matcher to the relative root for
certain easy cases.

The particular case here is when the matcher matches all files. In that case we
can simply create a matcher by the relative root.

This is purely an optimization and has no impact on correctness.
2015-03-17 15:46:36 -07:00
Siddharth Agarwal
633aa5fbea patch.diff: add support for diffs relative to a subdirectory
For now this implementation is pretty naive -- it filters out files right
before passing them into trydiff. In upcoming patches we'll add some more
smarts.
2015-03-17 13:41:24 -07:00
Siddharth Agarwal
1ba05f7f8a patch.trydiff: add support for stripping a relative root
This assumes that if relroot is not None, all the files in modified, added and
removed start with it. In upcoming patches we'll follow that.
2015-03-17 12:59:41 -07:00
Siddharth Agarwal
4a073b9113 patch._applydiff: resolve prefix with respect to the cwd
This has several advantages compared to resolving it relative to the root:

- '--prefix .' works as expected.
- consistent with upcoming 'hg diff' option to produce relative patches

(I made sure to put in the (glob) annotations this time!)
2015-03-19 10:18:05 -07:00
Siddharth Agarwal
400fb488cd patch.pathtransform: prepend prefix even if strip is 0
Silly oversight by me.
2015-03-18 20:59:06 -07:00
Siddharth Agarwal
598b5c20d8 patch.trydiff: add a docstring
It took me a bit to figure out what this function actually does.
2015-03-17 13:06:15 -07:00
Laurent Charignon
2716ef87d7 record: add comparison methods for recordhunk class 2015-03-13 14:08:30 -07:00
Laurent Charignon
62f1f68490 record: change interface of the filtering function
This way filtering functions accept chunks and return chunks
2015-03-12 17:51:37 -07:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Laurent Charignon
742d78e9af record: move filterpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-10 14:42:07 -07:00
Siddharth Agarwal
8e295dc1a9 patch.internalpatch: add a default value for prefix
Rev cb4d72125aae adding a parameter here. This breaks third-party extensions
like crecord and also makes the issue fairly hard to fix on the extension's
side if it wants to retain compatibility across Mercurial versions -- in old
versions, the positional argument will be passed into the next unknown
argument, which is 'files'.

The patch also undoes a change to the record extension that is no longer
necessary.
2015-03-10 17:34:42 -07:00
Laurent Charignon
39d2901c91 record: move parsepatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:16:25 -07:00
Laurent Charignon
18e7b1d4da record: move scanpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:14:31 -07:00
Laurent Charignon
b8126743d5 record: move hunk class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:09:15 -07:00
Laurent Charignon
3b17682474 record: move header class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:04:50 -07:00
Siddharth Agarwal
eb2ddaf931 cmdutil.tryimportone: allow importing relative patches with --bypass 2015-03-10 13:06:38 -07:00
Siddharth Agarwal
3f34a651ac cmdutil.tryimportone: allow importing relative patches into the working dir
This makes hg import --prefix dir/ (without bypass) work.
2015-03-09 18:22:24 -07:00
Siddharth Agarwal
f5f1d70d92 patch.internalpatch: accept a prefix parameter 2015-03-06 22:43:47 -08:00
Siddharth Agarwal
1cc108f3fe patch.patchbackend: accept a prefix parameter 2015-03-06 22:27:41 -08:00
Siddharth Agarwal
7ebeb5b176 patch.applydiff: accept a prefix parameter
This is preparation for upcoming patches that will add support for applying a
patch within a subdirectory.
2015-03-06 22:24:49 -08:00
Siddharth Agarwal
3ad52d447e patch._applydiff: accept a prefix parameter
This is preparation for upcoming patches that will add support for applying a
patch within a subdirectory.

We normalize the prefix here because this is the main driver -- all code to
apply patches is expected to go through here.
2015-03-06 22:22:14 -08:00
Siddharth Agarwal
2adfba3ca4 patch.makepatchmeta: accept a prefix parameter
This is preparation for upcoming patches that will add support for applying a
patch within a subdirectory.
2015-03-06 22:19:26 -08:00
Siddharth Agarwal
1f6f9200c0 patch.pathtransform: add a prefix parameter
This is preparation for upcoming patches that will add support for applying a
patch within a subdirectory.

The prefix is applied after path components are stripped.
2015-03-06 22:17:24 -08:00
Siddharth Agarwal
3aa3a9554f patch.pathtransform: add doctests
In upcoming patches we're going to make this function more complex, so add some
unit tests for it.
2015-03-06 21:48:40 -08:00
Siddharth Agarwal
b529f117b7 patch: rename pathstrip to pathtransform
In upcoming patches we'll not just strip path components but also add new ones.
2015-03-06 21:12:30 -08:00
Martin von Zweigbergk
c2aa9ed527 trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]'
Perhaps it's more readable this way...
2015-02-06 16:09:43 -08:00
Martin von Zweigbergk
f2001609be trydiff: extract function that generates filename pairs
The code that identifies copies/renames, as well as the filenames
before and after, is now isolated and we can extract it to a function
so it can be overridden by extensions (in particular the narrow clone
extension).
2015-01-22 23:29:00 -08:00
Martin von Zweigbergk
8e7eeafaf5 trydiff: read file data in only one place
This moves getfilectx() out of the initial block in the loop, leaving
that block to be only about finding pairs of filenames in ctx1 and
ctx2 to diff.
2015-01-22 23:18:43 -08:00
Martin von Zweigbergk
c5d80876e7 trydiff: set filename variables to None even when not opts.git or losedatafn
There is not much left of the first block "if opts.git or losedatafn"
block now. The next patch will move the call to getfilectx() out of
that block. We will then be using the defined-ness of 'f1' to tell
whether the file existed in ctx1 (and under what name). We will need
this information whether or not opts.git or losedatafn was set, so
just remove that guard. The only operation in the block that is not
cheap is the call to getfilectx(), but that has an extra 'if opts.git'
guard already.

--ignore-space-change proves that only 'if opts.git or losedatafn:'
  was removed.
2015-01-22 23:13:48 -08:00
Martin von Zweigbergk
ff03ae13d3 trydiff: read flags in one place
Now that we can trust f1/f2 to indicate whether that side of the diff
exists, we can move the calls to ctx.flag() to a single place.
2015-01-22 23:01:00 -08:00
Martin von Zweigbergk
5cac0e0289 trydiff: break 'if opts.git or losedatafn' into two
This moves the initialization 'binary' closer to its other assignment,
but exists mostly to simplify future patches.
2015-02-06 15:21:56 -08:00
Martin von Zweigbergk
03828692db trydiff: make filenames None when they don't exist
f1 and f2 are currently set always set to some filename, even for
added or deleted files. Let's instead set them to None to indicate
that one side of the diff doesn't exist. This lets us use the filename
variables instead of the content variables and simplify a bit since
the empty string is not a valid filename. More importantly, it paves
the way for further simplifications.
2015-01-22 22:42:35 -08:00
Martin von Zweigbergk
d1957c5720 trydiff: call util.binary in only one place
It's practically free to call util.binary on empty or None content. By
relying on that, we can replace the current four call sites by one.
2015-01-22 22:22:09 -08:00
Martin von Zweigbergk
24758b719a trydiff: collect all lossiness checks in one place
By having all the checks for lossiness in one place, it becomes much
easier to get an overview of the conditions that lead to losedatafn()
being called. It also makes it obvious that it can not be called
multiple times for a single time (something that was rather tricky to
determine before).
2015-01-22 21:35:57 -08:00
Martin von Zweigbergk
67c419e3d3 trydiff: replace 'binarydiff' variable by 'binary' variable
It's not obvious, but every path in the 'if opts.git or losedatafn:'
block will have checked whether the file is binary [1]. Let's assign
the result of this check to a variable so we can simplify by checking
'binary and opts.git' in only one place instead of every place we
currently assign to 'binarydiff'.

 [1] Except when deleting an empty file, but checking whether an empty
     string is binary is very cheap anyway.
2015-01-22 21:03:57 -08:00
Martin von Zweigbergk
b7bbf4a4e7 trydiff: rename 'op' to make it more specific
Rename the 'op' variable that can take values None/'copy'/'rename' to
'copyop' to make it a little more specific.
2015-01-16 15:09:21 -08:00
Martin von Zweigbergk
1473f44d5f trydiff: join elements in 'header' list by '\n'
It seems natural that each element in the list corresponds to one line
of output. That is currently true, but only because each element in
the list has a trailing newline. Let's drop those newlines and instead
add them when we print the headers.
2015-01-16 15:34:03 -08:00
Martin von Zweigbergk
5210611f2a trydiff: move check for quietness out of diffline()
By moving the condition out of diffline(), the call site becomes
clearer and diffline() no longer closes on any variables.

Note that this changes the value of the header variable from [''] to
[], but there is no difference in how these two are treated by the
following code. The new value seems more natural anyway.
2015-01-16 15:27:04 -08:00
Martin von Zweigbergk
d00ce0b1fe trydiff: remove dead branch in diffline()
Since diffline() is never called when 'revs' is empty, it doesn't need
to handle that case.
2015-01-16 15:22:29 -08:00
Martin von Zweigbergk
a904d02975 trydiff: make 'revs' ignored if opts.git is set
Instead of setting revs=None to prevent the call to diffline() when
opts.git is set, explicitly do not call the function in the git case.
2015-01-16 15:19:57 -08:00
Martin von Zweigbergk
06e8c1de95 trydiff: remove unused argument to diffline()
Now that diffline no longer knows about copies/renames, it only needs
one argument for the path.
2015-01-16 14:58:51 -08:00
Martin von Zweigbergk
2a62729249 trydiff: move git-header code out of diffline function
This collects more of the code for writing git headers in a single
place and makes diffline() close on a few variables less.
2015-01-16 14:58:06 -08:00
Martin von Zweigbergk
13e9d82723 trydiff: inline indexmeta()
The function is trivial and is only called in one place.
2015-01-16 15:40:59 -08:00
Martin von Zweigbergk
18e0f2df1e trydiff: order header-writing code in same order as output
Instead of inserting a line before the others header lines, move the
code that writes that line before the code that writes the other
lines.
2015-01-16 14:49:08 -08:00
Martin von Zweigbergk
e67ec1dc7b trydiff: inline sole addmodehdr() call
Now that there is only a single call to addmodehdr() left, and there
is other similar code (for new/deleted files) around that call site,
let's inline the function there. That also makes it clearer under what
circumstances the header is actually written (when modes differ).
2015-01-16 14:53:37 -08:00
Martin von Zweigbergk
26f9ad4736 trydiff: join filename with prefix only once 2015-01-16 14:46:03 -08:00
Martin von Zweigbergk
fa3ad9c66e trydiff: collect header-writing in one place
This is the first step towards simplifying the big loop in
trydiff(). This will make both the header code and the non-header code
clearer, and it prepares for further simplification of the many nested
if-statements in the body of the loop.
2015-01-22 17:00:54 -08:00
Martin von Zweigbergk
2cda80f871 trydiff: make variable names more consistent
Use '1' and '2' as suffix for names just like in the parameters
'ctx[12]':

to,tn -> content1,content2
a,b -> f1, f2
omode,mode -> mode1,mode2
omode,nmode -> mode1,mode2
onode,nnode -> node1,node2
oflag,nflag -> flag1,flag2
oindex,nindex -> index1,index2
2015-01-16 10:57:13 -08:00
Martin von Zweigbergk
20500e2442 trydiff: check only if added file is a copy target, not source
When creating a diff with copy/rename enabled, we consider added files
and check if they are either copy sources or targets. However, an
added file should never be a copy source. The test suite seems to
agree with this: all tests pass if we raise an exception when an added
file is a copy source. So, let's simplify the code by dropping the
conditions that are never true.

For those interested in the historical reasons:

Before commit c15c00e7afba (patch: separate reverse copy data
(issue1959), 2010-02-11), 'copy' seems to have been a bidirectional
map. Then that commit split it up into two unidirectional maps and
duplicated the logic to look in both maps. It was still needed at that
point to look in both maps, as the copy detection was poor and could
sometimes be reported in reverse.

A little later came 5a644704d5eb (copies: rewrite copy detection for
non-merge users, 2012-01-04). That commit fixed the copy detection to
be backwards when it should, and made the hacks in trydiff
unnecessary.
2015-01-16 17:01:58 -08:00
Martin von Zweigbergk
74a4151049 trydiff: remove unused variable 'modifiedset'
We started updating 'modifiedset' in e85e48ffb83e (trydiff: simplify
checking for additions, 2014-12-23) but in the same commit, we removed
the last use of the variable. Clean it up.
2015-01-29 21:12:35 -08:00
Martin von Zweigbergk
fc35342dbb diff: use binary diff when copy source is binary
When a binary source has been copied or renamed into a non-binary
file, we don't check whether the copy source was binary. There is a
code comment explaining that a git mode will be forced anyway in order
to capture the copy record (i.e. losedatafn() will be called). This is
true, but forcing git mode is not the only effect binary files have:
when git mode was already requested, we use the binary-ness to tell us
whether to use a regular unified diff or a git binary diff. The user
sees this as a "Binary file $file has changed" instead of the binary
2015-01-17 15:03:41 -08:00
Martin von Zweigbergk
f60106670d trydiff: replace dodiff=True/'binary' by binarydiff=False/True 2015-01-07 11:02:10 -08:00
Martin von Zweigbergk
4a8198a6db trydiff: replace 'dodiff = False' by 'continue'
The 'dodiff' variable is initialized to True and may later be set to
either False or "binary". When it's set to False, we skip everything
after that point, so we can simplify by instead continue-ing (the
loop). We can then also drop the 'if dodiff', since it will always be
true.
2015-01-07 10:59:40 -08:00
Martin von Zweigbergk
86561cd4f0 trydiff: make addindexmeta() unconditionally add index meta
The conditional-ness is not clear from the name and there is only one
caller, so it's clearer to check on the call site. Moving it also
makes addindexmeta() no longer close on the 'opts' variable.
2015-01-07 08:54:26 -08:00
Martin von Zweigbergk
590312deed trydiff: remove unused code for git index of "combined diff"
We only ever produce diffs with one pre- and one post-image, so remove
the code for displaying "index" lines for combined diffs.
2015-01-07 08:46:52 -08:00
Martin von Zweigbergk
a92bd0f094 diff: remove dead assignment 2015-01-06 22:55:01 -08:00
Martin von Zweigbergk
d21c241927 trydiff: use 'ctx1.flags()' for symmetry with 'ctx2.flags()' 2014-12-23 16:16:26 -08:00
Martin von Zweigbergk
0154ee1c3e trydiff: use 'not in addedset' for symmetry with 'not in removedset'
With the previous change in place, we can safely use 'addedset'.
2014-12-23 16:25:00 -08:00
Martin von Zweigbergk
a69f913d1d trydiff: simplify checking for additions
In the body of the loop in trydiff(), there are conditions like:

  addedset or (f in modifiedset and to is None)

The second half of that expression is to account for the fact that
merge-in additions appear as additions. By instead fixing up the sets
of modified and added files to compensate for this fact, we can
simplify the body of the loop. It also fixes one case where the
addedset was checked without the additional check (the "have we
already reported a copy above?" case in the code, also see fixed test
case).

The similar condition with 'removedset' in it seems to have served no
purpose even before this change, so it could have been simplified even
before.
2014-12-23 16:12:54 -08:00
Martin von Zweigbergk
12fa2d93ff trydiff: extract 'date2' variable like existing 'date1'
Note that there is a comment saying "ctx2 date may be dynamic". The
comment was introduced in 8ed3d2a60500 (patch: use contexts for diff,
2006-12-25), but it seems like it stopped being dynamic in that very
changeset -- before that changeset, the date seems to have been the
file's mtime, but after the changeset, it seems to be the changeset's
timestamp (current time for workingctx). Since no one seems to have
missed the "dynamicness", let's simplify and extract a date2 for
symmetry with date1.
2014-12-23 14:56:30 -08:00
Martin von Zweigbergk
c7f4a068b8 trydiff: use sets, not lists, for containment checks
This only has a noticeable effect on diffs touching A LOT of
files. For example, it takes

  hg diff -r FIREFOX_AURORA_30_BASE -r FIREFOX_AURORA_35_BASE

from 1m55.465s to 1m32.354s. That diff has over 50k files.
2014-12-23 10:41:45 -08:00
Siddharth Agarwal
113c428a6d patch.difffeatureopts: add a feature for format-changing diffopts
Typically, callers that are interested in this set are also interested in the
others. We still add it as a first-class flag for convenience.
2014-11-18 17:22:03 -08:00
Siddharth Agarwal
542813a378 patch.difffeatureopts: add a feature for whitespace diffopts
These aren't exactly format-breaking features -- just ones for which patches
applied to a repo will produce incorrect commits, In any case, some commands
like record and annotate only care about this feature.
2014-11-18 17:09:26 -08:00
Siddharth Agarwal
8c24c56a7e patch.difffeatureopts: add a feature for diff.git
This deserves to be its own feature -- indeed, this is often the only feature
several commands care about.
2014-11-18 17:10:14 -08:00
Siddharth Agarwal
3864c7a9bb patch: rename diffopts to diffallopts
This is meant to be used when all features are explicitly requested. diffopts
is kept as an alias for now -- it will go away soon.
2014-11-18 21:43:38 -08:00
Siddharth Agarwal
56b105c2c6 patch: add a new function to initialize diffopts by feature
Not all callers are interested in all diffopts -- for example, commands like
record (which use diff internally) break when diffopts like noprefix are
enabled. This function will allow us to add flags that callers can use to
enable only the features they're interested in.
2014-11-18 16:53:22 -08:00
Siddharth Agarwal
e42499560a patch.diffopts: use a dict for initialization
In upcoming patches we'll conditionally add to and remove from the dict.
2014-11-18 16:00:54 -08:00
Siddharth Agarwal
48ef0179c1 patch.trydiff: add support for noprefix 2014-11-12 23:50:21 -08:00
Siddharth Agarwal
37a8021dad patch.diffopts: add support for noprefix
In an upcoming patch we'll enable support as an option to 'hg diff' as well.

The tests reflect the current state of the world -- as we add support we'll see
changes in the test output.
2014-11-13 00:08:44 -08:00
Siddharth Agarwal
ccd6611ec9 patch.diffopts: allow a setting to be forced in plain mode
Upcoming patches will add an option that will almost certainly break diff
output parsers when enabled. Add support for forcing an option to something in
plain mode, as a fallback. Options passed in via the CLI are not affected,
though -- it is assumed that any script passing the option in explicitly knows
what it is doing.
2014-11-12 23:47:25 -08:00
Siddharth Agarwal
dabae3afed patch.diffopts: break get function into if statements
We're going to add another condition here, and with the current structure that
becomes just too confusing.
2014-11-12 23:44:17 -08:00
Jordi Gutiérrez Hermoso
60df7a50e9 patch: enable diff.tab markup for the color extension
The following patch splits up changed lines along tabs (using
re.findall), and gives them a "diff.tab" label. This can be used by
the color extension for colorising tabs, like it does right now with
trailing whitespace.

I also provide corresponding tests.
2014-08-20 15:15:50 -04:00
Mads Kiilerich
4dd236da3f convert: use None value for missing files instead of overloading IOError
The internal API used IOError to indicate that a file should be marked as
removed.

There is some correlation between IOError (especially with ENOENT) and files
that should be removed, but using IOErrors to represent file removal internally
required some hacks.

Instead, use the value None to indicate that the file not is present.

Before, spurious IO errors could cause commits that silently removed files.
They will now be reported like all other IO errors so the root cause can be
fixed.
2014-08-26 22:03:32 +02:00