How do I compare two pages in same space
Asked by Stephen Kairys:

**Confluence Server 5.9.7**

I have two **different** pages in the same space. They are similar, with minor differences. Call them:

VENDORS and VENDORS_NEW

How do I generate a comparison of these two pages? I'm looking for something similar to the "Compare Selected Versions" that compares two historical versions of the **same** page (within PAGE HISTORY).

Since Confluence has the above ability within the same page, I'd hope it could do the same with two separate pages. :smile:

Thanks,

Stephen


Answers:
author: Milo Test
body: I don't think it can be done within Confluence. I'd export them both to PDF then use Acrobat to do a comparison.

On the other hand, why don't you just copy the VENDORS page, then edit the VENDORS_NEW page, select all and copy, then edit the Copy of VENDORS page, select all and paste. Then you can use the history compare feature.

comments: author: Stephen Kairys
body: Thank you. (I like your 2nd solution.) As it turns out, i realized that v1 (in Page History) of VENDORS_NEW is very close to the last version of VENDORS. So, I ended up comparing v1 to v50 (current version).

You'd think, though, that Confluence would support page-to-page compare...I wonder if that's a feature request. :smile:


author: Stephen Kairys
body: Question:

1. Is this method (your 2nd suggestion) known to occasionally produce a false positive? I see one difference reported (text added) that seems to be wrong as there is no visible change.
2. Does the Page History compare tend to show a lot of content before and after one difference? e.g. the difference is on line 1200 of the doc, but I see (e.g.) 1150-1250?

Thanks.


author: Ren? Kjellerup
body: another way to accomplish this, could be done with python.

If you are familiar with the output from the posix **diff -u** command:

```
#!/usr/bin/env pythonimport difflib
import systry:    from xmlrpc.client import ServerProxy    from xmlrpc.client import Faultexcept:    from xmlrpclib import ServerProxy    from xmlrpclib import Faultdef get_page(page_id,             confluence_url='https://<confluence_domain>',             confluence_login='<username>',             confluence_password='<password>'):    client = ServerProxy(confluence_url+"/rpc/xmlrpc", verbose=0)    try:        auth_token = client.confluence2.login(confluence_login,                                              confluence_password)    except:        print("Can't login to confluence")        return []    try:        # getting confluence page        page = client.confluence2.getPage(auth_token, page_id)    except Fault as e:        print(e.faultString)        return []    return page['content'].split('\n')if len(sys.argv) < 3:
    print("usage:" + sys.argv[0] + " page_id_1 page_id_2")for line in difflib.unified_diff(get_page(sys.argv[1]), get_page(sys.argv[2]), fromfile='pageID='+sys.argv[1], tofile='pageID='+sys.argv[2]):    print(line[:-1])
```

this little script could help you


author: Alexandre Morgaut
body: It is very frequent in confluence to have this kind of requirements

* Cloned pages for
  * meeting minutes
  * feature specification variants
  * technical specification variants
  * ...
* Pages created from templates

I would expect to have this as a standard feature

As of today

* As mentioned page comparison exists within page history
* We already have fields to retrieve another page (ex: "new parent page" in the "move page" form) which could help defining the page to compare with

so the work should not be enormous

With more effort such "Compare with" feature could also propose

* a filter for pages sharing the same template
* a quick selection, if any, to the page the current page was cloned from