Closed Bug 518224 Opened 15 years ago Closed 15 years ago

[HTML5] Update parser/html/java Makefiles to sync from hg.mozilla.org/projects/htmlparser

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mozilla+ben, Assigned: mozilla+ben)

References

Details

Attachments

(2 files, 1 obsolete file)

Unless problems arise, I'm intending to use the new hg support for subrepos:
http://mercurial.selenic.com/wiki/subrepos
(In reply to comment #0)
> Unless problems arise, I'm intending to use the new hg support for subrepos:
> http://mercurial.selenic.com/wiki/subrepos

Support for subrepos in hg 1.3.1 is inadequate.  After an evening of trying, I can't figure out how to adjust my patch queue workflow to accommodate subrepositories without shooting myself in the foot.  I'll file a separate bug, in the hope that support some day matures to the point of usability.

Fortunately the fallback is easy: make sync can just clone the htmlparser repo, similar to the way we currently checkout the svn repo.
Notes:

- When you do a 'make sync' inside parser/html/java/htmlparser, a backup archive of the old src directory (if any) is now created (e.g., src.1253685152.tgz), so local changes are not lost.  Changes can be "reverted" by typing 'tar zxvf src.1253685152.tgz'.

- Added a 'spotless' make target to remove files pulled in by 'make sync'.  The 'clean' target should still be used when you want to force a complete rebuild.  Backup .tgz archives are *not* removed by 'make spotless'.

- Making within parser/html/java/{html,java}parser now places the resulting .jar file into the parent directory.  Previously parser/html/java/Makefile was responsible for copying the .jars, which was awkward.

- parser/html/java/translator is no longer used, because parser/html/java/htmlparser/src/translator-src contains all those files.  I'll remove the translator directory in a subsequent patch.
Attachment #402283 - Flags: review?(hsivonen)
Blocks: 518286
Comment on attachment 402283 [details] [diff] [review]
Syncing the safe way (no subrepos).

(In reply to comment #2)
> - When you do a 'make sync' inside parser/html/java/htmlparser, a backup
> archive of the old src directory (if any) is now created (e.g.,
> src.1253685152.tgz), so local changes are not lost.  Changes can be "reverted"
> by typing 'tar zxvf src.1253685152.tgz'.

Is there a mechanism that makes hg ignore these? Is there a risk of accidentally committing the tarballs to hg?

Have you considered a solution to the case where there are multiple patches to m-c being baked in MQ and they involve parser core or translator changes? It would be awesome to have a way to make sync from htmlparser clone MQ into m-c clone MQ, but if it's too complex, it's probably not worthwhile to support. Currently, when I move on in the m-c MQ, I simply don't revise the generated source in the older patches in the queue. If something is wrong, I fix it in the tip of the queue, which isn't quite elegant (as seen over in bug 515338 comment 8 in reference to now-useless methods in nsHtml5Portability.cpp).

>+    htmlparser/src/src/nu/validator/htmlparser/impl \

src/src/ isn't quite nice.

>+  hg clone https://hg.mozilla.org/projects/htmlparser src

It seems a bit confusing to call the local directory "src". Can the middle directory in htmlparser/src/src be practically flattened out? Or could its parent be renamed? So that the end path would be 
parser/html/java/htmlparser/src and "htmlparser" would correspond to https://hg.mozilla.org/projects/htmlparser

>+; ./sync-src.sh $(SVN_BASE)/src && \
>+  ./sync-files.sh $(SVN_BASE) COPYING COPYING.LESSER readme.txt

I suggest renaming SVN_BASE to HG_BASE.
There is now only one Makefile, with the following targets:

  libs
  translator
  javaparser
  sync_javaparser
  sync_htmlparser
  sync
  translate
  named_characters
  clean_javaparser
  clean_htmlparser
  clean

The sync operations now detect existing checkouts (javaparser and htmlparser) and attempt to update them (svn up and hg pull --rebase).  You'll want to have the rebase= option enabled in your .hgrc, if you don't already.  This should help address the concerns about MQ workflow.
Attachment #402283 - Attachment is obsolete: true
Attachment #402421 - Flags: review?(hsivonen)
Attachment #402283 - Flags: review?(hsivonen)
(In reply to comment #2)
> - parser/html/java/translator is no longer used, because
> parser/html/java/htmlparser/src/translator-src contains all those files.  I'll
> remove the translator directory in a subsequent patch.

As promised.
Attachment #402428 - Flags: review?(hsivonen)
Attachment #402428 - Flags: review?(hsivonen) → review+
Comment on attachment 402421 [details] [diff] [review]
Patch addressing review feedback.

Looks good to me.
Attachment #402421 - Flags: review?(hsivonen) → review+
Pushed to mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/844d2970be5f
http://hg.mozilla.org/mozilla-central/rev/213da42e5f65
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Would you think it is worth to add to parser/html/java/README.txt some indication that you need to enable the Rebase extension (http://mercurial.selenic.com/wiki/RebaseProject) - for example, that you should add to your ~/.hgrc
[extension]
rebase =

Otherwise, you get an error (below) trying to rerun "make sync" and the suggested "hg help pull" does not help.

$ make sync
if [ -d javaparser/.svn ] ; \
  then cd javaparser ; svn up ; cd .. ; \
  else \
    rm -rf javaparser ; \
    svn co http://javaparser.googlecode.com/svn/trunk/JavaParser javaparser ; \
  fi
Updating '.':
At revision 203.
if [ -d htmlparser/.hg ] ; \
  then cd htmlparser ; hg pull --rebase ; cd .. ; \
  else \
    rm -rf htmlparser ; \
    hg clone https://hg.mozilla.org/projects/htmlparser ; \
  fi
hg pull: option --rebase not recognized
hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]

pull changes from the specified source

options:

 -u --update                update to new branch head if changesets were
                            pulled
 -f --force                 run even when remote repository is unrelated
 -r --rev REV [+]           a remote changeset intended to be added
 -B --bookmark BOOKMARK [+] bookmark to pull
 -b --branch BRANCH [+]     a specific branch you would like to pull
 -e --ssh CMD               specify ssh command to use
    --remotecmd CMD         specify hg command to run on the remote side
    --insecure              do not verify server certificate (ignoring
                            web.cacerts config)

[+] marked option can be specified multiple times

use "hg help pull" to show the full help text
You need to log in before you can comment on or make changes to this bug.